feat(telemetry): report Quartz and Azure Service Bus spans - #9183
feat(telemetry): report Quartz and Azure Service Bus spans#9183chojomok wants to merge 8 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f2c9a3465f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (9183) and master. ✅ No regressions detected |
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
BenchmarksBenchmark execution time: 2026-09-04 21:28:32 Comparing candidate commit 47f2406 in PR branch Found 0 performance improvements and 46 performance regressions! Performance is the same for 26 metrics, 0 unstable metrics, 111 known flaky benchmarks, 15 flaky benchmarks without significant changes.
|
| #pragma warning disable 618 // App analytics is deprecated, but still used | ||
| span.SetMetric(Trace.Tags.Analytics, Tracer.Instance.CurrentTraceSettings.Settings.GetIntegrationAnalyticsSampleRate(integrationId, enabledWithGlobalSetting: false)); | ||
| #pragma warning restore 618 |
There was a problem hiding this comment.
I wonder why we weren't doing this before for the otel integration ID? 🤔 Just an oversight I guess?
There was a problem hiding this comment.
honestly I don't know why this was added
span.SetMetric(Trace.Tags.Analytics, Tracer.Instance.CurrentTraceSettings.Settings.GetIntegrationAnalyticsSampleRate(integrationId, enabledWithGlobalSetting: false));
I'm going to remove this as we shouldn't be adding more things to support a deprecated feature.
| if (activity?.Instance is not null) | ||
| { | ||
| QuartzCommon.EnhanceActivityMetadata(activity); | ||
| Tracer.Instance.TracerManager.Telemetry.IntegrationGeneratedSpan(IntegrationId.Quartz); |
There was a problem hiding this comment.
Quartz v3 spans may be double-counted in spans_created
Quartz 3.x builds its Activity via the classic DiagnosticListener.StartActivity() API, not an ActivitySource. That means Activity.Source.Name is "" (confirmed with a quick standalone repro), so:
QuartzActivityHandler.ShouldListenTo(sourceName.StartsWith("Quartz")) never matches → the Activity falls through toDefaultActivityHandler, which claims it underIntegrationId.OpenTelemetryand callsIntegrationGeneratedSpan(OpenTelemetry).- The new call in
QuartzDiagnosticObserver.OnNext(line 54) then firesIntegrationGeneratedSpan(Quartz)for that same Activity, since it listens on the"Quartz.Job.Execute.Start"diagnostic event which fires after the Activity already started.
Both calls increment the real spans_created counter (RecordCountSpanCreated, not deduplicated). So one v3 span ends up counted twice — once as opentelemetry, once as quartz — which contradicts the PR description's claim that OpenTelemetry totals won't include Quartz spans anymore.
Worth confirming against the real Quartz v3 test, but the mechanism checks out.
Summary
Change it so Quartz and Azure Service Bus Activity spans have their own telemetry integrations, rather than reporting them under OpenTelemetry.
Purpose
This is expected to expose distinct
spans_createdtelemetry series for Quartz and Azure Service Bus while keeping the generic Activity handler attributed to OpenTelemetry.Changes Made
integration_name:quartztelemetry mapping.integration_name:azureservicebustelemetry mapping.DD_TRACE_QUARTZ_ENABLEDandDD_TRACE_AZURESERVICEBUS_ENABLEDin their respective Activity handlers. Setting either tofalsedisables that integration's specialized Activity handling; the generic Activity path continues to be controlled byDD_TRACE_OTEL_ENABLED.Impact & Blast Radius
How to Test & Measure
Automated Tests: Existing integration test now check for
await telemetry.AssertIntegrationEnabledAsync(IntegrationId.Quartz);andawait telemetry.AssertIntegrationEnabledAsync(IntegrationId.AzureServiceBus);instead ofawait telemetry.AssertIntegrationEnabledAsync(IntegrationId.OpenTelemetry);Expected Metrics Behavior:
dd.instrumentation_telemetry_data.tracers.spans_createdshould includeintegration_name:quartzandintegration_name:azureservicebus. This PR does not add a direct assertion for those metric tags.