Repository navigation
chore: Remove leftover statsd Metrics protocol code - #5937
Merged
Merged
Conversation
The deprecated statsd Metrics API was removed in #3718 (5.0.0), which deleted MetricAggregator, the only caller of Hub.CaptureMetrics, Hub.CaptureCodeLocations and the span/transaction MetricsSummary aggregators. The protocol types, envelope factories, helpers and their tests stayed behind with no production callers.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5937 +/- ##
==========================================
+ Coverage 77.43% 77.66% +0.22%
==========================================
Files 546 534 -12
Lines 20053 19714 -339
Branches 3962 3932 -30
==========================================
- Hits 15529 15311 -218
+ Misses 3659 3547 -112
+ Partials 865 856 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
|
LGTM, I'll leave it for you to merge @jamescrosswell :) |
jamescrosswell
approved these changes
Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the internal leftovers of the old statsd-based Metrics API. Nothing in production calls any of it. The new trace-connected metrics (
SentryMetric,TraceMetric,trace_metricenvelope items) don't use any of this code and aren't touched.What's removed (all
internal)src/Sentry/Protocol/Metrics/(the whole folder):Metric,CounterMetric,GaugeMetric,DistributionMetric,SetMetric,CodeLocations,MetricResourceIdentifier,MetricType,MetricsSummary,SpanMetricsrc/Sentry/MetricHelper.csandsrc/Sentry/MetricsSummaryAggregator.csHub.CaptureMetricsandHub.CaptureCodeLocationsEnvelope.FromMetrics,Envelope.FromCodeLocations,EnvelopeItem.FromMetric(Metric),EnvelopeItem.FromCodeLocationsand themetric_metaitem type constantSpanTracerandTransactionTracer:MetricsSummaryandHasMetrics.SentrySpanandSentryTransaction: the_metricsSummaryfield and the_metrics_summaryserializationMetricTests,MetricsSummaryTests,MetricHelperTestsand their verified snapshotsWhen it was added: most of it came in #2949 (
Metrics Support - alpha), merged 2024-01-08. The span/transaction metrics summary (MetricsSummary,MetricsSummaryAggregator,SpanMetric) came in #3191 (Metrics improvements), merged 2024-03-06.When it became irrelevant, and why: #3718 (
Removed Metrics (deprecated)) was merged intoversion-5.0.0on 2024-10-30 and shipped in 5.0.0 on 2024-12-19. It deletedMetricAggregator.cs, which held the only calls to_metricHub.CaptureMetrics(...),_metricHub.CaptureCodeLocations(...)andtransactionTracer/spanTracer.MetricsSummary.Add(...). It also deletedIMetricHub, but it left theHubmethods, the protocol types and the summary aggregators in place. None of them have had a caller since then.Evidence it's unused (on
main@b9a48d2)modules/, nothing insrc/,test/,samples/,benchmarks/orintegration-test/referencesCaptureMetrics,CaptureCodeLocations,FromCodeLocations,Envelope.FromMetrics,CounterMetric,GaugeMetric,DistributionMetric,SetMetricorMetricResourceIdentifier, except the deleted files and their own tests.SpanTracer.MetricsSummaryandTransactionTracer.MetricsSummaryare only read insideif (tracer.HasMetrics), andHasMetricsisLazy.IsValueCreated. Nothing else touches the property, so the lazy value is never created and_metrics_summaryis never written.MetricHelperwas only used by the deleted protocol types and byMetricsSummaryAggregator.Why it's not breaking: every removed type and member is
internal, and the API approval snapshots don't change. Serialized output doesn't change either, because_metrics_summarycould never be written. No target frameworks or package dependencies change.Left in place on purpose:
EnvelopeItem.TypeValueMetric(statsd) and itsDataCategory.MetricBucketmapping. Rate-limit category handling and its tests still use them, so removing them is a separate decision.RandomValuesFactory.NextInt(int, int)loses its last caller (MetricHelper.FlushShift) but is part of a shared abstraction, so it's out of scope here.#skip-changelog
via automation
sched_2fb5d12bd3a78841d7d2559c56e8141d· Run IDsched_2fb5d12bd3a78841d7d2559c56e8141d:1794812400000.--
View Session [Sentry]