Skip to content
Yassir Kachri

Agentic Software Factory

Measuring Agentic Delivery: Joining Claude Code Telemetry to DORA Metrics

Token counts do not answer the executive question. How to attribute Claude Code spend at its source, join it to per-service DORA data, reconcile it to the invoice, and govern by cost per merged change.

Yassir Kachri Updated 9 min read

Most reporting on AI coding counts activity: seats, sessions, tokens, lines generated. The question an executive committee asks is different: for each service, did lead time and rework improve against that service’s own baseline, and what did the agents cost per merged change? I measure agentic delivery with that one unit, the agent cost of a merged change, read beside first-pass acceptance and the service’s DORA metrics.

Answering the question means joining two data sets that usually live apart, agent telemetry and delivery records, on a key both share. Claude Code’s OpenTelemetry export can supply that key, provided spend is attributed at its source, before anything is aggregated.

Unattributed spend fails without a single error

The failures this measurement exists to catch never raise an error. Agents keep working, and the damage surfaces weeks later in a number nobody owns.

A shared credential is the most common cause. By default, the Claude apps gateway sends all inference through one upstream credential, so the provider’s bill attributes everything to that credential and nothing to individual developers. A shared cloud role or an in-house proxy produces the same bill: it shows how much was spent and on which model, never by whom, on which repository or for which change.

A component in the request path that reshapes requests is the second cause. Prompt caching depends on markers Claude Code places in each request. A proxy that strips them, or that flattens the system prompt to log it, still returns success, and the conversation is then billed as uncached input on every turn. The loss shows up only in the month’s token volume, unless a cache metric catches it as it happens.

Activity reported as value is the third. Lines of code, sessions and accepted suggestions rise with adoption whatever happens to delivery, and self-reported speed carries its own bias. In METR’s 2025 randomized trial, 16 experienced open-source developers took 19% longer to complete issues when AI tools were allowed, and afterward still believed the tools had made them 20% faster. METR has since marked those results as out of date for current models, so the trial says nothing about the direction of the effect today. It still shows how far people can misjudge their own speed, and a funding decision built on self-reported savings inherits that error.

Only a few exported metrics belong on a scorecard

With telemetry enabled, Claude Code exports eight metrics. A few of them carry the scorecard; the rest answer narrower questions or none that matter to it.

Exhibit 1 Cost and token metrics feed the scorecard; activity metrics stay off it
MetricWhat it measuresRole on the scorecard
claude_code.cost.usageEstimated spend, by model; by repository, group and surface as configured hereNumerator of cost per merged change, reconciled to the invoice
claude_code.token.usageTokens by type: input, output, cache read, cache creationCache read share, model mix
claude_code.code_edit_tool.decisionAccept and reject decisions, including hook denialsGuardrail signal; silent on code quality
claude_code.active_time.totalActive time, split between user and CLIAdoption only
claude_code.pull_request.countPull requests Claude Code openedSilent on whether they merged or held
claude_code.commit.countCommits Claude Code createdDiagnostic only
claude_code.session.countSessions startedExcluded
claude_code.lines_of_code.countLines added and removedExcluded: it rewards volume

Source: Claude Code monitoring documentation (metric names and token types checked 2026-11-24); author's scorecard design.

The monitoring documentation offers lines of code as a way to track productivity. I keep it off the scorecard, because larger changes lengthen the review queue, and a leaderboard of lines accepted rewards the behavior that slows delivery down.

Spend is attributed to a person, a repository and a surface at the source

Laptops and pipelines reach the model by different routes, and both have to land in the same series.

Laptop sessions go through the Claude apps gateway, which signs developers in with the corporate identity provider and stamps each telemetry export with the developer’s identity and groups. A signed-in client ignores any locally configured telemetry endpoint and exports through the gateway’s relay, so per-developer attribution needs no configuration on the laptop. Each developer does approve a one-time security dialog, and a session whose developer declines it exits, so onboarding has to explain it. Pipelines cannot use the gateway, which has no service-token flow for unattended jobs. They keep their OIDC federation to the cloud provider, cap each run with its own --max-budget-usd (spend can pass the cap slightly, so the budget needs headroom), and export straight to the same collector.

A runner image carries settings like these:

{
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "OTEL_METRICS_EXPORTER": "otlp",
    "OTEL_LOGS_EXPORTER": "none",
    "OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
    "OTEL_EXPORTER_OTLP_ENDPOINT": "https://otel.acme.internal",
    "OTEL_METRICS_INCLUDE_REPOSITORY": "true",
    "OTEL_METRICS_INCLUDE_SESSION_ID": "false",
    "OTEL_RESOURCE_ATTRIBUTES": "acme.surface=ci"
  }
}

Each line answers a specific risk:

  • Logs are off. This layer collects metrics only, because logs and traces can carry full shell commands, tool inputs and file paths. Prompt text is not exported by default, and the reference design keeps it that way.
  • Repository attributes are on. vcs.owner.name and vcs.repository.name, derived from the origin remote, are the join key to delivery data. Both are needed, because two groups that each hold an api repository would otherwise merge into one service, and the owner is omitted when the remote path has a single segment, a case worth checking once per Git host.
  • Session identifiers are off. They multiply series without answering a scorecard question.
  • The acme.surface attribute separates laptop from pipeline spend. On the laptop path, the gateway’s telemetry.resource_attributes setting adds acme.surface: laptop to every export.

These settings come from managed configuration. Claude Code ignores the exporter variables in a repository’s own settings files, so no team can turn telemetry on, redirect it or capture content from inside a repository. The collector then hashes the user identifiers before anything is stored. Hashing pseudonymizes an email without anonymizing it, so raw access stays restricted. Per-person data exists to set spend caps and find runaway sessions, and the scorecard never displays it.

