-
Notifications
You must be signed in to change notification settings - Fork 131
Add support for partial granularity type #1532
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
Open
hmstepanek
wants to merge
20
commits into
develop-hybrid-core-tracing
Choose a base branch
from
partial-granularity-type-support
base: develop-hybrid-core-tracing
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
fcaeb10
Fix error when shutdown_agent called from harvest thread (#1552)
TimPansino 669f51e
Add support 4 partial granularity tracing
hmstepanek 996ee66
fix(aiomysql): avoid wrapping pooled connections multiple times (#1553)
canonrock16 6d7be8c
Fix structlog tests (#1556)
TimPansino f9ab47b
Bump the github_actions group with 4 updates (#1555)
dependabot[bot] d1e7b60
Add instrumentation for new kinesis method (#1557)
TimPansino 09eaa22
Move config consolidation into global settings
hmstepanek b9efe7e
Fix error when shutdown_agent called from harvest thread (#1552)
TimPansino 8a3eb42
fix(aiomysql): avoid wrapping pooled connections multiple times (#1553)
canonrock16 3a83b40
Fix structlog tests (#1556)
TimPansino 7a484b3
Bump the github_actions group with 4 updates (#1555)
dependabot[bot] edbfd79
Add instrumentation for new kinesis method (#1557)
TimPansino f52e9bd
[MegaLinter] Apply linters fixes
hmstepanek 923ad1d
Trigger tests
hmstepanek 953f379
Add free-threaded Python to CI (#1562)
TimPansino e024468
Move inifinte tracing override to server side config
hmstepanek d16d5dc
Add free-threaded Python to CI (#1562)
TimPansino 9c14833
Merge branch 'main' into partial-granularity-type-support
hmstepanek db65db3
[MegaLinter] Apply linters fixes
hmstepanek 7fd81a6
Trigger tests
hmstepanek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -337,6 +337,14 @@ class DistributedTracingSamplerSettings(Settings): | |
| pass | ||
|
|
||
|
|
||
| class DistributedTracingSamplerFullGranularitySettings(Settings): | ||
| pass | ||
|
|
||
|
|
||
| class DistributedTracingSamplerPartialGranularitySettings(Settings): | ||
| pass | ||
|
|
||
|
|
||
| class ServerlessModeSettings(Settings): | ||
| pass | ||
|
|
||
|
|
@@ -507,6 +515,8 @@ class EventHarvestConfigHarvestLimitSettings(Settings): | |
| _settings.debug = DebugSettings() | ||
| _settings.distributed_tracing = DistributedTracingSettings() | ||
| _settings.distributed_tracing.sampler = DistributedTracingSamplerSettings() | ||
| _settings.distributed_tracing.sampler.full_granularity = DistributedTracingSamplerFullGranularitySettings() | ||
| _settings.distributed_tracing.sampler.partial_granularity = DistributedTracingSamplerPartialGranularitySettings() | ||
| _settings.error_collector = ErrorCollectorSettings() | ||
| _settings.error_collector.attributes = ErrorCollectorAttributesSettings() | ||
| _settings.event_harvest_config = EventHarvestConfigSettings() | ||
|
|
@@ -845,6 +855,27 @@ def default_otlp_host(host): | |
| _settings.distributed_tracing.sampler.remote_parent_not_sampled = os.environ.get( | ||
| "NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_REMOTE_PARENT_NOT_SAMPLED", "default" | ||
| ) | ||
| _settings.distributed_tracing.sampler.full_granularity.enabled = _environ_as_bool( | ||
| "NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_FULL_GRANULARITY_ENABLED", default=True | ||
| ) | ||
| _settings.distributed_tracing.sampler.full_granularity.remote_parent_sampled = os.environ.get( | ||
| "NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_FULL_GRANULARITY_REMOTE_PARENT_SAMPLED", None | ||
| ) | ||
| _settings.distributed_tracing.sampler.full_granularity.remote_parent_not_sampled = os.environ.get( | ||
| "NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_FULL_GRANULARITY_REMOTE_PARENT_NOT_SAMPLED", None | ||
| ) | ||
| _settings.distributed_tracing.sampler.partial_granularity.enabled = _environ_as_bool( | ||
| "NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_PARTIAL_GRANULARITY_ENABLED", default=False | ||
| ) | ||
| _settings.distributed_tracing.sampler.partial_granularity.type = os.environ.get( | ||
| "NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_PARTIAL_GRANULARITY_TYPE", "essential" | ||
| ) | ||
| _settings.distributed_tracing.sampler.partial_granularity.remote_parent_sampled = os.environ.get( | ||
| "NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_PARTIAL_GRANULARITY_REMOTE_PARENT_SAMPLED", "default" | ||
| ) | ||
| _settings.distributed_tracing.sampler.partial_granularity.remote_parent_not_sampled = os.environ.get( | ||
| "NEW_RELIC_DISTRIBUTED_TRACING_SAMPLER_PARTIAL_GRANULARITY_REMOTE_PARENT_NOT_SAMPLED", "default" | ||
| ) | ||
| _settings.distributed_tracing.exclude_newrelic_header = False | ||
| _settings.span_events.enabled = _environ_as_bool("NEW_RELIC_SPAN_EVENTS_ENABLED", default=True) | ||
| _settings.event_harvest_config.harvest_limits.span_event_data = _environ_as_int( | ||
|
|
@@ -1371,9 +1402,34 @@ def finalize_application_settings(server_side_config=None, settings=_settings): | |
|
|
||
| application_settings.attribute_filter = AttributeFilter(flatten_settings(application_settings)) | ||
|
|
||
| simplify_distributed_tracing_sampler_granularity_settings(application_settings) | ||
|
||
|
|
||
| return application_settings | ||
|
|
||
|
|
||
| def simplify_distributed_tracing_sampler_granularity_settings(settings): | ||
| # Full granularity settings may appear under: | ||
| # * `distributed_tracing.sampler` | ||
| # * `distributed_tracing.sampler.full_granularity` | ||
| # The `distributed_tracing.sampler.full_granularity` path takes precedence. | ||
| # To simplify logic in the code that uses these settings, store the values that | ||
| # should be used at the `distributed_tracing.sampler.full_granularity` path. | ||
| if not settings.distributed_tracing.sampler.full_granularity.remote_parent_sampled: | ||
| settings.distributed_tracing.sampler.full_granularity.remote_parent_sampled = ( | ||
| settings.distributed_tracing.sampler.remote_parent_sampled | ||
| ) | ||
| if not settings.distributed_tracing.sampler.full_granularity.remote_parent_not_sampled: | ||
| settings.distributed_tracing.sampler.full_granularity.remote_parent_not_sampled = ( | ||
| settings.distributed_tracing.sampler.remote_parent_not_sampled | ||
| ) | ||
| # Partial granularity tracing is not available in infinite tracing mode. | ||
| if settings.infinite_tracing.enabled and settings.distributed_tracing.sampler.partial_granularity.enabled: | ||
| _logger.warning( | ||
| "Improper configuration. Infinite tracing cannot be enabled at the same time as partial granularity tracing. Setting distributed_tracing.sampler.partial_granularity.enabled=False." | ||
| ) | ||
| settings.distributed_tracing.sampler.partial_granularity.enabled = False | ||
lrafeei marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| def _remove_ignored_configs(server_settings): | ||
| if not server_settings.get("agent_config"): | ||
| return server_settings | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 just realized that
simplify_distributed_tracing_sampler_granularity_settings()should eitherattribute_filterapplication, but right afterapply_server_side_settings()apply_server_side_settings()(maybe after thecustom_insights_events.max_attribute_valueoverride?)