Skip to content

WIP: Start drafting an otel opentracing plugin. #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: release-19.0-github
Choose a base branch
from

Conversation

arthurschreiber
Copy link
Member

Description

Related Issue(s)

Checklist

  • "Backport to:" labels have been added if this change should be back-ported
  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

@Copilot Copilot AI review requested due to automatic review settings May 21, 2025 07:27
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds an OpenTelemetry-based OpenTracing bridge plugin for Vitess tracing and updates module dependencies accordingly.

  • Implements a new newOtelTracer factory that wires OTLP exporter, tracer provider, and OpenTracing bridge
  • Registers the plugin under tracingBackendFactories["opentracing-otel"]
  • Bumps and adds required OpenTelemetry and related dependencies in go.mod

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
go/trace/plugin_otel.go Introduces OTEL tracer provider, OTLP exporter, and OpenTracing bridge with cleanup logic
go.mod Upgrades existing dependencies and adds OpenTelemetry modules
Comments suppressed due to low confidence (2)

go/trace/plugin_otel.go:42

  • There are no tests covering the newOtelTracer initialization or its integration into the tracing registry. Consider adding unit tests to verify correct exporter setup, propagator configuration, and error paths.
func newOtelTracer(serviceName string) (tracingService, io.Closer, error) {

go/trace/plugin_otel.go:113

  • [nitpick] The field name bridgeTracer mirrors its type and may be redundant. Consider renaming to something more concise (e.g., tracerBridge or simply tracer) to improve readability.
bridgeTracer *otelBridge.BridgeTracer

otelTracer := otel.Tracer(serviceName)

// Create a Bridge tracer that supports both OpenTracing and OpenTelemetry
bridgeTracer, _ := otelBridge.NewTracerPair(otelTracer)
Copy link
Preview

Copilot AI May 21, 2025

Choose a reason for hiding this comment

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

The error from otelBridge.NewTracerPair is currently ignored. You should capture and handle this error to avoid silent failures during tracer initialization.

Suggested change
bridgeTracer, _ := otelBridge.NewTracerPair(otelTracer)
bridgeTracer, err := otelBridge.NewTracerPair(otelTracer)
if err != nil {
return nil, &nilCloser{}, err
}

Copilot uses AI. Check for mistakes.

Comment on lines +57 to +58
// TODO: Add support for specifying other protocols via a flag
client := otlptracehttp.NewClient()
Copy link
Preview

Copilot AI May 21, 2025

Choose a reason for hiding this comment

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

Leaving a TODO without a tracking issue or implementation plan may get lost. Either implement protocol selection via flags now or reference a GitHub issue to track this work.

Suggested change
// TODO: Add support for specifying other protocols via a flag
client := otlptracehttp.NewClient()
// Determine the protocol to use based on the flag
var client otlptrace.Client
switch protocol {
case "http":
client = otlptracehttp.NewClient()
case "grpc":
client = otlptracegrpc.NewClient()
default:
return nil, &nilCloser{}, fmt.Errorf("unsupported protocol: %s", protocol)
}

Copilot uses AI. Check for mistakes.

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