Skip to content

fix!: glue sync metrics not exported in HMS deployments (EGDL-8247)#135

Merged
jamespfaulkner merged 10 commits into
mainfrom
fix/EGDL-8247/gluesync-metrics-hms-export
Jun 9, 2026
Merged

fix!: glue sync metrics not exported in HMS deployments (EGDL-8247)#135
jamespfaulkner merged 10 commits into
mainfrom
fix/EGDL-8247/gluesync-metrics-hms-export

Conversation

@jamespfaulkner

@jamespfaulkner jamespfaulkner commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • MetricService.configuredRegistry() now adds a JmxMeterRegistry to Metrics.globalRegistry only when no sub-registry is present (HMS / bare-JVM deployments)
  • In Dronefly (Spring Boot), Micrometer autoconfiguration adds a PrometheusMeterRegistry before listeners are constructed, so the check is a no-op and metrics flow to Prometheus unchanged
  • Added micrometer-registry-jmx dependency; shaded and relocated metrics-jmx/metrics-core and io.micrometer.jmx/io.micrometer.core.instrument.dropwizard to avoid classpath conflicts with Hive's
    bundled Codahale 3.1.0 and Spring Boot's JMX autoconfiguration
  • Removed generated dependency-reduced-pom.xml from git tracking
  • No public API change vs main

Test plan

  • ApiaryGlueSyncTest passes unchanged
  • MetricServiceTest passes — covers counter increment, all metrics pre-registered at zero, unknown counter ignored, and JMX MBeans queryable via platform MBean server
  • HMS deployment: confirm glue_listener_* counters appear in JMX (e.g. via jconsole or :8080/metrics)
  • Dronefly: confirm glue_listener_* counters appear at /actuator/prometheus with no JMX registry added to the global registry

Follow-up (out of scope)

micrometer-registry-prometheus is a declared dependency, which causes the shade-all (HMS) fat JAR to bundle the Prometheus Java client unnecessarily — JMX is the only registry used in HMS. In Dronefly
this also duplicates Prometheus classes on the classpath (same version so no failures, but dead weight). To fix: remove micrometer-registry-prometheus from the declared dependencies and drop
io.prometheus:* from the shade-all artifact includes. Dronefly gets Prometheus through Spring Boot's autoconfiguration, not from our JAR.

Jira: EGDL-8247

🤖 Generated with Claude Code

jamespfaulkner and others added 9 commits June 8, 2026 16:05
MetricService now accepts a MeterRegistry via constructor injection so
the metrics backend is determined by the caller rather than hardcoded to
the global registry. ApiaryGlueSync's default constructor creates a
JmxMeterRegistry, making the glue_listener_* counters visible via JMX
for any attached exporter. A new three-arg constructor allows framework
deployments (e.g. Dronefly/Spring Boot) to inject their own registry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… Hive's 3.x classpath

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
MetricService.configuredRegistry() now adds a JmxMeterRegistry to
Metrics.globalRegistry only when no sub-registry exists (HMS/bare-JVM
deployments). In Dronefly, Spring Boot autoconfiguration adds a
PrometheusMeterRegistry before listeners are constructed, so the check
is a no-op and metrics flow to the existing global registry unchanged.

Shade and relocate metrics-jmx/metrics-core to avoid classpath conflict
with Hive's bundled Codahale 3.1.0. Version remains 8.1.18-SNAPSHOT as
no public API was changed vs main. Remove generated dependency-reduced-pom.xml
from git tracking.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…flict

Spring Boot's JmxMetricsExportAutoConfiguration uses @ConditionalOnClass
(JmxMeterRegistry.class). Without relocation, the shaded JAR exposes
io.micrometer.jmx.JmxMeterRegistry at its original package name, Spring
Boot finds it, tries to instantiate it, and hits a NoSuchMethodError:
the shaded JmxMeterRegistry calls DropwizardMeterRegistry with the
relocated (shaded) Codahale MetricRegistry, but DropwizardMeterRegistry
is loaded from the external micrometer-core JAR which only knows the
unshaded type.

Relocating io.micrometer.jmx and io.micrometer.core.instrument.dropwizard
hides them from Spring Boot's classpath scanning. MetricService (also in
the shaded JAR) has its bytecode rewritten by the shade plugin to use the
relocated classes; the inheritance chain (shaded JmxMeterRegistry ->
shaded DropwizardMeterRegistry -> MeterRegistry) still satisfies
Metrics.addRegistry's MeterRegistry parameter since MeterRegistry itself
is not relocated.

Also pin io.dropwizard.metrics:metrics-jmx version in root dependencyManagement.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jamespfaulkner jamespfaulkner marked this pull request as ready for review June 9, 2026 13:51
@jamespfaulkner jamespfaulkner requested a review from a team as a code owner June 9, 2026 13:51
Remove breaking change classification — no public API changed vs main.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jamespfaulkner jamespfaulkner merged commit 97a0799 into main Jun 9, 2026
1 check passed
@jamespfaulkner jamespfaulkner deleted the fix/EGDL-8247/gluesync-metrics-hms-export branch June 9, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants