From b5d41858b678ab684bbff9337f1bbc1340cac24a Mon Sep 17 00:00:00 2001 From: TestardR Date: Mon, 25 May 2026 09:27:02 +0200 Subject: [PATCH] fix(otel): use cents-scale bucket boundaries for session.cost.total histogram The session.cost.total histogram was using OTel SDK default bucket boundaries [0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000, +Inf] which are USD-scale. Since typical opencode session costs are sub-dollar, 100% of samples land in the le=5 bucket and P50/P95 panels in SigNoz return empty. Add advice.explicitBucketBoundaries with cents-scale boundaries: [0.01, 0.05, 0.10, 0.25, 0.50, 1.00, 2.50, 5.00, 10.00, 25.00] These cover the realistic distribution of per-session costs and produce meaningful percentile values in downstream observability tooling. --- src/otel.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/otel.ts b/src/otel.ts index efca636..6a95de6 100644 --- a/src/otel.ts +++ b/src/otel.ts @@ -196,6 +196,9 @@ export function createInstruments(prefix: string): Instruments { sessionCostGauge: meter.createHistogram(`${prefix}session.cost.total`, { unit: "USD", description: "Total cost per session in USD, recorded as a histogram on session idle", + advice: { + explicitBucketBoundaries: [0.01, 0.05, 0.10, 0.25, 0.50, 1.00, 2.50, 5.00, 10.00, 25.00], + }, }), modelUsageCounter: meter.createCounter(`${prefix}model.usage`, { unit: "{request}",