You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: add error handling for insecure HTTP endpoints with TLS client configuration (#7914)
## Summary
This PR moves the `insecure + TLS config` validation into the core OTLP
HTTP exporters in `opentelemetry-go` (trace, metric, and log), instead
of relying on validation in external/config-wrapper code.
This aligns with feedback from `open-telemetry/opentelemetry-go-contrib`
PR open-telemetry/opentelemetry-go-contrib#8560:
these packages are maintained/released together, so the check should be
enforced in this repo as well.
## What changed
- Added exporter-level validation error:
- `"insecure HTTP endpoint cannot use TLS client configuration"`
- Enforced in:
- `otlpmetrichttp` client construction
- `otlploghttp` client construction
- `otlptracehttp` client startup (`Start`, since `NewClient` does not
return an error)
- Added tests in all three exporters to cover:
- Error when `WithInsecure()` and `WithTLSClientConfig(...)` are both
set
- No error when a custom `WithHTTPClient(...)` is provided (preserves
existing precedence semantics)
## Behavior
- Invalid config (`insecure` + TLS config) now fails fast directly in
exporters.
- Existing `WithHTTPClient` override behavior remains unchanged.
## Testing
Ran:
- `go test ./...` in `exporters/otlp/otlpmetric/otlpmetrichttp`
- `go test ./...` in `exporters/otlp/otlplog/otlploghttp`
- `go test ./...` in `exporters/otlp/otlptrace/otlptracehttp`
## Related
- `open-telemetry/opentelemetry-go-contrib` PR
(open-telemetry/opentelemetry-go-contrib#8560)
---------
Co-authored-by: Damien Mathieu <42@dmathieu.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,9 @@ The next release will require at least [Go 1.25].
20
20
- Update `Baggage` in `go.opentelemetry.io/otel/propagation` and `Parse` and `New` in `go.opentelemetry.io/otel/baggage` to comply with W3C Baggage specification limits.
21
21
`New` and `Parse` now return partial baggage along with an error when limits are exceeded.
22
22
Errors from baggage extraction are reported to the global error handler. (#7880)
23
+
- Return an error when the endpoint is configured as insecure and with TLS configuration in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#7914)
24
+
- Return an error when the endpoint is configured as insecure and with TLS configuration in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#7914)
25
+
- Return an error when the endpoint is configured as insecure and with TLS configuration in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#7914)
23
26
24
27
<!-- Released section -->
25
28
<!-- Don't change this section unless doing release -->
0 commit comments