Files
..

otel-agent-vs-micrometer

One Spring Boot 4.2.0 application ("orders": a controller, a JDBC repository, an outgoing RestClient call, a business method and a hand-off to another thread), instrumented two ways and compared with real exports to a local OTLP receiver:

  • Agent - the unmodified orders-plain.jar (no tracing dependency) started with -javaagent:opentelemetry-javaagent.jar (2.34.0).
  • Micrometer - the same source built with -Pmicrometer, which adds spring-boot-starter-opentelemetry (Micrometer Tracing + the OpenTelemetry SDK + OTLP export).

Companion to the post OpenTelemetry Java Agent vs Micrometer Tracing in Spring Boot 4: Zero-Code vs In-Code.

Versions

Component Version
Spring Boot 4.2.0 (GA 19 Nov 2026)
Micrometer / Micrometer Tracing / OpenTelemetry SDK (Boot BOM) 1.18.0 / 1.8.0 / 1.68.0
OpenTelemetry Java agent 2.34.0
datasource-micrometer-spring-boot (third party, one scenario) 2.3.1
opentelemetry-proto (sink only) 1.11.1-alpha
JDK Temurin 25.0.5.1

Layout

Path What it is
app/ the Spring Boot application; profile micrometer and jdbc switch the variant
sink/ OtlpSink: a small OTLP/HTTP protobuf receiver that decodes spans and metrics and serves them as text
driver/LoadDriver.java closed-loop load generator used for the overhead run
scripts/lib.sh build, start and stop helpers, and the exact JVM flags for each variant
scripts/run-all.sh regenerates every file in output/
scripts/overhead.sh the startup/CPU/throughput measurement (file 08)
scripts/restclient-missing.sh reproduces the missing RestClient.Builder failure (file 10)

Run it

export JAVA_HOME=<JDK 25>   # Maven 3.9, curl and network access to Maven Central are needed
scripts/run-all.sh          # builds three jars, runs every scenario, writes output/

Ports 18480 (app) and 14418 (sink) are used so that it does not collide with anything on 8080/4318.

Captured output

File Scenario
01-agent-spans.txt agent: span tree and attribute keys
02-micrometer-spans.txt Micrometer, default conventions
03-micrometer-otel-conventions.txt Micrometer with management.observations.conventions=opentelemetry
04-metrics.txt every metric each approach exported, by instrumentation scope
05-thread-handoff.txt context across a thread pool: agent, raw pool, Spring task decorator
06-micrometer-jdbc.txt adding third-party JDBC observation to the Micrometer build
07-both-at-once.txt agent and Micrometer starter in one JVM
08-overhead.txt startup CPU, per-request CPU, throughput, RSS (timing-sensitive)
09-resource.txt resource attributes each approach sends
10-restclient-starter-missing.txt the Boot 4 startup failure without spring-boot-starter-restclient

Files 01-07, 09 and 10 are deterministic apart from ordering; file 08 drifts between runs and was measured on a CPU-contended 2-vCPU sandbox.