-
Notifications
You must be signed in to change notification settings - Fork 125
Add w3c traceparent header support #1448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1448 +/- ##
==========================================
- Coverage 80.33% 79.01% -1.33%
==========================================
Files 209 209
Lines 23709 23737 +28
Branches 3740 3745 +5
==========================================
- Hits 19047 18755 -292
- Misses 3437 3768 +331
+ Partials 1225 1214 -11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9df984c
to
8a24ae6
Compare
8a24ae6
to
bd981c4
Compare
3be0999
to
971ede6
Compare
@pytest.mark.parametrize( | ||
"sampled,remote_parent_sampled,remote_parent_not_sampled,expected_sampled,expected_priority,expected_adaptive_sampling_algo_called", | ||
( | ||
(True, 'default', 'default', None, None, True), # Uses sampling algo. | ||
(True, 'always_on', 'default', True, 2, False), # Always sampled. | ||
(True, 'always_off', 'default', False, 0, False), # Never sampled. | ||
(False, 'default', 'default', None, None, True), # Uses sampling algo. | ||
(False, 'always_on', 'default', None, None, True), # Uses sampling alog. | ||
(False, 'always_off', 'default', None, None, True), # Uses sampling algo. | ||
(True, 'default', 'always_on', None, None, True), # Uses sampling algo. | ||
(True, 'default', 'always_off', None, None, True), # Uses sampling algo. | ||
(False, 'default', 'always_on', True, 2, False), # Always sampled. | ||
(False, 'default', 'always_off', False, 0, False), # Never sampled. | ||
) | ||
) | ||
def test_distributed_trace_w3cparent_sampling_decision(sampled, remote_parent_sampled, remote_parent_not_sampled, expected_sampled, expected_priority, expected_adaptive_sampling_algo_called, wrap_sampling_algo_compute_sampled_and_priority): | ||
required_intrinsics = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this should potentially be ported to the cross agent tests and standarized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a really good point! It doesn't look like we have any but I'll create a ticket for myself to add some-then maybe we can get rid of this one in leu of the cross agent test.
@pytest.fixture | ||
def wrap_sampling_algo_compute_sampled_and_priority(): | ||
global was_called | ||
was_called = False | ||
|
||
def _wrap_sampling_algo_compute_sampled_and_priority(wrapped, instance, args, kwargs): | ||
global was_called | ||
was_called = True | ||
return wrapped(*args, **kwargs) | ||
|
||
return _wrap_sampling_algo_compute_sampled_and_priority | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code here in this fixture and the code that's applying this as a wrapper should be a validator and go in the validators folder. This should be using a transient function wrapper that auto applies and unapplies this wrapping to the sampling_algo...
function when the test runs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're looking for validate_function_called
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bunch of places where the imports are screwed up now due to moving that validator, I'll stop reviewing there and let you re-check those.
@@ -15,7 +15,7 @@ | |||
import django | |||
import pytest | |||
import webtest | |||
from testing_support.fixtures import function_not_called, override_generic_settings | |||
from testing_support.validators.validate_function_not_called import validate_function_not_called, override_generic_settings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from testing_support.validators.validate_function_not_called import validate_function_not_called, override_generic_settings | |
from testing_support.fixtures import override_generic_settings | |
from testing_support.validators.validate_function_not_called import validate_function_not_called |
from testing_support.fixtures import ( | ||
function_not_called, | ||
validate_function_not_called, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from testing_support.fixtures import ( | |
function_not_called, | |
validate_function_not_called, | |
from testing_support.fixture.validate_function_not_called import validate_function_not_called | |
from testing_support.fixtures import ( |
…lic/newrelic-python-agent into add-w3c-traceparent-header-support
Overview
Add support for w3c traceparent sampled flag. See agent spec for details.