Skip to content
FluxMeter
中文

Writing

Metering is not observability: why traces miss token cost

Traces show latency and errors, not customer-level token cost. Metering builds usage lines—complements observability, not a billing suite or zero overspend.

2026-11-08 · Metering · 8 min read

Someone opens a trace after an agent session and the flame graph looks complete: which span was slow, which tool call failed, how many retries landed. OpenTelemetry is on. The APM is on. In a Langfuse or Helicone-style board, “what ran” is almost fully visible. Then finance or product asks: “What did this customer’s tokens cost this month?” The reflex is understandable: isn’t that already in the traces? Add up the spans and you have the customer-side ledger.

The gap is usually not “our observability isn’t good enough.” It is the wrong layer. Observability answers execution and quality—latency, errors, spans, evals. Customer-side metering answers a commercial fact—which customer used how many tokens, and what that costs under your rules. A complete trace still does not make a customer-level usage ledger. The two complement each other; neither replaces the other.

What observability shows vs what the metering layer needs

The contrast is about the question, not about which view is “more complete.”

Observability: traces, APM, evals. OpenTelemetry, APM systems, and tools such as Langfuse or Helicone record how a request ran: latency, errors, dependency paths, quality signals. Debugging, performance, and experience depend on them. Their unit is the request, the span, the trace.

Usage metering: customer-level usage lines. Your commercial unit is customer, tenant, or workspace. You need “how many tokens this customer used in the billing period, and what that costs under your rules”—queryable, aggregable, exportable fact lines, not a screenshot of a flame graph or a manual sum of span attributes.

Correlate them if you want (store a trace id on the usage event and jump to the debug path when something looks wrong). Do not conflate them. One is execution health and quality; the other is attributed fact. A complete trace does not mean the customer side can speak clearly—the same split as upstream invoice ≠ customer-level usage: neither the debug layer nor the summary layer answers the customer-layer question.

One adjacent issue gets only a pointer: when the gateway times out or a usage receipt never arrives, you may not know whether an event happened. That receipt problem lives in the Architecture post on gateway timeouts. This piece covers the quieter failure: even when the trace shows the call, it is still not an attributed customer usage line.

Why summing traces does not make a usage ledger

Several mismatches show up often—and they stack.

Different jobs. A trace helps a person understand one execution: where it was slow, where it failed, how often it retried. Metering leaves a commercial fact: who used how much, and how cost attaches. If debug data becomes the customer-usage source of truth, the first dispute leaves you unsure which layer to trust.

Sampling and completeness. Observability pipelines often sample—fine for latency distributions, not fine when every token needs to enter the record. A missed call in APM can be acceptable. A missed call in customer usage is a hole. Metering events need to be recorded per occurrence, not as a representative sample.

Identity. Traces know services, spans, and requests. Your commercial unit is customer or tenant. Even if a span attribute carries a customer id, that does not automatically become a queryable, exportable customer usage line. Without attribution, the sum is another estimate.

Retention. Traces usually serve recent debugging and roll off after days or weeks. Customer usage has to be queried, cross-checked, and exported across a billing period. An expired span cannot come back as month-end evidence.

Price does not live in the trace. Even when a span carries a token estimate, that is usually a debug aid—not a customer line priced with your rate card or cost map. Upstream unit prices, your markup, or bundled rates should not be copied out of an APM panel and treated as customer truth.

So a trace is excellent at explaining why a call looked expensive (a long path, extra retries, the wrong model). It cannot stand in for “what is this customer’s usage line?” If you need to see who is burning tokens before month-end, that is the customer-level token cost visibility problem—again a usage line, not a denser flame graph.

The missing layer: usage event → attributed / priced customer usage line

Making customer-level cost speak clearly needs an explicit metering fact layer—not another export of traces:

usage event → attributed / priced customer usage line

Event: an observable usage occurrence (tokens, model, timestamp, plus customer/tenant—and session or other dimensions when you care).

Attribute: attach it to the right customer (and product or env as needed).

Price (your rules): apply your rate card or cost map; do not paste span estimates or upstream panel numbers as customer truth.

Line: a queryable, aggregable, exportable customer usage line—the input to visibility, allocation statements, or a billing system, not the invoice itself.

With that layer, observability keeps serving debug and quality. The customer side speaks from your usage lines. Link them; do not mix them. In most AI product stacks, the gateway routes, observability owns traces and latency, the metering layer attributes usage to customers, and the billing platform invoices and collects—four jobs, connected by export and cross-check, not by substitution.

What this layer solves—and what it does not

It fixes the split between metering and observability. It does not issue invoices, and it does not replace APM.

It helps youIt does not replace
See tokens and cost per customerOpenTelemetry, APM, or observability tools such as Langfuse or Helicone
Turn gateway / multi-tenant traffic into attributed usage linesFull subscriptions, invoicing, collections, tax; Stripe, Lago, Orb, Metronome, OpenMeter, or any billing suite
Feed allocation, usage statements, and exportA promise of zero overspend
Keep traces and customer usage lines comparable but separateTreating sampled traces as complete usage; HTTP 202 / custody as settlement; ClickHouse as billing truth; Flink as a billing engine

In one sentence: metering stops at the attributed usage line (optionally exported). Debugging stays with observability. Invoicing and payment stay in your billing stack. If you read Compare, align the question first—metering layer, observability, or billing suite? They can connect. They are not the same product story; this post does not rank them or promise a migration.

Where FluxMeter fits

FluxMeter’s positioning is deliberate: Open-source usage metering for AI gateways and multi-tenant products — customer-level tokens and cost, without a full billing suite.

From flux to ledger: ingest usage from a gateway or SDK, move it through custody and stream processing into a queryable ledger, and read attributed, optionally priced customer usage lines from the Usage API. When the objection is “we already have traces,” the first value is the missing customer-level usage fact—not another APM. Export is optional—into your own billing logic or Stripe, Lago, Orb, Metronome, and similar systems. FluxMeter does not replace observability tools, does not claim to replace billing suites, and is not a complete billing or invoicing platform.

On the wire: a 202 on ingest means custody (usage was durably accepted), not settlement. ClickHouse is an audit cold store, not billing truth; Flink aggregates usage, it is not a billing engine. Meter every token. Attribute every cost. Stop at the usage line.

Next steps

If “the traces look complete and we still cannot name the customer’s token cost” is the stuck point, check for customer-dimension usage lines before turning sampling to 100% or keeping traces around for another month.

Boundaries and public comparisons: Compare

Touch the stack locally: make demo (see Docs)

Product and path facts: Architecture

Series companion: Upstream invoice ≠ customer-level usage

Seeing who is burning first: customer-level token cost when an agent runs away

Separate the debug layer from the metering layer. Allocation and invoicing only sit cleanly when each has the right layer underneath.

Separate the debug layer from the metering layer. Allocation and invoicing only sit cleanly when each has the right layer underneath.