mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-13 18:00:00 +08:00
feat: add secure option for sending traces via otlphttp (#3973)
This commit is contained in:
@@ -97,9 +97,12 @@ func createExporter(c Config) (sdktrace.SpanExporter, error) {
|
|||||||
case kindOtlpHttp:
|
case kindOtlpHttp:
|
||||||
// Not support flexible configuration now.
|
// Not support flexible configuration now.
|
||||||
opts := []otlptracehttp.Option{
|
opts := []otlptracehttp.Option{
|
||||||
otlptracehttp.WithInsecure(),
|
|
||||||
otlptracehttp.WithEndpoint(c.Endpoint),
|
otlptracehttp.WithEndpoint(c.Endpoint),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !c.OtlpHttpSecure {
|
||||||
|
opts = append(opts, otlptracehttp.WithInsecure())
|
||||||
|
}
|
||||||
if len(c.OtlpHeaders) > 0 {
|
if len(c.OtlpHeaders) > 0 {
|
||||||
opts = append(opts, otlptracehttp.WithHeaders(c.OtlpHeaders))
|
opts = append(opts, otlptracehttp.WithHeaders(c.OtlpHeaders))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ type Config struct {
|
|||||||
// For example
|
// For example
|
||||||
// /v1/traces
|
// /v1/traces
|
||||||
OtlpHttpPath string `json:",optional"`
|
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 indicates whether StartAgent starts the agent.
|
||||||
Disabled bool `json:",optional"`
|
Disabled bool `json:",optional"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user