Skip to content

trace: add OpenTelemetry backend, deprecate OpenTracing#19619

Merged
timvaillancourt merged 17 commits into
vitessio:mainfrom
timvaillancourt:otel-tracing
Mar 31, 2026
Merged

trace: add OpenTelemetry backend, deprecate OpenTracing#19619
timvaillancourt merged 17 commits into
vitessio:mainfrom
timvaillancourt:otel-tracing

Conversation

@timvaillancourt

@timvaillancourt timvaillancourt commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Description

To address #17341 and #19621, this PR adds a new --tracer opentelemetry backend that exports traces via OTLP/gRPC. The existing opentracing-jaeger and opentracing-datadog backends are deprecated and will be removed in v25.

Basically, the world is consolidating on OpenTelemetry. This is great for Vitess, because we can eventually (v25+) run a single tracing implementation.

The motivation here is that jaeger-client-go has been archived for a while now and the Jaeger project recommends migrating to OpenTelemetry. Since our Datadog plugin uses the OpenTracing bridge in dd-trace-go, it makes sense to deprecate both at once

Both old backends continue to work in v24, they just log a deprecation warning at startup. This gives users a release cycle to migrate

What changed

  • New otel.go implements the tracingService interface using the OTel SDK
  • New plugin_otel.go registers the "opentelemetry" factory with an OTLP/gRPC exporter
  • Custom gRPC interceptors for trace context propagation (the otelgrpc library removed its interceptor API in v0.63.0, so we write thin wrappers that fit the existing tracingService interface)
  • The shared --tracing-sampling-rate flag moved from plugin_jaeger.go to trace.go so all backends can reference it without duplicate flag registration
  • plugin_jaeger.go and plugin_datadog.go log a deprecation warning
  • Changelog entry for v24 covering the new backend, deprecation, and migration path

New flags

  • --otel-endpoint (default localhost:4317) - collector endpoint (gRPC)
  • --otel-insecure (default false) - use insecure connection to collector

v25 cleanup

After the deprecation period we can delete opentracing.go, plugin_jaeger.go, plugin_datadog.go, logger.go and drop opentracing-go, opentracing-contrib/go-grpc, uber/jaeger-client-go, and dd-trace-go.v1 from go.mod. vtadmin/grpcserver/server.go also has direct OpenTracing usage that will need migrating

Related Issue(s)

Resolves: #17341 and #19621

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

No impact for existing deployments. The new opentelemetry backend is opt-in. Existing opentracing-jaeger and opentracing-datadog users will see a deprecation warning in their logs but nothing else changes

AI Disclosure

Written primarily by Claude Code - I provided direction on the design (coexistence vs replacement, flag naming, deprecation strategy)

@github-actions github-actions Bot added this to the v24.0.0 milestone Mar 11, 2026
@vitess-bot vitess-bot Bot added NeedsWebsiteDocsUpdate What it says NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Mar 11, 2026
@vitess-bot

vitess-bot Bot commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@github-actions github-actions Bot added Component: Documentation docs related issues/PRs Type: Dependencies Dependency updates labels Mar 11, 2026
@timvaillancourt timvaillancourt added Component: Observability Pull requests that touch tracing/metrics/monitoring Component: General Changes throughout the code base and removed Component: Documentation docs related issues/PRs NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Mar 11, 2026
@timvaillancourt timvaillancourt self-assigned this Mar 11, 2026
@codecov

codecov Bot commented Mar 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 27.02703% with 162 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.68%. Comparing base (70c7a72) to head (be706b1).
⚠️ Report is 124 commits behind head on main.

Files with missing lines Patch % Lines
go/trace/otel.go 31.44% 109 Missing ⚠️
go/trace/plugin_otel.go 12.06% 51 Missing ⚠️
go/trace/trace.go 0.00% 2 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (70c7a72) and HEAD (be706b1). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (70c7a72) HEAD (be706b1)
1 0
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #19619       +/-   ##
===========================================
- Coverage   69.67%   43.68%   -25.99%     
===========================================
  Files        1614        9     -1605     
  Lines      216793      396   -216397     
===========================================
- Hits       151044      173   -150871     
+ Misses      65749      223    -65526     
Flag Coverage Δ
partial 43.68% <27.02%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@timvaillancourt timvaillancourt removed NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Mar 11, 2026
@timvaillancourt timvaillancourt marked this pull request as ready for review March 11, 2026 12:51
@promptless

promptless Bot commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

📝 Documentation updates detected!

New suggestion: Document OpenTelemetry tracing backend and deprecate OpenTracing


