-
Notifications
You must be signed in to change notification settings - Fork 93
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
feat(metrics): Ignore transaction metrics allowlist [INGEST-1628] #1484
Conversation
assert_eq!(metric.tags["platform"], "javascript"); | ||
assert!(!metric.tags.contains_key("bogus")); | ||
} | ||
insta::assert_debug_snapshot!(metrics, @r###" |
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 test diff is large because a few tests used the metrics allowlist to filter down metrics returned. In the process, I decided to replace ad-hoc assert statements with insta::assert_debug_snapshot!
where possible.
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 test diff is large because a few tests used the metrics allowlist to filter down metrics returned.
Definitely out of the scope of this PR, but tests should not interfere with other tests.
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 like using snapshots (vs ad-hoc asserts) a lot. However, making this change in this PR makes focusing on the relevant aspects harder, vs having another PR for the refactor. No action required on this PR, just a note for future PRs.
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.
Agreed. Splitting the PRs is actually not that hard, so I did it here: #1500.
let config: TransactionMetricsConfig = serde_json::from_str( | ||
r#" | ||
{ | ||
"version": 1, | ||
"extractMetrics": [ |
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.
TODO: remove extractMetrics
from all test cases.
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.
Not blocking, but I want to understand the removal of total.time
first.
if measurement_name == "total.time" { | ||
// The only reason we do not emit total.time as a metric is that is was not | ||
// on the allowlist in sentry before, and nobody seems to be missing it. | ||
continue; | ||
} |
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 don't understand why we should remove it. If it's not in the allowlist and a user adds it, my expectation is either to treat is as a custom measurement or to just not support it (e.g. it could be a typo).
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.
total.time
is a special case because it is generated by Relay itself:
relay/relay-general/src/store/normalize/breakdowns.rs
Lines 144 to 148 in 2a63da2
let total_time_value = Annotated::new(Measurement { | |
value: Annotated::new(relay_common::duration_to_millis(total_time)), | |
unit: Annotated::new(MetricUnit::Duration(DurationUnit::MilliSecond)), | |
}); | |
breakdown.insert("total.time".to_string(), total_time_value); |
Even if a user sets it, Relay overwrites it.
It probably makes sense to extract total.time
as a metric, but there are three reasons why I wouldn't do it in this PR:
- It was previously not in the allowlist, and I don't want this PR to change anything about our externally visible behavior in production.
- Since
total.time
is generated by Relay, we would now emit an additional metric for every transaction that has breakdowns, something that we should coordinate with storage. - (more practical): There is an integration test that will break Relay CI if we add a metric: https://github.com/getsentry/sentry/blob/72ed3980d2113aed3c44d7bcec18d1d7513c074f/tests/relay_integration/test_metrics_extraction.py#L14. This is fine if we want to deliberately add the metric, but I think that should be a separate PR.
cc @jan-auer
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.
Sounds good, thanks for the explanation.
Out of the scope of the PR, but we should make a decision on if we want to keep it or not. If nobody misses it (or can be calculated from other metrics), we can remove it from the codebase instead of generating and discarding it.
assert_eq!(metric.tags["platform"], "javascript"); | ||
assert!(!metric.tags.contains_key("bogus")); | ||
} | ||
insta::assert_debug_snapshot!(metrics, @r###" |
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 test diff is large because a few tests used the metrics allowlist to filter down metrics returned.
Definitely out of the scope of this PR, but tests should not interfere with other tests.
assert_eq!(metric.tags["platform"], "javascript"); | ||
assert!(!metric.tags.contains_key("bogus")); | ||
} | ||
insta::assert_debug_snapshot!(metrics, @r###" |
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 like using snapshots (vs ad-hoc asserts) a lot. However, making this change in this PR makes focusing on the relevant aspects harder, vs having another PR for the refactor. No action required on this PR, just a note for future PRs.
Co-authored-by: Iker Barriocanal <32816711+iker-barriocanal@users.noreply.github.com>
Replacing ad-hoc asserts in tests with `insta::assert_debug_snapshot!` should improve readability and make it easier to adapt the tests when functionality changes (see #1484).
if measurement_name == "total.time" { | ||
// The only reason we do not emit total.time as a metric is that is was not | ||
// on the allowlist in sentry before, and nobody seems to be missing it. | ||
continue; | ||
} |
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.
Sounds good, thanks for the explanation.
Out of the scope of the PR, but we should make a decision on if we want to keep it or not. If nobody misses it (or can be calculated from other metrics), we can remove it from the codebase instead of generating and discarding it.
In #1484, we stopped using the old project config entries `transactionMetrics.extractMetrics` and `transactionMetrics.customMeasurements` because they have become unnecessary for Relay. However, they are needed by outdated downstream Relays to function correctly, so they should be part of the project configs we serialize for use in downstream instances.
With custom measurements limited by the
measurements
config in event normalization (see #1483), we do not need the special allowlist for transaction metrics anymore.Do not merge until getsentry/sentry#39001 has been deployed.
Note that after merging this PR, Sentry will still be sending the old config format to support old Relay instances. We will need a bump of
transactionMetrics.VERSION
to finally clean up that part.#skip-changelog