https://github.com/hermanbanken/otel-cloudtrace-renamer
https://github.com/hermanbanken/otel-cloudtrace-renamer
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hermanbanken/otel-cloudtrace-renamer
- Owner: hermanbanken
- Created: 2021-08-19T13:36:36.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-19T14:31:31.000Z (about 4 years ago)
- Last Synced: 2024-12-27T18:41:59.811Z (10 months ago)
- Language: Go
- Homepage:
- Size: 106 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# otel-cloudtrace-renamer
For some reason Google Cloud Trace does not yet support the Tracing Attributes as standardized in [semconv](https://pkg.go.dev/go.opentelemetry.io/otel/semconv).
The attributes shown in the Labels table at https://console.cloud.google.com/traces/list require a very specific format as documented in https://cloud.google.com/trace/docs/trace-labels. This utility wraps the trace exporter for Google Cloud Trace so that you can enjoy using any library and viewing their `semconv` standard attributes from the Google Cloud Trace UI.

# Usage
```golang
import (
texporter "github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace"
renamer "github.com/hermanbanken/otel-cloudtrace-renamer"
)
func main() {
// Setup tracing
var exporterTraces sdktrace.SpanExporter
if exporterTraces, err = texporter.New(); err != nil {
return errors.Wrap(err, "Failed to create google telemetry exporter")
}
exporterTraces = renamer.CloudTraceAttributeRenamer{exporterTraces}
tp := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(exporterTraces))
otel.SetTracerProvider(tp)
// [...]
}
```