oscerd opened a new pull request, #24550:
URL: https://github.com/apache/camel/pull/24550
# CAMEL-23848: Camel-PQC — add optional Micrometer metrics/observability
## Motivation
The component previously exposed only a stateful-key health check
(`PQCStatefulKeyHealthCheck`) with no metric-based observability.
## What this does
Adds optional Micrometer metrics to the PQC producer, recorded **only** when
Micrometer is on the
classpath **and** a `MeterRegistry` is available in the Camel registry:
- **`camel.pqc.operations`** (Counter) — tagged `operation` (sign, verify,
generateSecretKeyEncapsulation, extractSecretKeyFromEncapsulation, …),
`algorithm`, and
`outcome` (`success` / `failure`). Incremented around every operation in
`process()`.
- **`camel.pqc.stateful.key.remaining`** (Gauge) — tagged `algorithm`;
remaining signatures for a
stateful signature key (XMSS/XMSSMT/LMS/HSS), sourced from the producer's
runtime key. Registered
only for producers configured with a stateful signature algorithm.
## No hard dependency
`micrometer-core` is added as an **optional** dependency. All
`io.micrometer.*` references are
confined to `PQCMicrometerMetrics`; `PQCProducer` references only the
Micrometer-free `PQCMetrics`
interface (with a `NOOP` default) and instantiates the Micrometer
implementation only after
`ClassResolver.resolveClass("io.micrometer.core.instrument.MeterRegistry")`
confirms Micrometer is
present. So without Micrometer — or without a `MeterRegistry` — metrics are
a no-op with zero
overhead and **no `NoClassDefFoundError`**.
## Testing
`PQCMetricsTest`:
- integration — a route with a bound `SimpleMeterRegistry` records the
sign/verify operation
counters;
- unit — `PQCMicrometerMetrics` counter increments (success/failure), the
stateful-key gauge value,
and meter removal on `close()`.
## Documentation
New *Metrics* section in `pqc-component.adoc` describing the meters, tags
and how to enable them.
## Backport
None — new feature, `main` only (4.22.0).
---
_Claude Code on behalf of Andrea Cosentino._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]