You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/05/19 18:28:00 UTC
[jira] [Resolved] (CAMEL-23555) Per-operation HTTP metrics for REST services in RestRegistry
[ https://issues.apache.org/jira/browse/CAMEL-23555?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen resolved CAMEL-23555.
---------------------------------
Resolution: Fixed
> Per-operation HTTP metrics for REST services in RestRegistry
> ------------------------------------------------------------
>
> Key: CAMEL-23555
> URL: https://issues.apache.org/jira/browse/CAMEL-23555
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.21.0
>
>
> The RestRegistry tracks REST services (GET /foo, GET /foo/{id}, DELETE /foo/{id}, etc.) but has no per-operation hit counters. This means the TUI HTTP tab and dev console cannot show how many times each individual REST endpoint has been called.
> This is especially important for contract-first (OpenAPI) REST services where all operations share a single route and a single RestOpenApiProcessor — there are no per-operation routes, so the existing RuntimeEndpointRegistry counters only show aggregate totals.
> The fix adds per-operation hit tracking to RestRegistry for both code-first and contract-first REST:
> *Code-first:* DefaultRestRegistry is extended to be an EventNotifier. It listens for ExchangeCreatedEvent, matches by routeId, and increments a per-operation counter. Each code-first REST operation has its own route with a unique routeId, making this straightforward.
> *Contract-first:* RestOpenApiProcessor.process() already resolves which specific OpenAPI operation is being invoked via matchBestPath(). After matching, it calls restRegistry.hit(verb, basePath, path) to record the hit on the correct operation.
> Changes:
> - RestRegistry.RestService: add getHits() method
> - RestRegistry: add hit(method, basePath, path) method
> - DefaultRestRegistry: extend EventNotifierSupport, add AtomicLong counters per RestServiceEntry, routeId index for fast lookup
> - RestOpenApiProcessor: call restRegistry.hit() after operation match
> - RestDevConsole: expose hits in JSON output
--
This message was sent by Atlassian Jira
(v8.20.10#820010)