Repository navigation
Description
Problem
To tune a toolset, a person must see which tools a plan run calls, which ones return nothing or fail, and how many tokens each answer costs. Today the RunTrace comment on the item lists the calls of one run as text. No metric exists, so no trend shows across runs. The alternatives check ran 34 times and searched about 4 times, and nothing showed it (#2950). The same blind spot can hide a tool that the planner never calls.
Proposed change
Declare these instruments and send them with emit, by tool name, job (stage, later implement) and toolset:
devops_cli_roadmap_tool_calls_totalwith the outcomeok,emptyorerror.devops_cli_roadmap_tool_answer_chars(histogram), the size of each answer after the cut.devops_cli_roadmap_tool_calls_per_run(histogram) by job and toolset.devops_cli_roadmap_tool_limit_hits_total, with the limit that stopped the run (calls, requests, window).
The RunTrace comment adds one line per run: the calls for each tool and the number of empty answers.
Add one panel to the Roadmap dashboard that reads the first two, and one alert rule with a promtool unit test: a tool of the set that no run called for 7 days while runs happened.
Acceptance criteria
- The four instruments are declared in the metrics module, no label has an unbounded value, and
docs/TELEMETRY.mdlists them. - A test shows one call of each outcome and checks the labels.
- The trace comment shows the counts for each tool.
- The alert rule and its unit test pass.
Alternatives check of 2026-11-05: none.
Tool: none found.
Proposed design
Problem statement
The stage planner calls read-only tools, and no metric shows which tools it calls or how each call ends. The RunTrace comment lists one run only, so no trend shows across runs, and a tool that no run calls stays hidden. This change adds four bounded instruments, one line for each run in the comment, one panel in the existing items dashboard, and one alert rule with a promtool unit test. The earlier proposal named a Roadmap dashboard that does not exist, and this proposal puts the panel in k8s/monitoring/dashboards/project-metrics.json.
Acceptance criteria
Requirement: Tool-call instruments are declared
The four roadmap tool-call instruments SHALL be entries of INSTRUMENTS in src/devops_cli/telemetry/instruments.py, each with a bounded label set, and docs/TELEMETRY.md SHALL list each one with its kind, unit and labels.
Scenario: The registry and the document list the four instruments
- WHEN A test reads
INSTRUMENTSanddocs/TELEMETRY.md. - THEN Both list
devops_cli_roadmap_tool_calls_total,devops_cli_roadmap_tool_answer_chars,devops_cli_roadmap_tool_calls_per_runanddevops_cli_roadmap_tool_limit_hits_totalwith the same kind and unit.
Requirement: Tool outcomes carry bounded labels
The tool-call counter SHALL record one observation for each tool result with the outcome ok, empty or error, and with the tool, job and toolset labels.
Scenario: One call of each outcome
- WHEN A test records one ok, one empty and one error result for the same tool, job and toolset.
- THEN The counter holds three series, and each series has the expected tool, job, toolset and outcome labels.
Requirement: Answer size is measured after the cut
The answer-size histogram SHALL observe the character count of each tool answer after the toolbox cut, with the tool, job and toolset labels.
Scenario: A long answer is cut
- WHEN A test returns an answer longer than the cut and records it.
- THEN The histogram observes the cut length and not the original length.
Requirement: Each run gives every tool a series
A stage run SHALL emit a zero increment of the tool-call counter for each tool of the toolset before it calls any tool.
Scenario: A run that calls no tool
- WHEN A test runs the planner with a toolset of three tools, and the run makes no tool call.
- THEN The counter holds three series with value 0 and the label
outcome="ok".
Requirement: Calls per run and limit hits are measured
The calls-per-run histogram SHALL observe the tool calls of each run with the job and toolset labels, and the limit-hits counter SHALL record the limit that stopped the run.
Scenario: A run stops at the call limit
- WHEN A test runs the planner until the call limit stops it.
- THEN The histogram observes one run, and the counter holds one series with the label
limit="calls".
Requirement: Trace comment shows tool counts
The RunTrace comment SHALL add one line for each run that lists the call count and the empty-answer count of each tool.
Scenario: A run calls two tools and one answer is empty
- WHEN A test renders the comment for a run that calls two tools and gets one empty answer.
- THEN The line names both tools with their call counts and the empty count.
Requirement: Dashboard panel reads tool metrics
The dashboard k8s/monitoring/dashboards/project-metrics.json SHALL hold one panel that queries devops_cli_roadmap_tool_calls_total and devops_cli_roadmap_tool_answer_chars.
Scenario: The dashboard JSON holds the tool panel
- WHEN A test reads
k8s/monitoring/dashboards/project-metrics.json. - THEN One panel has a query for each of the two metric names.
Requirement: Unused tool alert has a unit test
The alert rule SHALL fire for a tool with no call in 7 days while stage runs happened, and its promtool unit test SHALL pass.
Scenario: A tool is not called while runs happen
- WHEN The
promtooltest feeds zero calls for one tool and calls for another tool over 7 days. - THEN The alert fires for the unused tool and not for the called tool.
Existing Tool Considered
Alternatives check of 2026-11-05: verdict none, and no tool named. OpenTelemetry Python SDK, Prometheus, Grafana and promtool cover metric declaration, OTLP export, native histograms, dashboard panels and alert unit tests. They lack the four instruments with the bounded tool, job, toolset, outcome and limit labels, the per-run comment line and the unused-tool rule, so this repository adds that code. The written cost is about 30,000 tokens to build, about 8,000 tokens a month to keep and fix, and about 3 days elapsed.
Key questions
- Where are the metric instruments declared, sent and documented?: Each instrument is an entry of
INSTRUMENTSinsrc/devops_cli/telemetry/instruments.py, with its name, kind, unit and description.emit()sends it with its attributes, anddocs/TELEMETRY.mdlists it in its table.tests/telemetry/test_telemetry_instruments.pyfails on a metric that a module writes by name and on anemit()of an instrument outsideINSTRUMENTS. [sources: src/devops_cli/telemetry/instruments.py, docs/TELEMETRY.md, tests/telemetry/test_telemetry_instruments.py, CONTRIBUTING.md:132] - Does the repository have a Roadmap dashboard that can hold the tool panel?: No.
k8s/monitoring/dashboardsholds 15 dashboards, and none of them is a Roadmap dashboard. The items panels are ink8s/monitoring/dashboards/project-metrics.json. The earlier proposal named a Roadmap dashboard that does not exist, and this proposal puts the panel inproject-metrics.json. [sources: openspec/changes/2919-stuck-item-age-metrics-and-one/proposal.md:44] - Which metric kinds and label sets do the four instruments use?: Counters for
devops_cli_roadmap_tool_calls_totalanddevops_cli_roadmap_tool_limit_hits_total; histograms fordevops_cli_roadmap_tool_answer_charsanddevops_cli_roadmap_tool_calls_per_run. The labels aretool,job,toolset,outcomeandlimit. The stage tool registry, the job name and the limit name bound every value. (best practice) [sources: docs/TELEMETRY.md, src/devops_cli/telemetry/instruments.py, src/devops_cli/roadmap/stage_toolbox.py, CONTEXT.md]- Chosen: Counters and histograms as named. They match the
devops_cli_*naming and give the series that the panel and the alert read. - Rejected: Traces and logs only. They give no trend across runs and no PromQL alert.
- Rejected: One generic counter with a free-form label. A free-form label is unbounded and cannot support the panel or the alert.
- Chosen: Counters and histograms as named. They match the
- How does the stage planner tally the calls and empty answers of each run?: The toolbox wrapper tallies each tool result as it returns, keeps the per-run counts in memory, and passes them to the comment renderer in
stage.py. It never parsesRunTracemessages after the run. (best practice) [sources: src/devops_cli/roadmap/stage_toolbox.py, src/devops_cli/roadmap/agent_run.py, src/devops_cli/roadmap/stage.py]- Chosen: Tally in the tool wrapper. The outcome and the answer size are known at the result, and the comment needs the same tally.
- Rejected: Parse
RunTracemessages after the run.RunTraceholds no outcome and no empty count. - Rejected: Query Prometheus from the comment path. The comment path must not depend on the metrics backend.
- How does the alert find a tool of the set that no run called?: Each stage run emits a zero increment of the tool-call counter for every tool of the toolset. The rule fires when
sum by (tool) (increase(devops_cli_roadmap_tool_calls_total[7d]))is 0 whilehistogram_count(increase(devops_cli_roadmap_tool_calls_per_run[7d]))is greater than 0. (best practice) [sources: docs/TELEMETRY.md, src/devops_cli/roadmap/stage_toolbox.py, src/devops_cli/telemetry/instruments.py]- Chosen: Zero increment for each tool of the toolset at the start of a run. It gives every tool a series and keeps the four instruments of the issue.
- Rejected: A static
absent_over_timelist in the rule. The list drifts from the tool registry and needs one expression for each tool. - Rejected: A separate availability gauge. It adds a fifth instrument that the issue does not request.
- What does the dashboard panel show, and which file holds it?: One breakdown panel in
k8s/monitoring/dashboards/project-metrics.json. It shows the call rate bytoolandoutcomefromdevops_cli_roadmap_tool_calls_total, and the average answer size bytoolfromdevops_cli_roadmap_tool_answer_chars, both with the filterjob="stage". (best practice) [sources: openspec/changes/2919-stuck-item-age-metrics-and-one/proposal.md:44, docs/TELEMETRY.md, CONTEXT.md]- Chosen: One breakdown panel in
project-metrics.json. The items panels are in that file, and no Roadmap dashboard exists. - Rejected: A new Roadmap dashboard file. No such file exists, and a new dashboard needs its own provisioning.
- Rejected: Two separate panels. It adds dashboard space and splits one comparison.
- Chosen: One breakdown panel in
- Which text does the answer-size histogram measure?: The text of the tool return after the toolbox cut, measured where the wrapper tallies the call. A long answer gives the cut length, not the original length. (best practice) [sources: src/devops_cli/roadmap/stage_toolbox.py, src/devops_cli/roadmap/refine_investigation.py]
- Chosen: The text after the cut. It shows the size that the model reads, and a test can check it offline.
- Rejected: The raw return before the cut. It shows a size that the model never saw.
- Rejected: The tokens of the answer. No token counter exists for a tool return, and the cut is in characters.
- What format does the per-run tool line of the
RunTracecomment use?: One compact line in a stable tool order, such asTool calls: read_file=3 (empty=0), search=2 (empty=1). It names every called tool with its call count and its empty-answer count. (best practice) [sources: src/devops_cli/roadmap/stage.py, src/devops_cli/roadmap/agent_run.py]- Chosen: One compact text line. It fits the existing comment and shows the counts at a glance.
- Rejected: A JSON block. It is harder to read in the comment and adds no data.
- Rejected: A Markdown table. A table is too heavy for one run line.
- When is a tool answer
empty?: An answer isemptywhen its text after the cut holds no non-whitespace character. A result with text isok, and an exception or an error result iserror. (best practice) [sources: src/devops_cli/roadmap/stage_toolbox.py, src/devops_cli/roadmap/agent_run.py]- Chosen: Whitespace-only text is empty. It matches the wording 'return nothing' of the issue and is easy to test.
- Rejected: Only a null result is empty. A whitespace-only answer gives no information and would count as ok.
- Rejected: Any answer below a size threshold is empty. A short answer can be valid, and the threshold is arbitrary.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 2, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(telemetry)scope of the title gives the scope.The metrics help tune toolsets but do not block delivery or fix a defect.A person can see which tools the planner calls and which return nothing, which is needed to tune a toolset.Four instruments, a trace line, one dashboard panel, and one alert rule with a unit test are required.Both add roadmap metrics, a dashboard panel, and an alert rule, but #3069 covers pipeline-level outcomes while this candidate covers per-tool call counts, answer sizes, and limit hits.devops-cli-service commentedon Nov 2, 2026
Status set to Ready at dc26693 (see proposed design in issue body).
devops-cli-service commentedon Nov 2, 2026
The stage job returned the item to New. The premise of the issue does not hold at the staging commit, so the job planned no change and opened no pull request.
Evidence:
placeholder
devops-cli-service commentedon Nov 5, 2026
Alternatives check: none
Tool: none found
Lacks:
devops_cli_roadmap_tool_calls_total,devops_cli_roadmap_tool_answer_chars,devops_cli_roadmap_tool_calls_per_run,devops_cli_roadmap_tool_limit_hits_total) with the boundedtool,job,toolset,outcomeandlimitlabels that the acceptance criteria and the repo's instrument registry require.emptyoutcome, answer-size-after-cut observations, per-run call counts or stopping-limit breakdowns.RunTracecomment.promtoolunit test.Searches run:
Sources:
Checked on 2026-11-05. A person decides what this means for the item. The check changes no label and closes no issue.
6 remaining items
docs(openspec): plan the tool-call metrics of the stage planner (#3240)
feat(telemetry): declare the tool-call instruments and the planner pa…
feat(roadmap): count the tool calls of the stage planner by outcome (#…
feat(telemetry): warn when no run calls a tool of the stage planner i…
docs(roadmap): wrap the toolbox module text (#3240)
feat(roadmap): set the outcome of a tool call in the tool that answer…
test(telemetry): read a name and a double star in the resource label …
docs(telemetry): split the long sentences of the tool metric text (#3240
docs(openspec): plan the outcome that each tool of the stage planner …
docs(openspec): archive the change for the tool calls of the stage pl…
devops-cli-service commentedon Nov 5, 2026
Released in v0.63.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.63.0
devops-cli-service commentedon Nov 5, 2026
Live since 2026-11-05 19:48 UTC
feat(roadmap): mark each cut tool answer with its cap (#5622)