Skip to content

amammay/propagationgcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

$ go get -u github.com/amammay/propagationgcp

Usage

package main

import (
	"context"
	"github.com/amammay/propagationgcp"
	"go.opentelemetry.io/otel"
	"go.opentelemetry.io/otel/propagation"
)

func initTracing() {
	propagator := propagation.NewCompositeTextMapPropagator(
		propagation.TraceContext{},
		propagation.Baggage{},
		propagationgcp.HTTPFormat{},
	)
	otel.SetTextMapPropagator(propagator)
}

func someMethod(ctx context.Context) {
	sc := trace.SpanContextFromContext(ctx)
	traceID := sc.TraceID().String()
	spanID := sc.SpanID().String()
	isSampled := sc.IsSampled()
	_ = traceID
	_ = spanID
	_ = isSampled
}

About

propagationgcp is a small package for setting up propagation in open telemetry using gcp/s X-Cloud-Trace-Context

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages