Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amammay/propagationgcp
propagationgcp is a small package for setting up propagation in open telemetry using gcp/s X-Cloud-Trace-Context
https://github.com/amammay/propagationgcp
go golang grpc opentelemetry
Last synced: 29 days ago
JSON representation
propagationgcp is a small package for setting up propagation in open telemetry using gcp/s X-Cloud-Trace-Context
- Host: GitHub
- URL: https://github.com/amammay/propagationgcp
- Owner: amammay
- License: mit
- Created: 2021-06-13T00:54:31.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-06-19T13:34:39.000Z (over 3 years ago)
- Last Synced: 2024-08-03T23:29:45.122Z (4 months ago)
- Topics: go, golang, grpc, opentelemetry
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-golang-repositories - propagationgcp - Cloud-Trace-Context (Repositories)
README
## Installation
```
$ go get -u github.com/amammay/propagationgcp
```## Usage
```go
package mainimport (
"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
}```