Skip to content

Conversation

phacops
Copy link
Contributor

@phacops phacops commented Jul 11, 2025

We migrated all parts of the frontend using span metrics to querying the EAP. We do not need to collect them anymore.

@phacops phacops requested a review from a team as a code owner July 11, 2025 03:03
Copy link
Member

@Dav1dde Dav1dde left a comment

Choose a reason for hiding this comment

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

As mentioned in a comment, the count_per_root is still used, also the usage metric might still be used in a billing consumer.

@phacops phacops force-pushed the pierre/disable-span-metrics branch from 91bd476 to e431ebc Compare July 11, 2025 17:00
@phacops phacops requested a review from Dav1dde July 11, 2025 17:19
@@ -835,8 +832,6 @@ def assert_transaction():
"received_at": time_after(timestamp),
}

assert metrics["c:spans/usage@none"]["value"] == 2
Copy link
Contributor Author

@phacops phacops Jul 11, 2025

Choose a reason for hiding this comment

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

@Dav1dde Should we still count the metric is the span extraction is not activated? I don't think so.

Copy link
Member

Choose a reason for hiding this comment

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

Is there a case where we don't have span extraction?
In any case, if we still have transaction only flows, these metrics should be fine to not emit.

So this is now gone, because it was tied to the span metric extraction feature flag, which no longer is set. Which brings the question, is there any transaction only product surface (AM1/AM2?) which requires span metrics to work (as they won't have span extraction)?

Copy link
Member

Choose a reason for hiding this comment

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

Okay so talking with Jan, I think we will always have to extract count_per_root and usage metrics, unconditionally, if we don't want to hide it behind another feature flag (which I don't think we should, let's just always extract them), as we don't know if they are later required for the product (dynamic sampling/outcomes) or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We still need to gate them behind ExtractSpansFromEvent otherwise we'd also extract this for AM1 organizations (which we don't want), but we shouldn't gate this behind any span metrics extraction flag since we'll want to extract them regardless.

outcomes = outcomes_consumer.get_outcomes(timeout=10, n=7)
assert summarize_outcomes(outcomes) == {
(16, 0): 6, # SpanIndexed, Accepted
(15, 1): 2, # Metric, Filtered
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Dav1dde Can't quite say if this is right.

We likely started to emit metrics for usage and count_per_root all the time, which might itself be a bug, and they get filtered? What's the correct behavior here?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah then we should fix that, either not emit the metrics when they shouldn't be emitted or if they should be emitted make sure they aren't dropped/filtered.

I don't know if we need the span based metrics in circumstances where there is no span extraction, will need to find that out, but I don't think so 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't really get this failure. We get disabled-namespace outcomes for project 43 but I enable span ingestion for that project, no outcome gets emitted.

I'm not sure I understand what the failure is here, can you take a look please?

Copy link
Member

Choose a reason for hiding this comment

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

That makes sense, because the Spans metrics namespace is gated behind the span ingestion feature flag here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right but, why do we have a disabled-namespace outcome if it's disabled and not having ANY outcomes when it's enabled. Not having any outcomes when it's enabled suggests it doesn't try to emit a metric, but somehow, when it's disabled, it tries to emit metrics?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since project 43 is the root and has dynamic sampling removing things, the organizations:standalone-span-ingestion should be enabled on both projects as they are part of the same organization. Then the test is well set up and passes (as it should).

@@ -835,8 +832,6 @@ def assert_transaction():
"received_at": time_after(timestamp),
}

assert metrics["c:spans/usage@none"]["value"] == 2
Copy link
Member

Choose a reason for hiding this comment

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

Is there a case where we don't have span extraction?
In any case, if we still have transaction only flows, these metrics should be fine to not emit.

So this is now gone, because it was tied to the span metric extraction feature flag, which no longer is set. Which brings the question, is there any transaction only product surface (AM1/AM2?) which requires span metrics to work (as they won't have span extraction)?

outcomes = outcomes_consumer.get_outcomes(timeout=10, n=7)
assert summarize_outcomes(outcomes) == {
(16, 0): 6, # SpanIndexed, Accepted
(15, 1): 2, # Metric, Filtered
Copy link
Member

Choose a reason for hiding this comment

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

Yeah then we should fix that, either not emit the metrics when they shouldn't be emitted or if they should be emitted make sure they aren't dropped/filtered.

I don't know if we need the span based metrics in circumstances where there is no span extraction, will need to find that out, but I don't think so 🤔

@@ -835,8 +832,6 @@ def assert_transaction():
"received_at": time_after(timestamp),
}

assert metrics["c:spans/usage@none"]["value"] == 2
Copy link
Member

Choose a reason for hiding this comment

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

Okay so talking with Jan, I think we will always have to extract count_per_root and usage metrics, unconditionally, if we don't want to hide it behind another feature flag (which I don't think we should, let's just always extract them), as we don't know if they are later required for the product (dynamic sampling/outcomes) or not.

@phacops phacops requested a review from Dav1dde July 16, 2025 01:24
@Dav1dde Dav1dde changed the title chore(metrics): Disable span metrics ref(metrics): Disable span metrics Jul 17, 2025
@Dav1dde
Copy link
Member

Dav1dde commented Jul 17, 2025

@sentry review

Copy link
Member

@Dav1dde Dav1dde left a comment

Choose a reason for hiding this comment

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

Looks good, gets rid of a bunch of old stuff, usage metric and count per root metrics aren't changed which are the important bits.

/// Enables metric extraction from spans for addon modules.
///
/// Serialized as `projects:span-metrics-extraction-addons`.
/// This feature has graduated and is hard-coded for external Relays.
Copy link
Member

Choose a reason for hiding this comment

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

Graduated features are hardcoded at the top of the file in the GRADUATED_FEATURE_FLAGS slice, but I don't think we can graduate it, as that would unconditionally enable it.

Should call out that this is deprecated and just kept around for external Relays, we can also maybe just graduate them if the span extraction one is enabled, then we can remove them from Sentry.

@phacops phacops added this pull request to the merge queue Jul 17, 2025
Merged via the queue into master with commit 0bec9cc Jul 17, 2025
28 checks passed
@phacops phacops deleted the pierre/disable-span-metrics branch July 17, 2025 17:32
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