-
Notifications
You must be signed in to change notification settings - Fork 195
Description
Bug description
The OTEL configuration values (endpoint, sampling rate, etc.) from the configuration file are not being used as fallbacks when CLI flags are not explicitly provided. This appears to be caused by passing nil instead of the cmd parameter to the getTelemetryFromFlags function.
Steps to reproduce
- Create a config file ~/.config/toolhive/config.yaml:
otel:
endpoint: "https://api.honeycomb.io"
sampling-rate: 1.0
- Run a command without explicit OTEL flags:
thv run time --debug
- Observe that no telemetry is generated
Expected behavior
Traces shared while running MCP servers;
Actual behavior
No telemetry is generated
Environment (if relevant)
ToolHive v0.2.5
Commit: 0361c44
Built: 2025-08-08 07:20:47 UTC
Go version: go1.24.1
Platform: darwin/arm64
Additional context
The getTelemetryFromFlags function was designed to implement a proper fallback hierarchy:
1 . CLI flags (highest priority)
2. Config file values (fallback)
3. Default values (last resort)
This bug breaks that hierarchy and forces users to always specify OTEL flags on the command line. I believe that simply introducing the cmd attribute in the function call might solve the issue.