Tip: Tag @Promptless in GitHub PR comments to guide documentation changes during code review 🐙

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds an OpenTelemetry tracing backend to go/trace (OTLP/gRPC exporter) and begins deprecating the existing OpenTracing-based backends, aligning Vitess tracing with current ecosystem standards.

Changes:

  • Introduces a new --tracer opentelemetry backend using the OTel SDK + OTLP/gRPC exporter and custom gRPC interceptors for context propagation.
  • Moves --tracing-sampling-rate registration to trace.go so all tracing backends share it, and adds OTel-specific flags (--otel-endpoint, --otel-insecure).
  • Deprecates opentracing-jaeger and opentracing-datadog with startup warnings and documents the migration path in the v24 changelog.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
go/trace/trace.go Centralizes shared tracing flags (incl. sampling rate) for all backends.
go/trace/plugin_otel.go Registers the new opentelemetry backend and exposes OTel exporter flags.
go/trace/otel.go Implements tracingService for OTel and provides custom gRPC interceptors + context parsing helpers.
go/trace/otel_test.go Adds unit tests for OTel carrier decoding, span plumbing, and attribute conversion.
go/trace/plugin_jaeger.go Removes duplicate sampling-rate flag registration and adds deprecation warning/docs for Jaeger backend.
go/trace/plugin_datadog.go Adds deprecation warning/docs for Datadog OpenTracing backend.
go/flags/endtoend/vttablet.txt Updates generated flag output to include OTel flags and updated sampling-rate help.
go/flags/endtoend/vtgate.txt Updates generated flag output to include OTel flags and updated sampling-rate help.
go/flags/endtoend/vtctld.txt Updates generated flag output to include OTel flags and updated sampling-rate help.
go/flags/endtoend/vtctlclient.txt Updates generated flag output to include OTel flags and updated sampling-rate help.
go/flags/endtoend/vtcombo.txt Updates generated flag output to include OTel flags and updated sampling-rate help.
go/flags/endtoend/vtclient.txt Updates generated flag output to include OTel flags and updated sampling-rate help.
go.mod Adds OTLP trace exporter deps and bumps some related indirect deps.
go.sum Records new module checksums for updated/added deps.
changelog/24.0/24.0.0/summary.md Documents the new OTel backend, deprecations, and migration steps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go/trace/otel.go Outdated
Comment thread go/trace/otel.go Outdated
Comment thread go/trace/trace.go
Comment thread go/trace/trace.go Outdated
@timvaillancourt timvaillancourt requested a review from Copilot March 11, 2026 16:57
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated no new comments.

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Copilot AI review requested due to automatic review settings March 27, 2026 18:17
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 6 comments.

Comment thread go/flags/endtoend/vtclient.txt
Comment thread go/flags/endtoend/vttablet.txt
Comment thread go/flags/endtoend/vtgate.txt
Comment thread go/flags/endtoend/vtctld.txt
Comment thread go/flags/endtoend/vtctlclient.txt
Comment thread go/flags/endtoend/vtcombo.txt

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated no new comments.

@timvaillancourt

Copy link
Copy Markdown
Contributor Author

@mattlord ready for a re-review now. Thanks!

@mattlord mattlord left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Nice work on this, @timvaillancourt ! ❤️

@nickvanw nickvanw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Leaving one correctness follow-up.

I verified this locally and left the details inline on the NewFromString path.

Comment thread go/trace/otel.go
Comment thread go/trace/plugin_otel.go
…n fix

- Add resource.WithFromEnv() to pick up OTEL_RESOURCE_ATTRIBUTES env var
- Fix NewFromString to extract into a clean context so a pre-existing
  span cannot mask an invalid carrier payload
- Add regression test for the extraction bug

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
@timvaillancourt timvaillancourt enabled auto-merge (squash) March 31, 2026 09:58
@timvaillancourt timvaillancourt merged commit c9dd230 into vitessio:main Mar 31, 2026
117 of 120 checks passed
@timvaillancourt timvaillancourt deleted the otel-tracing branch March 31, 2026 11:32
mhamza15 pushed a commit to planetscale/vitess that referenced this pull request Apr 9, 2026
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
timvaillancourt added a commit to timvaillancourt/vitess that referenced this pull request Apr 17, 2026
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
timvaillancourt added a commit to timvaillancourt/vitess that referenced this pull request May 12, 2026
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: General Changes throughout the code base Component: Observability Pull requests that touch tracing/metrics/monitoring Type: Dependencies Dependency updates Type: Enhancement Logical improvement (somewhere between a bug and feature)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Migrate from OpenTrace to OpenTelemetry as standard

5 participants