Skip to content

Emit workload startup message as structured JSON instead of plain text #4295

Closed

Description

@danbarr

Summary

Every toolhive proxy container currently emits the following plain-text line on startup:

Workload started successfully. Press Ctrl+C to stop.

This is the only non-JSON log line emitted by the proxy. All other output is structured JSON. This inconsistency breaks log collection pipelines that expect all output to be JSON-parseable.

Impact

Any user setting up log collection (OTel Collector filelog receiver, Fluentd, Filebeat, Promtail, etc.) with JSON parsing will encounter a parse error on every pod start and restart due to this line. Common symptoms:

  • OTel Collector stanza json_parser: emits "consume entries: expected { character for map value" and drops or fails the entry
  • Fluentd/Filebeat JSON parsers: silently discard or error on the line
  • OTTL ParseJSON(): emits "invalid character 'W' looking for beginning of value"

Users have to add special-case handling (e.g. on_error: drop, not IsMap(body) guards in OTTL) solely to work around this one line, which is not documented anywhere.

Suggested fix

Emit the startup message as a structured JSON log entry consistent with the rest of the proxy output:

{"level":"INFO","msg":"workload started","component":"toolhive-runner"}

This is a one-line change that eliminates an entire class of log pipeline edge cases for all users who set up log collection.

Context

Discovered while setting up OTel Collector → Loki log collection for ToolHive audit logs in a Kubernetes environment. The plain-text line was the root cause of several cascading errors during pipeline setup.

Activity

  1. added
    enhancement
    go
    on Mar 20, 2026
  2. added a commit that references this issue on Apr 5, 2026
    3e1da88
  3. danbarr commented on Apr 5, 2026

    @danbarr
    CollaboratorAuthor

    Just shipped #4567 for this — one-line change from fmt.Println to slog.Info. The startup message will now be emitted as structured JSON consistent with all other proxy log output.

  4. self-assigned this
    on Apr 6, 2026
  5. added a commit that references this issue on Apr 7, 2026
    deeb438
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgologging

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions