Skip to content

OpenTelemetry export and a Grafana board to import - #150

Merged
tokenmeter1 merged 3 commits into
mainfrom
claude/project-thread-81rgve
Dec 1, 2026
Merged

tokenmeter1 merged 3 commits into
mainfrom
claude/project-thread-81rgve

Conversation

@jacques-pr

Copy link
Copy Markdown
Collaborator

What changes

Review 3, N4: Tokenmeter can send its figures to an OpenTelemetry collector, and there is a Grafana board to import. Version 0.9.11.

  • OpenTelemetry export (off by default). Settings › Machines › OpenTelemetry Export takes a collector's address, optional headers and how often to send (60 s by default, 10 s to 1 hour). It sends OTLP over HTTP as JSON to /v1/metrics: the same figures under the same names as GET /metrics, gauges as gauges and counters as cumulative sums. Only counts and measurements leave the machine, never a prompt or an answer. The settings answer names the headers that are set but never their values.
  • One list of figures. GET /metrics and the export are now written from the same list (App/Metric.swift), so the two can't drift apart.
  • GET /otlp and POST /otlp on the Linux service, for this machine only, read and change the export and say when it last sent and what the collector answered.
  • Grafana board in docs/grafana/tokenmeter.json (24 panels: speed, queue, tokens, GPU, memory, power, per model and machine). It works with Prometheus scraping /metrics and with the export through a collector. A test checks that every figure the board asks for exists.
  • Docs: Status-Endpoint (Grafana and OpenTelemetry sections), Features, Home, README.

The Grafana board

Checks

scripts/check.sh: 33 of 33 passed in 35 min 48 s (Tokenmeter 0.9.11, x86_64)
passed  syntax               15s  339 Swift files parsed, 0 with errors.
passed  embedded              1s  4 embedded files compared with their sources, 0 differ.
passed  agents                7s  OK
passed  tests               346s  6084 checks passed.
passed  build               358s  Build complete! (356.90s)
passed  gpu                  54s  ok: an Arc card asleep, no list of names (Intel:0)
passed  machines             85s  Other machines, their Servers pages, their engines and shared history, sharing, the Monitor's details, history
passed  mesh                141s  The mesh: finding each other, asking, Not Now, allowing, being added, passing the list on, members' history, I
passed  viewer               17s  viewers: all checks passed
passed  phone-alerts          2s  phone alerts: all checks passed
passed  alerts              147s  alerts: all checks passed
passed  alert-channels       55s  alert channels: all checks passed
passed  alerts-remote        26s  alerts from another machine: all checks passed
passed  targets-remote       21s  targets on every machine: all checks passed
passed  targets             126s  targets: all checks passed
passed  spend                79s  spend: all checks passed
passed  drills                2s  Drills: all solvable, marked, and kept apart.
passed  gizmo-guide           2s  Gizmo's guide: ok
passed  tools                37s  MCP servers and tool hosts: the agent's list, each server on its machine, the process on the tool host, the Me
passed  mcp-proxy             8s  The MCP Proxy: passing an MCP server's conversation on untouched, timing calls answered as JSON and as a strea
passed  wait                 87s  Where the wait went: a slow task traced step by step (the tool under the step that asked for it, the time not 
passed  history-line          8s  The history line: 150 sessions, a session, its trace, the tool stats and the alike tasks told in 2.5 s; the st
passed  history-store        23s  The history store: 6000 requests and 7385 agent lines moved into the database once, 876 sessions kept, the sam
passed  storage               4s  Storage: seven kinds listed, 600 requests exported as CSV and JSON, days kept changed and remembered, and the 
passed  wire                 31s  The wire: the engines' answer 63756 bytes plain and 4711 compressed, 200 questions on one connection, two at o
passed  stream               51s  stream heartbeat: told on each request, and in Sessions as waiting to start, writing and frozen; Watch live in
passed  workload             35s  A workload test: a picked stretch's chat and batch previewed with what can't be copied, sent again to a stand-
passed  share                 3s  share cards: ok
passed  bench                60s  Standard runs: OK
passed  other-engine         21s  ok: Other (OpenAI-compatible) reads a plain server, TGI, KoboldCpp and TabbyAPI, and asks for a key when one i
passed  models                2s  ok: the Models page finds the model files of Ollama, LM Studio, Hugging Face and llama.cpp, and Will it fit es
passed  otlp                 63s  ok: the OpenTelemetry export is off until switched on, sends the figures of /metrics with the headers given, t
passed  kde                 231s  The app rests when nothing changes.

Also tried by hand against a real OpenTelemetry Collector (contrib 0.114) feeding Prometheus 3.0 and Grafana 11.3: the collector accepts the export, the figures arrive under the same names and kinds as a scrape of /metrics, and the board imports and draws from both.

Not checked: the Mac settings view (OTLPSettings in App/SettingsPage.swift) is not compiled here, GitHub's Mac jobs will say. Datadog, Honeycomb and other hosted services were not tried; they are reached through a collector.


Generated by Claude Code

For those who already run a collector: Settings › Network › OpenTelemetry
Export sends the figures of GET /metrics to it as OTLP over HTTP (JSON),
under the same names, so one Grafana board reads them whichever way they
came. Off until an address is given and the switch is on. Counts, speeds and
sizes only: never a prompt, a reply or a client's name.

- App/Metric.swift: the figures as a list both the Prometheus page and the
  export are written from; /metrics reads as before.
- App/OTLP.swift: the body (levels as gauges, the counts since a server
  started as cumulative sums), the address and headers, and the sender, which
  runs with the alerts' check. A header's value is never given back.
- Linux/OTLPRoutes.swift: GET and POST /otlp, from this machine only.
- Settings › Network on KDE and the Mac.
- docs/grafana/tokenmeter.json: a board for Grafana 10 and later, with a
  machine picker.
- Linux/tests/otlp.sh with a stand-in collector, unit checks, docs.
  Version 0.9.11.

Co-Authored-By: tokenmeter1 <358883051+tokenmeter1@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EE8zW9xXDFNPa2ueA83i2x
claude and others added 2 commits December 1, 2026 06:35
…ft running

On GitHub the steps before it leave a stand-in llama.cpp on port 8080, which the test's services
see as a server at work and tell as a quiet session. The check that the MCP Proxies' lines make
no session of their own now looks only at sessions that aren't such a server's, and says what it
found when it fails.

Co-Authored-By: tokenmeter1 <358883051+tokenmeter1@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EE8zW9xXDFNPa2ueA83i2x
Every service of a user reads ~/.tokenmeter/reports, wherever its HOME points, so the file-agent
report the first steps write there showed up as a session in Linux/tests/wait.sh's own services,
which then failed ("the proxy's call made a session of its own").

Co-Authored-By: tokenmeter1 <358883051+tokenmeter1@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EE8zW9xXDFNPa2ueA83i2x
@tokenmeter1
tokenmeter1 merged commit daa8dcc into main Dec 1, 2026
5 of 6 checks passed
jacques-pr pushed a commit that referenced this pull request Dec 1, 2026
The step never ran: until now an earlier step of the job failed first (Linux/tests/wait.sh, fixed
in #150), and the container the job runs in has no npm.

Co-Authored-By: tokenmeter1 <358883051+tokenmeter1@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EE8zW9xXDFNPa2ueA83i2x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants