From a5ece25c07f2e9c2e05f57d9ab3a3180b3236f54 Mon Sep 17 00:00:00 2001 From: Alex Last Date: Sun, 12 May 2024 18:00:54 +0100 Subject: [PATCH] feat: add secure option for sending traces via otlphttp (#3973) --- core/trace/agent.go | 5 ++++- core/trace/config.go | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/trace/agent.go b/core/trace/agent.go index 59e0e23e7..c8c91e907 100644 --- a/core/trace/agent.go +++ b/core/trace/agent.go @@ -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)) } diff --git a/core/trace/config.go b/core/trace/config.go index 5880d0397..5ab4ae58f 100644 --- a/core/trace/config.go +++ b/core/trace/config.go @@ -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"` }