Skip to content

[FEATURE] channels-manager: push metrics over OTLP (daemon telemetry init) #921

Description

Problem

Follow-up from operator inference-gateway/operator#157 (resolves operator #156), which added OTel-aligned telemetry config to the Orchestrator CRD. When telemetry is enabled, the operator sets these env vars on the infer channels-manager daemon:

  • INFER_TELEMETRY_ENABLED=true
  • INFER_TELEMETRY_OTLP_ENDPOINT=<collector> (single shared endpoint -> config.Telemetry.OTLP.Endpoint)

The OTLP metrics exporter itself already exists (#842): the agent/chat path builds the DI container (internal/container/container.go -> OTLPEndpoint: c.config.Telemetry.OTLP.Endpoint), which wires the telemetry recorder + meter provider and pushes infer.* / gen_ai.* metrics over OTLP on an interval.

But the channels-manager daemon never initializes it. RunChannelsCommand (cmd/channels.go) constructs services.NewChannelManagerService(cfg.Channels) directly and never builds the container, so the long-running daemon pushes no metrics over OTLP even when the env vars above are set.

This matters specifically for operator deployments: the Orchestrator workload is outbound-only (no Service) (see operator CLAUDE.md), so a Prometheus pull/scrape exporter can never reach it. OTLP push is the only way to get metrics out of it - and today it is not wired on the daemon path.

Ask

Initialize the telemetry meter provider + OTLP metric exporter in the channels-manager daemon path, reusing the exporter from #842 and honoring the existing config (telemetry.enabled, telemetry.otlp.{endpoint,headers,interval} / INFER_TELEMETRY_*). No new config surface is needed - just wire the daemon to the same telemetry engine the agent/chat path already uses.

Candidate daemon-level metrics (beyond the per-run infer.* counters): messages processed, active channels, scheduler ticks, heartbeat liveness, per-message loop duration/outcome.

Open question

Per-message work is spawned as infer agent subprocesses (see examples/telegram-channel). If those inherit INFER_TELEMETRY_*, per-run agent metrics may already flow from the subprocesses; the remaining gap would then be the daemon process's own operational metrics plus confirming env inheritance. Worth confirming which signals are actually missing before implementing.

Acceptance criteria

  • channels-manager initializes the meter provider + OTLP metric exporter when telemetry.enabled and an OTLP endpoint are set; no otel init / zero overhead when unset.
  • Daemon metrics visible via a local otel-collector debug exporter (mirror the examples/a2a-traces setup).
  • Exporter failures never affect daemon operation (log-and-drop, matching [FEATURE] OTLP metrics exporter #842).
  • Metrics flushed on daemon shutdown.
  • [DOCS] follow-up filed against inference-gateway/docs for the orchestrator/daemon metrics setup.

References

Activity

  1. edenreich commented on Jul 16, 2026

    @edenreich
    Contributor

    @infer Can you work on this? use /ponytail:ponytail /go /go-concurrency

  2. moved this to In progress in 2026on Jul 16, 2026
  3. added theissue type on Jul 16, 2026
  4. changed the issue type fromtoon Jul 16, 2026
  5. inference-gateway-maintainer commented on Jul 16, 2026

    @inference-gateway-maintainer
    ContributorAuthor

    Model: ollama_cloud/deepseek-v4-flash · View Job

    Todos

    • Read existing work: check for existing PRs/branches for this issue
    • Understand current telemetry initialization in agent/chat path (container.go, telemetry recorder)
    • Understand channels-manager daemon path (cmd/channels.go, services/channel_manager.go)
    • Create working branch and add issue to project board
    • Add ExecDaemon execution mode to telemetry recorder
    • Wire telemetry recorder into channels-manager daemon (cmd/channels.go)
    • Add daemon-level metrics to ChannelManagerService
    • Run precommit checks and push
    • Create PR and file DOCS follow-up

    Pull Request

    #922

    ✅ Infer Result: Success

    All done. Here's a summary of what was changed:

    Wired OTLP telemetry into the channels-manager daemon (PR #922, resolves #921):

    • internal/telemetry/recorder.go: Added ExecDaemon execution mode ("daemon") and a Meter() accessor on Recorder so subsystems can register their own instruments on the shared meter provider
    • cmd/channels.go: RunChannelsCommand now sets telemetry.ExecutionMode = telemetry.ExecDaemon, creates a telemetry.Recorder from the existing config (telemetry.enabled, telemetry.otlp.{endpoint,headers,interval} / INFER_TELEMETRY_*), passes it to the channel manager, and calls tel.Shutdown() on daemon shutdown to flush final metrics
    • internal/services/channel_manager.go: NewChannelManagerService accepts a *telemetry.Recorder parameter, initializes daemon-level OTel instruments (infer.daemon.messages_processed counter, infer.daemon.message.duration histogram, infer.daemon.active_channels updown counter), and records metrics on message processing. Exporter failures are logged and dropped (matching [FEATURE] OTLP metrics exporter #842). No overhead when telemetry is disabled (nil-safe no-op)
    • internal/services/channel_manager_test.go: Updated all test calls to pass nil for the new telemetry parameter

    DOCS follow-up filed at inference-gateway/docs#414.

    Model: ollama_cloud/deepseek-v4-flash · Exit Code: 0 · Duration: 18m 55s

    Tokens: 8,192,273 in · 19,664 out · 8,211,937 total (63 requests)

    Tool calls: 85 total · 95% success rate

    Traces
    Session: 1784211220-64d324c4
    
    session (standard, success)                          18m54s
    ├── chat ollama_cloud/deepseek-v4-flash               11.8s
    ├── execute_tool TodoWrite                            342µs
    ├── chat ollama_cloud/deepseek-v4-flash                2.8s
    ├── execute_tool Read                                 450µs
    ├── execute_tool Bash                                 261ms
    ├── execute_tool Read                                 235µs
    ├── chat ollama_cloud/deepseek-v4-flash                2.6s
    ├── execute_tool Read                                 375µs
    ├── execute_tool Read                                 374µs
    ├── chat ollama_cloud/deepseek-v4-flash                8.1s
    ├── execute_tool TodoWrite                             72µs
    ├── chat ollama_cloud/deepseek-v4-flash               10.1s
    ├── execute_tool Grep                                   6ms
    ├── execute_tool Read                                 192µs
    ├── execute_tool Grep                                   6ms
    ├── chat ollama_cloud/deepseek-v4-flash                4.6s
    ├── execute_tool Grep                                 344µs
    ├── execute_tool Grep                                   5ms
    ├── execute_tool Read                                 163µs
    ├── chat ollama_cloud/deepseek-v4-flash                3.5s
    ├── execute_tool Grep                                   5ms
    ├── execute_tool Read                                 264µs
    ├── chat ollama_cloud/deepseek-v4-flash                3.3s
    ├── execute_tool Grep                                   7ms
    ├── execute_tool Grep                                   6ms
    ├── chat ollama_cloud/deepseek-v4-flash                4.3s
    ├── execute_tool Read                                 230µs
    ├── execute_tool Grep                                   7ms
    ├── execute_tool Grep                                  99ms
    ├── chat ollama_cloud/deepseek-v4-flash                3.8s
    ├── execute_tool Grep                                 113ms
    ├── execute_tool Grep                                   1ms
    ├── execute_tool Grep                                 113ms
    ├── chat ollama_cloud/deepseek-v4-flash                3.9s
    ├── execute_tool Grep                                 599µs
    ├── execute_tool Grep                                  91ms
    ├── chat ollama_cloud/deepseek-v4-flash                3.5s
    ├── execute_tool Read                                 178µs
    ├── execute_tool Read                                 194µs
    ├── execute_tool Read                                 123µs
    ├── chat ollama_cloud/deepseek-v4-flash                6.1s
    ├── execute_tool Grep                                 357µs
    ├── execute_tool Grep                                 620µs
    ├── chat ollama_cloud/deepseek-v4-flash                4.9s
    ├── execute_tool Grep                                 562µs
    ├── execute_tool Grep                                 627µs
    ├── chat ollama_cloud/deepseek-v4-flash                9.5s
    ├── chat ollama_cloud/deepseek-v4-flash                3.7s
    ├── execute_tool Bash                                   5ms
    ├── execute_tool Bash                                   4ms
    ├── chat ollama_cloud/deepseek-v4-flash                6.8s
    ├── execute_tool TodoWrite                            109µs
    ├── chat ollama_cloud/deepseek-v4-flash                7.0s
    ├── execute_tool Bash                                 280ms
    ├── execute_tool Bash                                   9ms
    ├── chat ollama_cloud/deepseek-v4-flash                3.0s
    ├── execute_tool Bash                                  1.3s
    ├── chat ollama_cloud/deepseek-v4-flash                3.6s
    ├── execute_tool Bash                                 23.4s
    ├── chat ollama_cloud/deepseek-v4-flash                4.8s
    ├── execute_tool Bash                                 563ms
    ├── chat ollama_cloud/deepseek-v4-flash               16.7s
    ├── execute_tool TodoWrite                             65µs
    ├── chat ollama_cloud/deepseek-v4-flash                4.1s
    ├── execute_tool Edit                                   1ms
    ├── chat ollama_cloud/deepseek-v4-flash                6.0s
    ├── execute_tool TodoWrite                             77µs
    ├── chat ollama_cloud/deepseek-v4-flash                8.7s
    ├── chat ollama_cloud/deepseek-v4-flash                6.3s
    ├── execute_tool Edit                                 514µs
    ├── chat ollama_cloud/deepseek-v4-flash                5.9s
    ├── execute_tool Edit                                 452µs
    ├── chat ollama_cloud/deepseek-v4-flash                5.5s
    ├── execute_tool Edit                                 412µs
    ├── chat ollama_cloud/deepseek-v4-flash               18.0s
    ├── chat ollama_cloud/deepseek-v4-flash                6.4s
    ├── execute_tool Edit                                   1ms
    ├── chat ollama_cloud/deepseek-v4-flash                9.7s
    ├── execute_tool Edit                                 858µs
    ├── chat ollama_cloud/deepseek-v4-flash                8.3s
    ├── execute_tool Edit                                 638µs
    ├── chat ollama_cloud/deepseek-v4-flash                9.0s
    ├── execute_tool Grep                                 469µs
    ├── chat ollama_cloud/deepseek-v4-flash                7.2s
    ├── execute_tool Edit                                 682µs
    ├── chat ollama_cloud/deepseek-v4-flash                9.0s
    ├── execute_tool Grep                                  95ms
    ├── chat ollama_cloud/deepseek-v4-flash               11.5s
    ├── execute_tool Read                                 166µs
    ├── chat ollama_cloud/deepseek-v4-flash               10.3s
    ├── execute_tool Edit                                 604µs
    ├── chat ollama_cloud/deepseek-v4-flash                8.8s
    ├── execute_tool TodoWrite                            110µs
    ├── chat ollama_cloud/deepseek-v4-flash                6.8s
    ├── execute_tool Bash                                 646ms
    ├── chat ollama_cloud/deepseek-v4-flash                7.2s
    ├── execute_tool Bash                                 55.3s [error: tool_error]
    ├── chat ollama_cloud/deepseek-v4-flash                9.2s
    ├── execute_tool Edit                                 110µs [error: tool_error]
    ├── chat ollama_cloud/deepseek-v4-flash               12.3s
    ├── execute_tool Read                                 191µs
    ├── chat ollama_cloud/deepseek-v4-flash                8.4s
    ├── execute_tool Edit                                   1ms
    ├── chat ollama_cloud/deepseek-v4-flash                7.8s
    ├── execute_tool Bash                                  6.4s
    ├── chat ollama_cloud/deepseek-v4-flash                9.9s
    ├── chat ollama_cloud/deepseek-v4-flash                8.4s
    ├── execute_tool Bash                                 15.5s
    ├── chat ollama_cloud/deepseek-v4-flash                7.9s
    ├── execute_tool Bash                                  1m2s [error: tool_error]
    │   ├── session [infer-action] (standard, success)    122µs
    │   │   ╰── chat openai/gpt-4o [infer-action]          71µs
    │   │       ╰── execute_tool Read [infer-action]        0µs
    │   ╰── session [infer-action] (standard, success)    106µs
    │       ╰── chat openai/gpt-4o [infer-action]          79µs
    │           ╰── execute_tool Bash [infer-action]       16µs [error: _OTHER]
    ├── chat ollama_cloud/deepseek-v4-flash                8.7s
    ├── execute_tool Bash                                  11ms
    ├── chat ollama_cloud/deepseek-v4-flash               12.6s
    ├── chat ollama_cloud/deepseek-v4-flash                8.5s
    ├── execute_tool Bash                                  7m2s [error: tool_error]
    ├── chat ollama_cloud/deepseek-v4-flash                9.6s
    ├── execute_tool Bash                                  10ms
    ├── chat ollama_cloud/deepseek-v4-flash               13.1s
    ├── execute_tool Bash                                   4ms
    ├── chat ollama_cloud/deepseek-v4-flash               10.7s
    ├── execute_tool Bash                                  3.8s
    ├── chat ollama_cloud/deepseek-v4-flash                9.5s
    ├── execute_tool Bash                                  1.5s
    ├── chat ollama_cloud/deepseek-v4-flash               11.5s
    ├── execute_tool Write                                586µs
    ├── chat ollama_cloud/deepseek-v4-flash                8.9s
    ├── execute_tool Bash                                  2.6s
    ├── chat ollama_cloud/deepseek-v4-flash               17.4s
    ├── execute_tool Bash                                 703ms
    ├── chat ollama_cloud/deepseek-v4-flash               20.5s
    ├── chat ollama_cloud/deepseek-v4-flash               11.5s
    ├── execute_tool Write                                657µs
    ├── chat ollama_cloud/deepseek-v4-flash                8.9s
    ├── execute_tool Bash                                  1.1s
    ├── chat ollama_cloud/deepseek-v4-flash               10.0s
    ├── execute_tool TodoWrite                             90µs
    ├── chat ollama_cloud/deepseek-v4-flash                8.9s
    ├── execute_tool Bash                                 247ms
    ├── execute_tool Bash                                  11ms
    ├── chat ollama_cloud/deepseek-v4-flash               14.1s
    ╰── chat ollama_cloud/deepseek-v4-flash                9.5s
    
    Stats
    Tool Calls
    
    ╭───────────┬───────┬───────┬─────────╮
    │ Tool      │ Calls │ Fail% │ Avg     │
    ├───────────┼───────┼───────┼─────────┤
    │ Bash      │ 24    │ 12%   │ 24868ms │
    │ Grep      │ 20    │ 0%    │ 28ms    │
    │ Read      │ 13    │ 0%    │ 0ms     │
    │ Edit      │ 11    │ 9%    │ 0ms     │
    │ TodoWrite │ 7     │ 0%    │ 0ms     │
    │ Write     │ 2     │ 0%    │ 0ms     │
    ╰───────────┴───────┴───────┴─────────╯
    
    Token Usage
    
    ╭────────────────────────────────┬─────────┬────────────┬─────────┬──────╮
    │ Model                          │ Prompt  │ Completion │ Total   │ Cost │
    ├────────────────────────────────┼─────────┼────────────┼─────────┼──────┤
    │ ollama_cloud/deepseek-v4-flash │ 8398120 │ 19884      │ 8418004 │ -    │
    ╰────────────────────────────────┴─────────┴────────────┴─────────┴──────╯
    
    Sessions
    
    ╭───────────┬──────────┬──────────╮
    │ Execution │ Mode     │ Sessions │
    ├───────────┼──────────┼──────────┤
    │ headless  │ standard │ 1        │
    ╰───────────┴──────────┴──────────╯
    
    ⚠️ 4 log(s)
    • Bash:
      exit status 1: # github.com/inference-gateway/cli/internal/services
      internal/services/channel_manager.go:16:2: "go.opentelemetry.io/otel/attribute" imported and not used
      
    • Edit:
      file /home/runner/work/cli/cli/internal/services/channel_manager.go was modified since you last read it (snapshot 2026-07-16T14:17:37Z, now 2026-07-16T14:18:40Z). Use the Read tool to read it again before editing.
      
    • Bash:
      exit status 1: === RUN   TestChildEnv
      === RUN   TestChildEnv/nil_recorder
      … (truncated)
      
    • Bash:
      exit status -1: [INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
      [INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
      … (truncated)
      

    Triggered by edenreich · Infer Action

  6. moved this from In progress to QA in 2026on Jul 16, 2026
  7. moved this from QA to Done in 2026on Jul 16, 2026
  8. inference-gateway-releaser commented on Jul 17, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.148.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementreleased

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions