Commit 2b10deb
committed
LCORE-1801: Fix Otel intrumentation to respect OTEL_SDK_DISABLED flag
Fix OpenTelemetry instrumentation to only initialize when explicitly enabled, preventing
connection errors when tracing is disabled.
**Problem**
After adding `opentelemetry-instrument` wrapper to the application startup, the OpenTelemetry SDK
was attempting to connect to the default OTLP endpoint (`localhost:4317`) even when `OTEL_SDK_DISABLED=true`.
This caused errors in CI/E2E tests:
```
ERROR:opentelemetry.exporter.otlp.proto.grpc.exporter:Failed to export traces to localhost:4317,
error code: StatusCode.UNAVAILABLE WARNING:opentelemetry.exporter.otlp.proto.grpc.exporter:Transient error
StatusCode.UNAVAILABLE encountered while exporting metrics to localhost:4317
```
The `opentelemetry-instrument` CLI was initializing the SDK regardless of the `OTEL_SDK_DISABLED` environment
variable, causing unnecessary connection attempts.
**Solution**
Make OpenTelemetry instrumentation **conditional** based on the `OTEL_SDK_DISABLED` environment variable.1 parent 21fa5b3 commit 2b10deb
4 files changed
Lines changed: 21 additions & 3 deletions
File tree
- deploy/lightspeed-stack
- scripts
- tests/e2e-prow/rhoai/manifests/lightspeed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
40 | 44 | | |
41 | 45 | | |
42 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
136 | 140 | | |
137 | 141 | | |
138 | | - | |
| 142 | + | |
139 | 143 | | |
140 | 144 | | |
141 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
0 commit comments