Skip to content

Add sourcemap upload failure metrics#392

Open
watson wants to merge 2 commits into
masterfrom
watson/DEBUG-5301/add-upload-metrics
Open

Add sourcemap upload failure metrics#392
watson wants to merge 2 commits into
masterfrom
watson/DEBUG-5301/add-upload-metrics

Conversation

@watson
Copy link
Copy Markdown
Contributor

@watson watson commented Jun 2, 2026

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 metrics plugin 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.retry
  • sourcemaps.upload.failure

Tags include bundler, plugin version, service, site, status code, error type, and CI job context when available.

Testing

  • yarn workspace @dd/metrics-plugin typecheck
  • yarn workspace @dd/error-tracking-plugin typecheck
  • yarn 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

@watson watson requested a review from yoannmoinet as a code owner June 2, 2026 04:44
Copy link
Copy Markdown
Contributor Author

watson commented Jun 2, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@watson watson force-pushed the watson/DEBUG-5301/add-upload-metrics branch from e8766cd to 4376beb Compare June 2, 2026 04:51
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.
@watson watson force-pushed the watson/DEBUG-5301/add-upload-metrics branch from 4376beb to 6a47213 Compare June 2, 2026 04:56
@watson watson requested a review from a team June 2, 2026 08:49
@watson watson requested a review from a team as a code owner June 3, 2026 12:08
@datadog-prod-us1-5
Copy link
Copy Markdown

datadog-prod-us1-5 Bot commented Jun 3, 2026

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 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.
@watson watson force-pushed the watson/DEBUG-5301/add-upload-metrics branch from 2b943c4 to d1d3c15 Compare June 3, 2026 12:27
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.

1 participant