Micrometer metrics subsystem never initializes, so no dotcms.* metric is ever exported
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 970
- Forks
- 486
- Avg merge
- 3d 33m
- Merged PRs (30d)
- 170
Description
Problem
The Micrometer metrics subsystem never initializes, so no dotcms.* meter is ever registered or exported. Every metric defined under com/dotcms/metrics/binders/ is dead code at runtime.
Two independent causes, both required for the subsystem to come up:
MetricsInitializeris in no registry.DotInitializationService.getInternalInitializers()(DotInitializationService.java:124-147) enumerates initializers explicitly and does not include it, and there is noMETA-INF/services/com.dotcms.config.DotInitializerfile anywhere in the repo that would register it by service loader.MetricsServiceis lazy. It is@ApplicationScopedwith an@PostConstruct, so CDI does not instantiate it until something injects it. Nothing does during startup.
The net effect is that MeterBinder.bindTo() is never called for any binder — CacheMetrics, and the others alongside it.
Evidence
Observed on a two-node cluster built from main plus the branch for #36803. At startup only RequestTracker logs; no binder logs, and no meter appears anywhere.
Grep confirms the wiring gap:
$ grep -rn "MetricsInitializer" dotCMS/src/main/java/com/dotcms/config/DotInitializationService.java
(no matches)
$ find . -name "com.dotcms.config.DotInitializer" -path "*META-INF/services*"
(no matches)
Impact
- Any dashboard or alert built on a
dotcms.*metric silently reports nothing rather than failing loudly. - Directly affects #36803: that PR adds
dotcms.cache.transport.*gauges for cluster cache-invalidation loss. They are correct but inert until this is fixed, so the health check at/dotmgt/healthis currently the only working signal for that fault. - Related to the unmapped
/dotmgt/metricsendpoint, filed separately — both must be fixed for Prometheus scraping to work at all.
Acceptance criteria
- The metrics subsystem initializes during startup, by either registering
MetricsInitializerinDotInitializationService.getInternalInitializers()or adding theMETA-INF/servicesentry — whichever matches the intended pattern for this codebase. - Every
MeterBinderhasbindTo()called exactly once at startup, verifiable from the logs. dotcms.*meters are present in the registry after boot.- Startup cost of binding is measured and noted; binders must not add meaningful boot latency.
Notes
Not caused by #36803 or #36864 — pre-existing, found while verifying them. Worth checking with whoever added the metrics subsystem whether it was ever wired in a branch that did not merge.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with DotInitializationService.java:124-147 and the MetricsInitializer and MetricsService classes, then inspect the binders under com/dotcms/metrics/binders/. Wire initialization using the registry pattern supported by the repository, verify each MeterBinder binds once and dotcms.* meters appear after boot, and record the startup binding cost.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100