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:
@@ -91,6 +91,9 @@ func createExporter(c Config) (sdktrace.SpanExporter, error) {
|
|||||||
if len(c.OtlpHeaders) > 0 {
|
if len(c.OtlpHeaders) > 0 {
|
||||||
opts = append(opts, otlptracehttp.WithHeaders(c.OtlpHeaders))
|
opts = append(opts, otlptracehttp.WithHeaders(c.OtlpHeaders))
|
||||||
}
|
}
|
||||||
|
if len(c.OtlpHttpPath) > 0 {
|
||||||
|
opts = append(opts, otlptracehttp.WithURLPath(c.OtlpHttpPath))
|
||||||
|
}
|
||||||
return otlptracehttp.New(
|
return otlptracehttp.New(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
opts...,
|
opts...,
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ func TestStartAgent(t *testing.T) {
|
|||||||
OtlpHeaders: map[string]string{
|
OtlpHeaders: map[string]string{
|
||||||
"uptrace-dsn": "http://project2_secret_token@localhost:14318/2",
|
"uptrace-dsn": "http://project2_secret_token@localhost:14318/2",
|
||||||
},
|
},
|
||||||
|
OtlpHttpPath: "/v1/traces",
|
||||||
}
|
}
|
||||||
c7 := Config{
|
c7 := Config{
|
||||||
Name: "UDP",
|
Name: "UDP",
|
||||||
|
|||||||
@@ -13,4 +13,8 @@ type Config struct {
|
|||||||
// For example:
|
// For example:
|
||||||
// uptrace-dsn: 'http://project2_secret_token@localhost:14317/2'
|
// uptrace-dsn: 'http://project2_secret_token@localhost:14317/2'
|
||||||
OtlpHeaders map[string]string `json:",optional"`
|
OtlpHeaders map[string]string `json:",optional"`
|
||||||
|
// OtlpHttpPath represents the path for OTLP HTTP transport.
|
||||||
|
// For example
|
||||||
|
// /v1/traces
|
||||||
|
OtlpHttpPath string `json:",optional"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user