Companion module for the rewritten ankurm.com Prometheus/Grafana monitoring post. Verified against a real running grafana/otel-lgtm container (not mocked): 8 real requests produce a real orders_placed_total metric queried back from the bundled Prometheus-compatible API with zero management.otlp.* properties, auto-wired entirely by Boot's Docker Compose service-connection detection. Two real findings surfaced along the way and documented rather than smoothed over: @Observed silently produces no span without an explicit ObservedAspect bean (AspectJ weaving alone is not sufficient, despite Micrometer Tracing being active), and OTEL_EXPORTER_OTLP_ENDPOINT already worked on Boot 4.0 via Micrometer's own OtlpConfig fallback -- what's actually new in 4.1 is the rest of the standard OTEL_* surface (verified with OTEL_METRIC_EXPORT_INTERVAL against identical source compiled on both Boot 4.0.8 and 4.1.1). Also fixes the root README's module table, which was missing a row for resilience4j-circuit-breaker (added in a previous commit but never indexed here).
1.7 KiB
1.7 KiB
4. Production checklist
Previous: 3. OTEL_* environment variables | README
| Item | This module's finding |
|---|---|
| Which starter | spring-boot-starter-opentelemetry -- one dependency for OTLP metrics + traces, replacing a per-vendor registry jar plus a tracing bridge |
| Local development | A compose.yaml naming grafana/otel-lgtm gets auto-wired by Boot's Docker Compose support with zero management.otlp.* properties -- verified 127.0.0.1, not the bare-default localhost, in the startup log |
| Any other environment | Set the export endpoint explicitly -- either management.otlp.* properties or, as of 4.1, standard OTEL_EXPORTER_OTLP_* variables. Auto-wiring is a dev-time convenience only |
Standard OTEL_* env vars |
OTEL_EXPORTER_OTLP_ENDPOINT worked before 4.1 too (a Micrometer default, not a Boot feature); the rest of the surface -- OTEL_METRIC_EXPORT_INTERVAL and friends -- is genuinely new in 4.1 |
@Observed |
Needs an explicit ObservedAspect @Bean. AspectJ weaving present + Micrometer Tracing active is not sufficient on its own -- the annotation is silently inert without it |
| Trace sampling | Defaults to 0.10. Metrics are never sampled. A "why don't my traces show up" question at low local traffic is very often just this |
| Cardinality, context propagation, the Observation API in depth | Already covered start to finish: Micrometer to OpenTelemetry: The Spring Boot 4 Observability Guide |
License
MIT -- part of the spring-boot-demo container repository; see ../../LICENSE.