You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-03 18:35:08 +02:00
850de675f4
This PR contains the following updates: | Package | Change | Age | Confidence | |---|---|---|---| | [google.golang.org/grpc](https://redirect.github.com/grpc/grpc-go) | `v1.73.0` -> `v1.74.2` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>grpc/grpc-go (google.golang.org/grpc)</summary> ### [`v1.74.2`](https://redirect.github.com/grpc/grpc-go/releases/tag/v1.74.2): Release 1.74.2 [Compare Source](https://redirect.github.com/grpc/grpc-go/compare/v1.74.1...v1.74.2) ### API Changes - balancer: add `ExitIdle` method to `Balancer` interface. Earlier, implementing this method was optional. ([#​8367](https://redirect.github.com/grpc/grpc-go/issues/8367)) ### Behavior Changes - xds: Remove the `GRPC_EXPERIMENTAL_ENABLE_LEAST_REQUEST` environment variable that allows disabling the least request balancer with xDS. Least request was made available by default with xDS in v1.72.0. ([#​8248](https://redirect.github.com/grpc/grpc-go/issues/8248)) - Special Thanks: [@​atollena](https://redirect.github.com/atollena) - server: allow 0s grpc-timeout header values, which older gRPC-Java versions could send. This restores the behavior of grpc-go before v1.73.0. ([#​8439](https://redirect.github.com/grpc/grpc-go/issues/8439)) ### Bug Fixes - googledirectpath: avoid logging the error message `Attempt to set a bootstrap configuration...` when creating multiple directpath channels. ([#​8419](https://redirect.github.com/grpc/grpc-go/issues/8419)) ### Performance Improvements - transport: reduce heap allocations by pooling objects and avoiding method-to-closure conversions. ([#​8361](https://redirect.github.com/grpc/grpc-go/issues/8361)) - transport: reduce heap allocations by re-using `mem.Reader` objects. ([#​8360](https://redirect.github.com/grpc/grpc-go/issues/8360)) ### Documentation - examples: add examples to demonstrate enabling experimental metrics using the OpenTelemetry plugin. ([#​8388](https://redirect.github.com/grpc/grpc-go/issues/8388)) - Special Thanks: [@​vinothkumarr227](https://redirect.github.com/vinothkumarr227) ### [`v1.74.1`](https://redirect.github.com/grpc/grpc-go/releases/tag/v1.74.1): Release 1.74.1 [Compare Source](https://redirect.github.com/grpc/grpc-go/compare/v1.74.0...v1.74.1) Version 1.74.1 retracts release v1.74.0 and itself. Release 1.74.0 was accidentally tagged on the wrong commit and should not be used. Version 1.73.0 should be used until 1.74.2 is released. ### [`v1.74.0`](https://redirect.github.com/grpc/grpc-go/releases/tag/v1.74.0): Release 1.74.0 [Compare Source](https://redirect.github.com/grpc/grpc-go/compare/v1.73.0...v1.74.0) Release 1.74.0 was accidentally tagged on the wrong commit and should not be used. Version 1.73.0 should be used until 1.74.1 is released. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/open-telemetry/opentelemetry-go). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS40MC4wIiwidXBkYXRlZEluVmVyIjoiNDEuNDAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiU2tpcCBDaGFuZ2Vsb2ciLCJkZXBlbmRlbmNpZXMiXX0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
OpenTelemetry/OpenTracing Bridge
Getting started
go get go.opentelemetry.io/otel/bridge/opentracing
Assuming you have configured an OpenTelemetry TracerProvider, these will be the steps to follow to wire up the bridge:
import (
"go.opentelemetry.io/otel"
otelBridge "go.opentelemetry.io/otel/bridge/opentracing"
)
func main() {
/* Create tracerProvider and configure OpenTelemetry ... */
otelTracer := tracerProvider.Tracer("tracer_name")
// Use the bridgeTracer as your OpenTracing tracer.
bridgeTracer, wrapperTracerProvider := otelBridge.NewTracerPair(otelTracer)
// Set the wrapperTracerProvider as the global OpenTelemetry
// TracerProvider so instrumentation will use it by default.
otel.SetTracerProvider(wrapperTracerProvider)
/* ... */
}
Interop from trace context from OpenTracing to OpenTelemetry
In order to get OpenTracing spans properly into the OpenTelemetry context, so they can be propagated (both internally, and externally), you will need to explicitly use the BridgeTracer for creating your OpenTracing spans, rather than a bare OpenTracing Tracer instance.
When you have started an OpenTracing Span, make sure the OpenTelemetry knows about it like this:
ctxWithOTSpan := opentracing.ContextWithSpan(ctx, otSpan)
ctxWithOTAndOTelSpan := bridgeTracer.ContextWithSpanHook(ctxWithOTSpan, otSpan)
// Propagate the otSpan to both OpenTracing and OpenTelemetry
// instrumentation by using the ctxWithOTAndOTelSpan context.
Extended Functionality
The bridge functionality can be extended beyond the OpenTracing API.
Any trace.SpanContext method can be accessed as following:
type spanContextProvider interface {
IsSampled() bool
TraceID() trace.TraceID
SpanID() trace.SpanID
TraceFlags() trace.TraceFlags
... // any other available method can be added here to access it
}
var sc opentracing.SpanContext = ...
if s, ok := sc.(spanContextProvider); ok {
// Use TraceID by s.TraceID()
// Use SpanID by s.SpanID()
// Use TraceFlags by s.TraceFlags()
...
}