Skip to content

Conversation

@untitaker
Copy link
Member

Counterpart to getsentry/sentry#30189

@untitaker untitaker requested a review from a team November 26, 2021 17:48
jjbayer added a commit to getsentry/sentry that referenced this pull request Nov 29, 2021
Rename metrics extracted from measurements (e.g. measurements.lcp) to
plural in order to to be consistent with the rest of the product. This
PR only fixes the mock data source of the Metrics API, the actual
extraction is fixed as part of getsentry/relay#1141.
}
let config = match state.project_state.config.transaction_metrics {
Some(ErrorBoundary::Ok(ref config)) => config,
None | Some(ErrorBoundary::Err(_)) => return Ok(()),
Copy link
Member

Choose a reason for hiding this comment

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

nit: Is this equivalent to _ => return Ok(())?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, i have the tendency to avoid _ but it's not healthy in this case

}

let mut push_metric = move |metric: Metric| {
if config.extract_metrics.contains(&metric.name) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: If the config check is the last thing we do for every metric, I would refactor to something like

extract_transaction_metrics(&event, &mut target); // no config!
target.retain(|x| config.extract_metrics.contains(x));

Although that opens the question how to handle tags. So probably this is fine the way it is.

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 want to early-return if there's no metrics to extract too, i think if i have the config handling in this function i can also unit-test it better

Copy link
Member

@jjbayer jjbayer left a comment

Choose a reason for hiding this comment

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

There's an import error, and I assume the project config is missing from the relevant integration tests, but conceptually this looks good!

@untitaker untitaker merged commit 5b7b2ce into master Dec 1, 2021
@untitaker untitaker deleted the ref/metrics-extraction-config branch December 1, 2021 12:15
jan-auer added a commit that referenced this pull request Dec 1, 2021
* master:
  feat(metrics): Metrics extraction config, custom tags (#1141)
  Rename onpremise to self-hosted (#1136)
jjbayer added a commit that referenced this pull request Dec 6, 2021
As in #1141, move session extraction to the metrics_extraction module.
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.

3 participants