Skip to content

Latency-histogram quantiles (p50/p90/p99) unavailable on the --perf Prometheus /metrics surface #158

Closed

Description

@JAORMX

Summary

The local perf-introspection surface (mecatui --perf → /metrics, and by extension the perf-MCP perf://metrics/summary) cannot report latency quantiles for turn_duration, ttft, inter_token, inter_token_max, or tool_queue. On the Prometheus exposition these histograms carry only the le="+Inf" bucket — so only sum/count (the mean) is obtainable, never p50/p90/p99.

Root cause

The latency instruments are configured as base-2 exponential-histogram views via LatencyViews() / AggregationBase2ExponentialHistogram (internal/adapter/telemetry/metrics.go:50-89), registered on the OTLP provider (internal/adapter/telemetry/otlp.go:182-183). But the --perf admin surface exports via the Prometheus exporter, and the OTel→Prometheus exporter degrades an exponential histogram to sum/count + a lone le="+Inf" classic bucket (classic Prometheus exposition can't represent OTel exponential buckets). The code comment even warns the latency series "degrade silently."

So: the full exponential distribution is available over OTLP (a production collector), but the surface a developer actually reaches for locally — and the perf-MCP server that reduces it — gets means only. The skill/tooling guidance to "read p99 / find the tail" is degenerate here, and the perf-MCP's advertised "p50/p90/p99 bucket upper bounds" collapse to the +Inf bound for these instruments.

(Means were sufficient to conclude "model-bound" in monitoring, but tail-latency analysis is impossible locally — and tail latency is exactly what you'd want the local surface for.)

Options

  1. Register an additional classic explicit-bucket view for the latency instruments on the Prometheus reader specifically (dual-aggregation: exponential for OTLP, explicit buckets for Prom) so /metrics carries real le buckets and quantiles work locally.
  2. Use Prometheus native histograms if the exporter/scrape path supports them.
  3. At minimum, document that the --perf Prometheus surface is sum/count-only for latency and OTLP is required for quantiles (band-aid).

Acceptance

  • /metrics (and the perf-MCP perf://metrics/summary) expose usable p50/p90/p99 for the latency histograms, OR the limitation is explicitly documented in the perf docs/skill.
  • OTLP exponential aggregation is unaffected.

Found via live perf monitoring (every latency histogram showed only le="+Inf"). Related observability gap: TTFT not recorded (#155).

Activity

  1. added
    bug
    on Jun 23, 2026
  2. added a commit that references this issue on Jun 23, 2026
    a7697df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions