feat: add secure option for sending traces via otlphttp (#3973)

This commit is contained in:
Alex Last
2024-05-12 18:00:54 +01:00
committed by GitHub
parent 0cac41a38b
commit a5ece25c07
2 changed files with 6 additions and 1 deletions

View File

@@ -97,9 +97,12 @@ func createExporter(c Config) (sdktrace.SpanExporter, error) {
case kindOtlpHttp:
// Not support flexible configuration now.
opts := []otlptracehttp.Option{
otlptracehttp.WithInsecure(),
otlptracehttp.WithEndpoint(c.Endpoint),
}
if !c.OtlpHttpSecure {
opts = append(opts, otlptracehttp.WithInsecure())
}
if len(c.OtlpHeaders) > 0 {
opts = append(opts, otlptracehttp.WithHeaders(c.OtlpHeaders))
}

View File

@@ -17,6 +17,8 @@ type Config struct {
// For example
// /v1/traces
OtlpHttpPath string `json:",optional"`
// OtlpHttpSecure represents the scheme to use for OTLP HTTP transport.
OtlpHttpSecure bool `json:",optional"`
// Disabled indicates whether StartAgent starts the agent.
Disabled bool `json:",optional"`
}