• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 20961566455
58%

Build:
DEFAULT BRANCH: main
Ran 13 Jan 2026 03:08PM UTC
Jobs 1
Files 439
Run time 1min
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

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"

45 of 141 new or added lines in 3 files covered. (31.91%)

32 existing lines in 3 files now uncovered.

34424 of 59368 relevant lines covered (57.98%)

81.8 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
4
0.0
0.0% cmd/thv/main.go
92
30.3
pkg/migration/telemetry_config.go

Uncovered Existing Lines

Lines Coverage ∆ File
3
71.85
-1.11% pkg/ignore/processor.go
8
61.05
-6.32% pkg/secrets/keyring/keyctl_linux.go
21
52.23
-2.13% pkg/workloads/manager.go
Jobs
ID Job ID Ran Files Coverage
1 20961566455.1 13 Jan 2026 03:08PM UTC 439
57.98
GitHub Action Run
Source Files on build 20961566455
  • Tree
  • List 439
  • Changed 11
  • Source Changed 2
  • Coverage Changed 11
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #20961566455
  • bc0d112c on github
  • Prev Build on main (#20960284882)
  • Next Build on main (#20964475937)
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