Claus Ibsen created CAMEL-23976:
-----------------------------------

             Summary: Add percentile latency statistics (p50/p95/p99) to 
Extended management statistics
                 Key: CAMEL-23976
                 URL: https://issues.apache.org/jira/browse/CAMEL-23976
             Project: Camel
          Issue Type: Improvement
          Components: camel-management
            Reporter: Claus Ibsen


Currently Camel's ManagedPerformanceCounter only tracks min, max, and mean 
processing time. For monitoring and troubleshooting, percentile latencies (p50, 
p95, p99) are much more useful than mean — they reveal tail latency that 
averages hide.

*Proposal:* when ManagementStatisticsLevel is set to Extended, allocate a 
sliding-window ring buffer (long[1024]) in ManagedPerformanceCounter to record 
recent processing times. On each completedExchange(), write the processing time 
into the buffer (single array write — negligible overhead). Expose new MBean 
methods for p50, p95, p99 that sort the buffer on demand when queried.

*Key design points:*
- Only enabled when statisticsLevel=Extended — zero overhead for 
Default/RoutesOnly/Off
- Sliding window of last 1024 exchanges gives exact percentiles over recent 
activity (no approximation)
- ~8KB memory per route/processor (1024 longs) — negligible
- No external dependency needed (no HDRHistogram library)
- Methods return -1 when Extended is not enabled
- The sliding window approach fits live monitoring use cases (TUI, dev console) 
where "what's happening now" matters more than lifetime cumulative percentiles

*Changes needed:*
- ManagedPerformanceCounterMBean: add getProcessingTimeP50/P95/P99 methods
- ManagedPerformanceCounter: add ring buffer, write in completedExchange(), 
implement percentile computation
- Dev console / TUI can then display these values



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to