Skip to content

OTEL Configuration from Config File Not Being Read #1355

@mauriciocoder

Description

@mauriciocoder

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

  1. Create a config file ~/.config/toolhive/config.yaml:
   otel:
     endpoint: "https://api.honeycomb.io"
     sampling-rate: 1.0
  1. Run a command without explicit OTEL flags:
   thv run time --debug
  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions