feat(metrics): Add trace metric enrichment with default and user attributes (RUST-169)#1031
Draft
szokeasaurusrex wants to merge 2 commits intoszokeasaurusrex/core-metrics-capturefrom
Draft
Conversation
…ibutes (RUST-169) Add metric enrichment in sentry-core so emitted trace metrics include: - Trace/span association: trace_id from active span or propagation context, span_id from active span when not explicitly set. - Default SDK attributes: sentry.environment, sentry.release, sentry.sdk.name, sentry.sdk.version, and server.address. - User PII attributes (user.id, user.name, user.email) gated by send_default_pii. - before_send_metric callback for filtering/modifying metrics. Attribute merges use or_insert to preserve explicitly set metric attributes, matching the behavior specified in https://develop.sentry.dev/sdk/telemetry/metrics/#default-attributes and https://develop.sentry.dev/sdk/telemetry/metrics/#user-attributes. Scope and client enrichment logic is based on the approach from #997. Co-authored-by: Joris Bayer <joris.bayer@sentry.io> Closes #1024 Closes [RUST-169](https://linear.app/getsentry/issue/RUST-169/add-trace-metric-default-and-user-attribute-enrichment-in-sentry-core)
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Features
- Add trace metric enrichment with default and user attributes (RUST-169) ([#1031](https://github.com/getsentry/sentry-rust/pull/1031))If none of the above apply, you can opt out of this check by adding |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add metric enrichment in sentry-core so emitted trace metrics include:
context, span_id from active span when not explicitly set.
sentry.sdk.name, sentry.sdk.version, and server.address.
send_default_pii.
Attribute merges use or_insert to preserve explicitly set metric
attributes, matching the behavior specified in
https://develop.sentry.dev/sdk/telemetry/metrics/#default-attributes
and https://develop.sentry.dev/sdk/telemetry/metrics/#user-attributes.
Scope and client enrichment logic is based on the approach from #997.
Co-authored-by: Joris Bayer joris.bayer@sentry.io
Closes #1024
Closes RUST-169