Skip to content

fix(#162): remove Tempo metrics chunking — cost aggregation via client-side trace data#168

Merged
arniesaha merged 2 commits intomainfrom
fix/issue-162-cost-prometheus
Apr 17, 2026
Merged

fix(#162): remove Tempo metrics chunking — cost aggregation via client-side trace data#168
arniesaha merged 2 commits intomainfrom
fix/issue-162-cost-prometheus

Conversation

@arniesaha
Copy link
Copy Markdown
Owner

Summary

Closes #162

Removes the fragile useTempoMetrics hook that chunked Tempo metrics API calls in 3-hour windows. Cost aggregation (buildCostTotal, buildCostTimeSeries, buildCostByAgent) was already working correctly via client-side computation from Tempo search traces — no metrics API needed.

Changes

  • Removed useTempoMetrics hook and TEMPO_METRICS_MAX_WINDOW_SECONDS constant from useTempo.ts
  • Removed phantom TempoMetricResult import (type was not defined anywhere — would have caused a TS error)
  • Added promCostTotalQuery() to queries.ts for future Prometheus-native cost tracking

What stays the same

  • Cost panels (Total Cost, Cost over Time, Cost by Agent) continue working via buildCostTotal / buildCostTimeSeries / buildCostByAgent from Tempo trace rows
  • No dashboard functionality is removed — only the fragile chunked metrics path

Testing

  • npm run build passes with no TypeScript errors

🤖 Generated with Claude Code

arniesaha and others added 2 commits April 17, 2026 02:11
…nt-side from Tempo search

Removes the fragile useTempoMetrics hook that chunked Tempo metrics API
calls in 3-hour windows, along with the TEMPO_METRICS_MAX_WINDOW_SECONDS
constant and the non-existent TempoMetricResult phantom import.

Cost aggregation (buildCostTotal, buildCostTimeSeries, buildCostByAgent)
was already working correctly via client-side computation from Tempo
search traces — the metrics API path was unused and broken.

Adds promCostTotalQuery() to queries.ts for future Prometheus-native
cost tracking once the agentweave_cost_usd_total metric is available.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tTotalQuery

Exports TEMPO_SEARCH_LIMIT and shows a muted caption on the Total Cost
StatCard when traceRows hits the cap, so users see when the aggregate
is sampled and may under-count. Removes dead promCostTotalQuery().

Follow-up to PR #168 review.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@arniesaha arniesaha merged commit 3c1f2d3 into main Apr 17, 2026
4 checks passed
@arniesaha arniesaha deleted the fix/issue-162-cost-prometheus branch April 17, 2026 09:50
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.

Move cost/token aggregation from Tempo metrics to Prometheus

1 participant