feat: add OtlpHttpPath config support for ZincObserve Telemetry (#3271)

Signed-off-by: Toby Yan <me@tobyan.com>
Co-authored-by: cong <zhangcong1992@gmail.com>
This commit is contained in:
Toby
2023-05-23 11:11:58 +08:00
committed by GitHub
parent fa1d6d50a8
commit 278ae3d26a
3 changed files with 8 additions and 0 deletions

View File

@@ -91,6 +91,9 @@ func createExporter(c Config) (sdktrace.SpanExporter, error) {
if len(c.OtlpHeaders) > 0 {
opts = append(opts, otlptracehttp.WithHeaders(c.OtlpHeaders))
}
if len(c.OtlpHttpPath) > 0 {
opts = append(opts, otlptracehttp.WithURLPath(c.OtlpHttpPath))
}
return otlptracehttp.New(
context.Background(),
opts...,

View File

@@ -50,6 +50,7 @@ func TestStartAgent(t *testing.T) {
OtlpHeaders: map[string]string{
"uptrace-dsn": "http://project2_secret_token@localhost:14318/2",
},
OtlpHttpPath: "/v1/traces",
}
c7 := Config{
Name: "UDP",

View File

@@ -13,4 +13,8 @@ type Config struct {
// For example:
// uptrace-dsn: 'http://project2_secret_token@localhost:14317/2'
OtlpHeaders map[string]string `json:",optional"`
// OtlpHttpPath represents the path for OTLP HTTP transport.
// For example
// /v1/traces
OtlpHttpPath string `json:",optional"`
}