You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-23 22:34:47 +02:00
Move SpanContext from core package into trace
This commit is contained in:
@@ -54,7 +54,7 @@ func Inject(ctx context.Context, metadata *metadata.MD) {
|
||||
// Extract returns the correlation context and span context that
|
||||
// another service encoded in the gRPC metadata object with Inject.
|
||||
// This function is meant to be used on incoming requests.
|
||||
func Extract(ctx context.Context, metadata *metadata.MD) ([]core.KeyValue, core.SpanContext) {
|
||||
func Extract(ctx context.Context, metadata *metadata.MD) ([]core.KeyValue, trace.SpanContext) {
|
||||
ctx = propagation.ExtractHTTP(ctx, global.Propagators(), &metadataSupplier{
|
||||
metadata: metadata,
|
||||
})
|
||||
|
||||
@@ -32,7 +32,7 @@ var (
|
||||
)
|
||||
|
||||
// Returns the Attributes, Context Entries, and SpanContext that were encoded by Inject.
|
||||
func Extract(ctx context.Context, req *http.Request) ([]core.KeyValue, []core.KeyValue, core.SpanContext) {
|
||||
func Extract(ctx context.Context, req *http.Request) ([]core.KeyValue, []core.KeyValue, trace.SpanContext) {
|
||||
ctx = propagation.ExtractHTTP(ctx, global.Propagators(), req.Header)
|
||||
|
||||
attrs := []core.KeyValue{
|
||||
|
||||
@@ -22,7 +22,6 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"go.opentelemetry.io/otel/api/core"
|
||||
"go.opentelemetry.io/otel/api/global"
|
||||
"go.opentelemetry.io/otel/api/propagation"
|
||||
"go.opentelemetry.io/otel/api/trace"
|
||||
@@ -37,7 +36,7 @@ func TestTransportBasics(t *testing.T) {
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := propagation.ExtractHTTP(r.Context(), global.Propagators(), r.Header)
|
||||
span := trace.RemoteSpanContextFromContext(ctx)
|
||||
tgtID, err := core.SpanIDFromHex(fmt.Sprintf("%016x", id))
|
||||
tgtID, err := trace.SpanIDFromHex(fmt.Sprintf("%016x", id))
|
||||
if err != nil {
|
||||
t.Fatalf("Error converting id to SpanID: %s", err.Error())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user