Metrics
When the quarkus-micrometer extension is present, JSON-RPC automatically records metrics for every method invocation and tracks active connections and streaming subscriptions across all transports. No configuration or code changes are needed.
Setup
Add the Micrometer extension (with a registry of your choice):
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-micrometer-registry-prometheus</artifactId>
</dependency>
That’s it — metrics are enabled automatically.
Available Metrics
| Metric | Type | Description |
|---|---|---|
|
Timer |
Duration and count of JSON-RPC method invocations. Tagged with |
|
Gauge |
Current number of active connections across all transports. |
|
Gauge |
Current number of active streaming subscriptions ( |
|
Counter |
Number of errors that occurred during active streaming subscriptions. Tagged with |
Example: Prometheus Output
After calling HelloResource#hello a few times and subscribing to a streaming method, the Prometheus endpoint (/q/metrics) will include:
jsonrpc_requests_seconds_count{method="HelloResource#hello",outcome="success"} 5.0
jsonrpc_requests_seconds_sum{method="HelloResource#hello",outcome="success"} 0.042
jsonrpc_active_connections 2.0
jsonrpc_subscriptions_active 1.0
jsonrpc_subscription_errors_total{method="MultiResource#failing"} 0.0