Exhibit 2 Two routes to the model, one collector, one scorecard reconciled to the bills

Pipeline jobs reach the model provider directly through OIDC, and laptop sessions through the Claude apps gateway, which stamps each export with the developer's identity. Both export metrics to one OpenTelemetry collector that pseudonymizes people. The collector, delivery records and an invoice-gap check against the provider bills feed a scorecard per service and month

Source: Author's diagram of the FinOps and telemetry plane in The Enterprise Agentic Software Factory.

Delivery outcomes come from DORA, measured per service against itself

DORA’s five metrics are the outcome side of the join: change lead time, deployment frequency, failed deployment recovery time, change fail rate and deployment rework rate. DORA defines the last as “the ratio of deployments that are unplanned but happen as a result of an incident in production.” An organization whose change process already separates emergency changes from standard ones has that metric almost for free, since an emergency change linked to a production incident is a rework deployment by definition.

DORA’s cautions shape the scorecard as much as its definitions. The metrics “are meant to be applied at the application or service level,” comparing vastly different applications “can be misleading,” and the goal is to improve a team’s performance over time, “not to compete against other teams or organizations.” The scorecard therefore reports one grain, a service and a calendar month, compares each service only with its own pre-rollout baseline, and ranks no team or person. I would rebuild at least one quarter of that baseline from the records the Git host, deployment pipeline and incident tool already keep before any funding decision relies on it.

Cost per merged change exposes savings that are not real

The cost side of the scorecard is short:

finops:
  agent_cost_per_merged_pr:
    sources:
      - claude_code.cost.usage by vcs.owner.name,
        vcs.repository.name
      - Code Review repository breakdown (list price)
    cross_check: CI result.json total_cost_usd by repository
    split_by: acme.surface       # laptop, ci
    measure: (agent spend + Code Review spend) / merged PRs
  cache_read_share:
    source: claude_code.token.usage
    measure: cacheRead / (input + cacheRead + cacheCreation)
    split_by: acme.surface
    alert: 10 points below the service's 4-week median
  invoice_gap:
    bills: [AWS for Bedrock, Anthropic for Code Review]
    measure: abs(estimate - bill) / bill, per bill
    alert: above 10% in any month

The numerator comes from two bills. Laptop and pipeline sessions on Amazon Bedrock appear on the AWS bill, while Code Review is billed on token usage and its costs appear on the Anthropic bill whatever provider serves the other requests. Pipelines export the same cost metric as laptops, so the job-level result.json totals serve only as a cross-check; adding them as a second source would count every pipeline run twice.

Cost per merged change sits beside first-pass acceptance, and neither is a target on its own. DORA recommends exactly this kind of pairing: “Teams should identify multiple metrics, including some with a healthy amount of tension between them.” Together the two numbers show what a token price leaves out. A cheaper model that fails its first pass more often re-runs the agent, the critic and the pipeline, so the token bill can fall while the cost of each merged change rises.

Exhibit 3 A model 40% cheaper per attempt can still cost 12% more per merged change
Model AModel B (cheaper)
Agent spend per attempt$3.00$1.80
Critic and pipeline spend per attempt$1.00$1.00
First-pass acceptance80%50%
Attempts per merged change1.252.00
Agent spend per merged change$3.75$3.60
Total cost per merged change$5.00$5.60

Source: Illustrative inputs, author's calculation. Attempts per merged change = 1 / first-pass acceptance, which assumes every attempt has the same chance of acceptance. Change Owner time spent on returned changes is excluded, which understates the gap.

The arithmetic is (agent + critic and pipeline spend) × attempts: ($3.00 + $1.00) × 1.25 = $5.00 for Model A, and ($1.80 + $1.00) × 2.00 = $5.60 for Model B, or 12% more. Every routing change therefore runs as a trial on one service first. I adopt it only when cost per merged change falls and first-pass acceptance stays within the service’s normal range.

Cache read share belongs on the same scorecard, because it is a cost metric. It falls when a release, a plugin, an MCP change or something new in the request path breaks the cache prefix, and each turn then bills more fresh input without any error. The alert threshold of 10 points below the service’s own four-week median is my recommended starting value. Pipelines are split out, because a single-use runner on a new commit starts each session cold, and its lower share is its normal state.

A first budget can come from published averages, then must be replaced

Claude Code’s cost documentation states that “across enterprise deployments, the average cost is around $13 per developer per active day and $150-250 per developer per month, with costs remaining below $30 per active day for 90% of users.” The page gives no sample size or measurement period for these averages. As a planning assumption only, 100 engineers using it interactively gives a monthly envelope of 100 × $150 = $15,000 to 100 × $250 = $25,000, with pipelines and Code Review budgeted on top of it.

The same figures give a first set of per-person spend caps, which act as circuit breakers on one developer at a time. My recommended starting values are a daily default of $60 (twice the $30 line that 90% of users stay under) and a monthly default of $500 (twice the top of the $150-250 range). After the first month, the organization’s own reconciled telemetry replaces both the envelope and the caps.

The scorecard supports a narrow claim

The scorecard shows whether lead time and rework moved against each service’s own baseline, and at what agent cost per merged change. It cannot show that the models caused the change, because the operating model changes at the same time, so what it evaluates is the factory as a whole. Turning the result into money is finance’s step, using its own cost of a day of lead time and of a rework deployment.

That is the readout I would give an executive committee: delivery outcomes against baseline, cost per merged change, first-pass acceptance, cache read share and the invoice gap, with lines of code, session counts and per-person rankings left off by design.