• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In
You are now the owner of this repo.

stacklok / toolhive / 20961566455 / 1
58%
main: 58%

Build:
DEFAULT BRANCH: main
Ran 13 Jan 2026 03:08PM UTC
Files 439
Run time 13s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

13 Jan 2026 03:04PM UTC coverage: 57.984% (-0.05%) from 58.034%
20961566455.1

push

github

web-flow
Fix: Migrate telemetry config `samplingRate` from float64 to string (#3268)

Users who created workloads with telemetry enabled in older versions of ToolHive encounter noisy warnings and errors when upgrading:

WARN  failed to load state for fetch: json: cannot unmarshal number into Go struct field Config.telemetry_config.samplingRate of type string
This occurs because the SamplingRate field in telemetry.Config was changed from float64 to string, but existing run config files still contain the old numeric format (e.g., "samplingRate": 0.1 instead of "samplingRate": "0.1").

Fixes #3267

Solution
Added a migration that runs at startup to convert old run config files from the float format to the string format.

The migration:

Runs once per installation (tracked by TelemetryConfigMigration flag in config)
Lists all run config files and checks if telemetry_config.samplingRate is a number
Converts numeric values to strings and writes them back
Logs which workloads were migrated
Is idempotent (safely skips configs that already have string values or no telemetry config)
Changes
cmd/thv/main.go: Added call to telemetry config migration at startup
pkg/config/config.go: Added TelemetryConfigMigration flag to track migration completion
pkg/migration/telemetry_config.go: New migration implementation
Testing
Before migration:

$ ./bin/thv-old run --name fetch --otel-endpoint http://localhost:4318 --otel-sampling-rate 0.1 fetch
# Creates config with: "samplingRate": 0.1

$ go run ./cmd/thv restart fetch
WARN  failed to load state for fetch: json: cannot unmarshal number into Go struct field Config.telemetry_config.samplingRate of type string
Error: failed to restart workload fetch: ...
After migration:

$ go run ./cmd/thv restart fetch
INFO  Successfully migrated telemetry config for 1 workload(s)
INFO  Loaded configuration from state for fetch
INFO  Starting tooling server fetch...
Workload fetch restarted successfully
# Config now has: "samplingRate": "0.1"

34424 of 59368 relevant lines covered (57.98%)

81.8 hits per line

Source Files on job 20961566455.1
  • Tree
  • List 439
  • Changed 11
  • Source Changed 2
  • Coverage Changed 11
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 20961566455
  • bc0d112c on github
  • Prev Job for on main (#20960284882.1)
  • Next Job for on main (#20964475937.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc