Add sourcemap upload failure metrics#392
Open
watson wants to merge 2 commits into
Open
Conversation
e8766cd to
4376beb
Compare
Add metrics for Error Tracking sourcemap upload retries and final upload failures. These make intake instability observable without parsing CI logs. Emit the metrics only when the existing metrics plugin is enabled, preserving the default behavior for customers who use Error Tracking without build metrics. Batch metric emission after each upload phase and keep metric publishing non-fatal so sourcemap uploads are not affected by telemetry failures. Include tags for bundler, plugin version, service, site, status code, error type, and CI job context when available.
4376beb to
6a47213
Compare
🎉 All green!🧪 All tests passed 🔗 Commit SHA: d1d3c15 | Docs | Datadog PR Page | Give us feedback! |
Replace the sourcemap-specific metrics sender with a shared internal metrics collector exposed on the global context. This lets error-tracking add upload retry and failure metrics while the metrics plugin still owns filtering, prefixing, hooks, and sending. Flush any collected metrics at true end so late sourcemap uploads keep the old awaited send behavior.
2b943c4 to
d1d3c15
Compare
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.

What and why?
Add opt-in Datadog metrics for Error Tracking sourcemap upload retries and final upload failures. These metrics make transient sourcemap intake issues and exhausted retry failures observable without parsing CI logs.
The metrics are emitted only when the existing
metricsplugin is enabled, so customers using Error Tracking without build metrics keep the same default experience.How?
Sourcemap uploads record retry and failure counts in memory during each upload phase, then add those counts to a shared internal metrics collector on the global context.
The metrics plugin owns the actual metrics pipeline: it includes collected upload metrics in the existing
metrics: {}payload, applies the normal filtering, prefixing, tags, custom metrics hook, and Datadog send behavior, and awaits the send. It also flushes any metrics collected late at true end so fallback sourcemap uploads keep the same awaited behavior.Metrics added before the metrics plugin prefix is applied:
sourcemaps.upload.retrysourcemaps.upload.failureTags include bundler, plugin version, service, site, status code, error type, and CI job context when available.
Testing
yarn workspace @dd/metrics-plugin typecheckyarn workspace @dd/error-tracking-plugin typecheckyarn test:unit packages/plugins/error-tracking/src/sourcemaps/sender.test.ts packages/plugins/error-tracking/src/index.test.ts packages/plugins/metrics/src/index.test.ts