Skip to content
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): Prefix all metric names [INGEST-548] #1147

Merged
merged 11 commits into from
Dec 14, 2021
Merged

Conversation

jjbayer
Copy link
Member

@jjbayer jjbayer commented Dec 6, 2021

Add product-specific prefixes to all metric names.
See also https://www.notion.so/sentry/Metrics-Namespaces-3679dfa27ed14b98975b154eb580644c.

This requires #1146 to be merged first.

"sentry.transactions.measurements.lcp",
"sentry.transactions.breakdowns.breakdown1.bar",
"sentry.transactions.breakdowns.breakdown2.baz",
"sentry.transactions.breakdowns.breakdown2.zap"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I briefly considered omitting the prefixes in the project config, since we're already in a config object called transactionMetrics. But I figured that listing the full metric name would simplify searching for it, as with snuba referrers.

@@ -115,7 +128,7 @@ pub fn extract_transaction_metrics(
};

push_metric(Metric {
name: format!("breakdown.{}.{}", breakdown, name),
name: metric_name(&["breakdowns", breakdown, name]),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this renames metrics from breakdown.foo to breakdowns.foo, to be consistent with measurements.

@jjbayer jjbayer marked this pull request as ready for review December 6, 2021 15:42
@jjbayer jjbayer requested a review from a team December 6, 2021 15:42
fn metric_name(parts: &[&str]) -> String {
let mut name = METRIC_NAME_PREFIX.to_owned();
for part in parts {
name = format!("{}.{}", name, part);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name = format!("{}.{}", name, part);
write!(".{}", part);

this may need some bogus error-handling because it goes through io::Write, but it prevents string allocations

@jjbayer jjbayer merged commit 22afc3e into master Dec 14, 2021
@jjbayer jjbayer deleted the feat/rename-metrics branch December 14, 2021 09:55
jjbayer added a commit to getsentry/sentry that referenced this pull request Dec 14, 2021
As in getsentry/relay#1147, prefix all metric names with either
"sentry.sessions" or "sentry.transactions".
jjbayer added a commit that referenced this pull request Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants