fix(otel): resolve exporter protocol through startup configuration

This commit is contained in:
ryan
2026-11-09 10:23:47 +08:00
parent b281b65e78
commit acd63ff410
10 changed files with 65 additions and 24 deletions
+8
View File
@@ -273,6 +273,14 @@ func applyEnvOverrides(c *configModel) {
c.Log.Output = envStr("LOG_OUTPUT", c.Log.Output)
// ─── OTel ───
protocol := strings.TrimSpace(envStr("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", ""))
if protocol == "" {
protocol = strings.TrimSpace(envStr("OTEL_EXPORTER_OTLP_PROTOCOL", ""))
}
if protocol == "" {
protocol = c.Otel.ExportProtocol
}
c.Otel.ExportProtocol = strings.ToLower(strings.TrimSpace(protocol))
c.Otel.SamplingRate = envFloat64("OTEL_SAMPLING_RATE", c.Otel.SamplingRate)
c.Otel.TracerName = envStr("OTEL_TRACER_NAME", c.Otel.TracerName)