From 28251dad275ed5fe9d6b4c19fbd8dcf54ee17536 Mon Sep 17 00:00:00 2001 From: Sinh Date: Wed, 5 Feb 2025 09:39:11 +0700 Subject: [PATCH] feat(apm): support stream name arg --- .gitignore | 1 + apm.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 4aa1092..74eba2d 100644 --- a/.gitignore +++ b/.gitignore @@ -114,3 +114,4 @@ fabric.properties # Android studio 3.1+ serialized cache file .idea/caches/build_file_checksums.ser +.idea diff --git a/apm.go b/apm.go index b1fc7c7..f351d1d 100644 --- a/apm.go +++ b/apm.go @@ -32,6 +32,7 @@ type OtelConfig struct { ServiceName string ServiceVersion string Env string + StreamName string } func InitOtelAPM(config OtelConfig) error { @@ -46,6 +47,9 @@ func InitOtelAPM(config OtelConfig) error { if config.AuthHeader != "" { authHeaders["Authorization"] = config.AuthHeader } + if config.StreamName != "" { + authHeaders["stream-name"] = config.StreamName + } otlpHTTPExporter, err := otlptracehttp.New(context.Background(), otlptracehttp.WithEndpoint(config.Endpoint), otlptracehttp.WithURLPath(config.Path),