1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-16 10:19:23 +02:00
opentelemetry-go/experimental/bridge/opentracing/util.go
Krzesimir Nowak 339ca2d974 Initial opentracing bridge (#98)
* Allow specifying custom timestamps for events

Adding event with timestamp is not yet a part of the OpenTelemetry
specification, but this function will come in handy when implementing
the OpenTracing bridge.

* Add opentracing bridge, wrapper tracer and migration interfaces

There are some features missing - setting up links and span kind;
context propagation will only work between two OpenTracing bridges.

* Add some tests for the opentracing bridge

The tests mostly check various aspects of the cooperation between
OpenTracing and OpenTelemetry APIs.
2019-09-24 23:12:22 -07:00

30 lines
1.1 KiB
Go

// Copyright 2019, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package opentracing
import (
oteltrace "go.opentelemetry.io/api/trace"
)
// NewTracerPair is a utility function that creates a BridgeTracer
// that forwards the calls to the WrapperTracer that wraps the passed
// tracer.
func NewTracerPair(tracer oteltrace.Tracer) (*BridgeTracer, *WrapperTracer) {
bridgeTracer := NewBridgeTracer()
wrapperTracer := NewWrapperTracer(bridgeTracer, tracer)
bridgeTracer.SetOpenTelemetryTracer(wrapperTracer)
return bridgeTracer, wrapperTracer
}