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(server): Track a spans/count_per_root_project metric #4134

Merged
merged 8 commits into from
Oct 23, 2024

Conversation

jan-auer
Copy link
Member

@jan-auer jan-auer commented Oct 10, 2024

Adds a new metric c:spans/count_per_root_project@none that tracks the
number of spans per root project with a transaction and decision
tag. This will be used by span-based dynamic sampling for rebalancing.

The new metric is tracked in the two places where span metrics are
emitted, under the condition that span metric extraction features are
enabled:

  1. Event metric extraction
  2. Span processing

Requires getsentry/sentry#78992
Closes https://github.com/getsentry/projects/issues/198

@jan-auer jan-auer self-assigned this Oct 10, 2024
* master:
  ref(server): Move project source into the source module (#4154)
  instr(buffer): Measure envelope size (#4153)
  ref(redis): Cleanup code around Redis (#4151)
  lint: Rust 1.82 (#4150)
  chore(server): Remove native placeholders from transaction processing (#4148)
  feat(eap): Extract user IP (#4144)
  Revert "ref(buffer): remove peek" (#4146)
  ref(buffer): remove peek (#4136)
  release: 24.10.0
  build(deps): bump tonic from 0.12.2 to 0.12.3 (#4143)
  instr(projects): Log fetch failure (#4142)
  ref(otel): Disable default features for otel schema (#4141)
  ref(server): Organize project services in nested modules (#4139)
  ref(redis): Update to redis client version 0.27.4 (#4132)
  feat(redis): Implement parallel cmd execution of Redis calls (#4118)
  feat(spooler): Add metric to track serialization performance (#4135)
@jan-auer jan-auer marked this pull request as ready for review October 21, 2024 17:37
@jan-auer jan-auer requested a review from a team as a code owner October 21, 2024 17:37
Copy link
Member

@iambriccardo iambriccardo left a comment

Choose a reason for hiding this comment

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

LGTM, left one minor nit

relay-server/src/services/processor.rs Show resolved Hide resolved
Comment on lines -52 to +58
spans_extracted: bool,
config: CombinedMetricExtractionConfig<'_>,
sampling_decision: SamplingDecision,
max_tag_value_size: usize,
span_extraction_sample_rate: Option<f32>,
) -> Vec<Bucket> {
let mut metrics = generic::extract_metrics(event, config);
// If spans were already extracted for an event, we rely on span processing to extract metrics.
if !spans_extracted && sample(span_extraction_sample_rate.unwrap_or(1.0)) {
extract_span_metrics_for_event(event, config, max_tag_value_size, &mut metrics);
extract_spans: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

Here, extract_spans replaces the combination of spans_extracted and span_extraction_sample_rate, and sampling_decision is only used for tagging purposes further in, correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct, the caller determines whether spans should be extracted, which comprises three conditions: The sample rate, whether spans were extracted before, and whether span extraction is enabled at all. That last condition is new and required because we want to skip the root counter metric.

sampling_decision is there purely for tagging the root counter metric, right.

Comment on lines +222 to +225
relay_log::trace!(
span_count,
?sampling_result,
"Dropped spans because of sampling rule",
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this log was moved here so there is only one log entry instead of one per span?

@jan-auer jan-auer merged commit 05e9c2b into master Oct 23, 2024
23 checks passed
@jan-auer jan-auer deleted the feat/sampling-root-counter branch October 23, 2024 12:58
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