You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-29 23:07:45 +02:00
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.
This commit is contained in:
@@ -68,6 +68,9 @@ type Span interface {
|
||||
|
||||
// AddEvent adds an event to the span.
|
||||
AddEvent(ctx context.Context, msg string, attrs ...core.KeyValue)
|
||||
// AddEventWithTimestamp adds an event with a custom timestamp
|
||||
// to the span.
|
||||
AddEventWithTimestamp(ctx context.Context, timestamp time.Time, msg string, attrs ...core.KeyValue)
|
||||
|
||||
// IsRecordingEvents returns true if the span is active and recording events is enabled.
|
||||
IsRecordingEvents() bool
|
||||
|
||||
@@ -3,6 +3,7 @@ package trace_test
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
|
||||
@@ -108,6 +109,10 @@ func (mockSpan) Tracer() trace.Tracer {
|
||||
func (mockSpan) AddEvent(ctx context.Context, msg string, attrs ...core.KeyValue) {
|
||||
}
|
||||
|
||||
// AddEventWithTimestamp does nothing.
|
||||
func (mockSpan) AddEventWithTimestamp(ctx context.Context, timestamp time.Time, msg string, attrs ...core.KeyValue) {
|
||||
}
|
||||
|
||||
// AddLink does nothing.
|
||||
func (mockSpan) AddLink(link trace.Link) {
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ package trace
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
|
||||
@@ -75,6 +76,10 @@ func (NoopSpan) Tracer() Tracer {
|
||||
func (NoopSpan) AddEvent(ctx context.Context, msg string, attrs ...core.KeyValue) {
|
||||
}
|
||||
|
||||
// AddEventWithTimestamp does nothing.
|
||||
func (NoopSpan) AddEventWithTimestamp(ctx context.Context, timestamp time.Time, msg string, attrs ...core.KeyValue) {
|
||||
}
|
||||
|
||||
// SetName does nothing.
|
||||
func (NoopSpan) SetName(name string) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user