Commit df3fd14
fix: disable OTel metrics export when no collector is configured (#644)
Previously, InitMetrics defaulted to localhost:4317 when
OTEL_EXPORTER_OTLP_ENDPOINT was unset, causing "failed to upload
metrics" errors every 30s in environments without an OTel collector
(kind, CRC, minikube, and any production cluster without one).
Make metrics export opt-in: return a no-op when the endpoint is not
configured, and log a single informational line at startup.
This is mostly relevant for local dev where running the collector is not
necessary (and is undefined in most overlays). The specific errors
reported in the log are:
```
2026/02/16 19:22:53 failed to upload metrics: context deadline exceeded: rpc error: code = Unavailable desc = name resolver error: produced zero addresses
```
Signed-off-by: Martin Prpič <mprpic@redhat.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 1880c62 commit df3fd14
1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
49 | 51 | | |
50 | | - | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | | - | |
| 55 | + | |
| 56 | + | |
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| |||
0 commit comments