dotCMS / dotCMS/core

Micrometer metrics subsystem never initializes, so no dotcms.* metric is ever exported

Open
#36,995 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type : Defect
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:

  1. MetricsInitializer is in no registry. DotInitializationService.getInternalInitializers() (DotInitializationService.java:124-147) enumerates initializers explicitly and does not include it, and there is no META-INF/services/com.dotcms.config.DotInitializer file anywhere in the repo that would register it by service loader.
  2. MetricsService is lazy. It is @ApplicationScoped with 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/health is currently the only working signal for that fault.
  • Related to the unmapped /dotmgt/metrics endpoint, filed separately — both must be fixed for Prometheus scraping to work at all.

Acceptance criteria

  1. The metrics subsystem initializes during startup, by either registering MetricsInitializer in DotInitializationService.getInternalInitializers() or adding the META-INF/services entry — whichever matches the intended pattern for this codebase.
  2. Every MeterBinder has bindTo() called exactly once at startup, verifiable from the logs.
  3. dotcms.* meters are present in the registry after boot.
  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.