|
Dirac is at |
On the application side, migrating to Dirac is trivial: Dirac strictly consumes the standard annotations org.eclipse.microprofile.metrics.annotation.*. No proprietary import to replace. The deltas live in configuration, packaging and default exposition format.
From SmallRye Metrics
SmallRye Metrics is the reference implementation in Quarkus and some Jakarta EE servers. Direct migration — Dirac targets strict conformance to the same spec.
| SmallRye Metrics | Dirac | Note |
|---|---|---|
Annotations |
Same annotations |
No application-code change. |
|
|
Identical. OpenMetrics/JSON content negotiation identical. |
|
|
Percentiles and buckets: identical keys, read from system properties or |
Dependencies: Micrometer, HdrHistogram, Jackson… |
None (hand-written formatters) |
Smaller classpath footprint. Immediate jlink compatibility (M9). |
JSON format via Jackson |
JSON format via hand-written |
No external JSON engine — check clients that rely on key ordering. |
From Micrometer
Micrometer is the default instrumentation API for Spring Boot. Migrating to MP Metrics implies swapping the application-side API.
| Micrometer | Dirac (MP Metrics) | Note |
|---|---|---|
|
|
Import change. Same semantics. |
|
|
Different programmatic API, equivalent behaviour. |
|
|
Injection via |
Backend-specific exporters (Prometheus, Datadog, StatsD…) |
Native OpenMetrics text + JSON |
For other backends, plug a Prometheus scraper → destination exporter. |
From Dropwizard Metrics
Dropwizard is the ancestor of much of the MP Metrics spec. Two-step migration: change the API, then expose.
| Dropwizard | Dirac (MP Metrics) | Note |
|---|---|---|
|
|
Tags concept absent in Dropwizard — switch to MP tags. |
|
|
Equivalent runtime API; prefer the annotation for CDI-intercepted code. |
|
|
Identical. Percentiles configured via |
Exposition via |
Native OpenMetrics + JSON exposition on |
Drop the adapter and the servlet — the MP Metrics endpoint suffices. |
Gotchas
-
No
Meter, noConcurrentGauge, noSimpleTimer— removed in MP Metrics 5.0. Replace withCounter+Timeras appropriate. -
@Histogram(annotation) — absent from themicroprofile-metrics-api:5.1.1JAR used by Dirac. Declare histograms programmatically viaMetricRegistry.histogram(…). -
No
setAccessible(true)— if application code relied on non-public classes scanned by a permissive scanner, Dirac will not reach them. Make typespublicor addopensin the applicationmodule-info. -
Fixed endpoint —
/metricsis mandated by the spec. To publish at another path, add a JAX-RS alias on the application side. -
Global tags not implemented —
mp.metrics.tagsandmp.metrics.appNameare not read by Dirac, and nomp_scopelabel is emitted (the registry rejectsmp_scope/mp_appas user tags). If the previous stack relied on global tags, declare the tags on each metric instead.
Porting checklist
-
Declare
dirac-core+dirac-cdi-vauban+dirac-restinstead of SmallRye / Micrometer / Dropwizard. -
Replace proprietary imports (
io.micrometer.,com.codahale.,io.smallrye.metrics.) withorg.eclipse.microprofile.metrics.. -
Migrate proprietary properties to
mp.metrics.*keys (Reference). -
Run
./mvnw testthen./run-official-tck-mp-metrics-5.1.sh all. -
Compare OpenMetrics output before/after — check canonical names, per-metric tags, units, the
_total/_secondssample suffixes and the final# EOFmarker.