Commit d04eb02
fix(telemetry): warn instead of crashing when OTLP endpoint has no enabled exporters (#4648)
* fix(telemetry): warn instead of crashing when OTLP endpoint has no enabled exporters
When an OTLP endpoint is configured via `thv config otel set-endpoint`
but both tracing and metrics are disabled, `thv serve` crashes with a
fatal validation error preventing the server from starting.
Instead of failing, log a warning and clear the endpoint so the server
starts normally. This avoids a confusing "Health check failed" error
in ToolHive Studio.
Fixes #4647
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor(telemetry): extract handleUnusedEndpoint to reduce cyclomatic complexity
Move the unused endpoint check into a dedicated helper function to
keep NewServeProvider under the gocyclo threshold (15).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(telemetry): enable tracing by default when OTLP endpoint has no enabled exporters
Instead of clearing the endpoint (which would silently drop telemetry
for users who configured an endpoint expecting it to work), enable
tracing by default so the endpoint is actually used.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 3a6c0c1 commit d04eb02
1 file changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
0 commit comments