Micrometer
Vendor-neutral metrics facade for JVM applications — analogous to SLF4J for logging but for metrics. Micrometer provides a unified API for recording metrics (Counter, Timer, Gauge, DistributionSummary, LongTaskTimer) and exports to 20+ monitoring backends: Prometheus, Datadog, InfluxDB, CloudWatch, New Relic, Dynatrace, Graphite, and more. Spring Boot Actuator uses Micrometer for all built-in metrics (/actuator/metrics). Micrometer Tracing (formerly Spring Cloud Sleuth) provides distributed tracing alongside metrics. Key concept: meters are tagged for dimensional metrics that Prometheus/Grafana can slice and filter.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Prometheus endpoint (/actuator/prometheus) must be secured in production — exposes internal metrics. API keys for remote registries (Datadog, InfluxDB) via environment variables. Avoid exposing agent business data via metric tags (PII in tag values).
⚡ Reliability
Best When
You're building a Spring Boot or JVM agent service and need production-grade metrics exported to Prometheus/Datadog/InfluxDB — Micrometer is already included in Spring Boot Actuator and requires minimal setup.
Avoid When
You're not on the JVM, you want unified traces+metrics via OpenTelemetry from the start, or your monitoring backend isn't supported (check micrometer.io for registry list).
Use Cases
- • Instrument agent service latency and throughput with Micrometer Timer — record agent request duration with tags for agent_type, status, model to enable Grafana dashboards with dimensional filtering
- • Track agent invocation counts using Micrometer Counter — count successful vs failed agent calls, tool invocations, and LLM API requests with custom tags for alerting thresholds
- • Monitor agent queue depth with Micrometer Gauge — expose live agent task queue size as a Prometheus gauge for autoscaling triggers and capacity planning
- • Export agent service metrics to Prometheus with micrometer-registry-prometheus — Spring Boot Actuator auto-configures /actuator/prometheus endpoint for Prometheus scraping
- • Measure agent data pipeline throughput with DistributionSummary — record bytes processed, items transformed, and agent batch sizes with percentile histograms in Prometheus
Not For
- • Distributed tracing — Micrometer Tracing handles traces but OpenTelemetry is the emerging standard; use OpenTelemetry Java SDK for unified traces + metrics if starting fresh
- • Non-JVM applications — Micrometer is JVM-only; use Prometheus client libraries directly, statsd, or OpenTelemetry SDKs for non-JVM agent services
- • Log aggregation — Micrometer is metrics-only; use SLF4J/Logback for structured logging and ELK/Loki for log aggregation
Interface
Authentication
Micrometer itself needs no auth. Remote registry exports (Datadog, InfluxDB) require API keys configured in application.properties. Prometheus scrapes /actuator/prometheus — secure with Spring Security if exposed externally.
Pricing
Micrometer is Apache 2.0 licensed, maintained by Broadcom/VMware. Free for all use. Backend monitoring services (Datadog, New Relic) have their own pricing.
Agent Metadata
Known Gotchas
- ⚠ High-cardinality tags cause memory explosion — using agent_user_id, session_id, or request_id as tag values creates one time series per unique value; Prometheus keeps all in memory; limit tags to low-cardinality dimensions (agent_type, status, environment)
- ⚠ Timer.record() vs Timer.start/stop — Timer.record(duration) records a completed duration; Timer.Sample sample = Timer.start(registry) followed by sample.stop(timer) measures elapsed wall clock time; using record() with System.currentTimeMillis() is error-prone due to clock choice
- ⚠ Percentile histograms require explicit opt-in — by default Micrometer only records count/sum/max; percentile histograms (p50/p95/p99) require .publishPercentileHistogram() on Timer.Builder; adds significant metric cardinality
- ⚠ MeterRegistry must be injected, not instantiated — auto-configured Spring Boot registry has all reporters wired; manually creating new MeterRegistry bypasses auto-export; always inject MeterRegistry or use static Metrics.globalRegistry with caution
- ⚠ Meter names are dot-separated, not underscore — Micrometer uses dot notation (agent.request.duration); registry adapters transform to backend convention (Prometheus: agent_request_duration_seconds); mixing conventions causes duplicate metrics
- ⚠ Gauge requires strong reference to object — Gauge.builder(name, ref, fn) holds weak reference to measured object; if object is garbage collected, gauge reports NaN; ensure gauged objects have application-scoped lifecycle, not request-scoped
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Micrometer.
Scores are editorial opinions as of 2026-03-06.