Files
spring-boot-demo/observability/docs/output/00-docker-compose-auto-wiring.txt
T
Claude 03bdf7ee87 Add observability: real OTLP metrics/traces to grafana/otel-lgtm, Docker Compose auto-wiring, and a dual-version (Boot 4.0 vs 4.1) proof of the new OTEL_* env var support
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).
2026-09-18 09:32:34 +00:00

25 lines
1.6 KiB
Plaintext

$ mvn spring-boot:run
...
DockerComposeLifecycleManager : Using Docker Compose file /tmp/obs-module/compose.yaml
DockerCli : Network obs-module_default Creating
DockerCli : Network obs-module_default Created
DockerCli : Container obs-module-lgtm-1 Creating
DockerCli : Container obs-module-lgtm-1 Created
DockerCli : Container obs-module-lgtm-1 Starting
DockerCli : Container obs-module-lgtm-1 Started
DockerCli : Container obs-module-lgtm-1 Waiting
DockerCli : Container obs-module-lgtm-1 Healthy
...
PushMeterRegistry : Publishing metrics for OtlpMeterRegistry every 1m to http://127.0.0.1:4318/v1/metrics with resource attributes {service.name=order-service}
Started ObservabilityApplication in 34.426 seconds (process running for 34.652)
$ docker ps
CONTAINER ID IMAGE COMMAND STATUS PORTS NAMES
4f768a81a102 grafana/otel-lgtm:latest "/otel-lgtm/run-all...." Up 46 seconds (healthy) 0.0.0.0:3000->3000/tcp, 0.0.0.0:3200->3200/tcp, 0.0.0.0:4317-4318->4317-4318/tcp, 0.0.0.0:9090->9090/tcp obs-module-lgtm-1
No management.otlp.* property was set anywhere in application.yml or on the command line for
this run. The endpoint (127.0.0.1:4318) came entirely from Boot's Docker Compose service
connection detecting the grafana/otel-lgtm image named in compose.yaml. Note the literal
"127.0.0.1" -- a plain default (no compose.yaml, no service connection) reports "localhost" for
this same port instead; that difference is the tell for whether auto-wiring actually happened.