Micrometer Integration¶
The AMPS tracer integrates with Micrometer for distributed tracing using B3 propagation.
Auto-Configuration¶
MicrometerTracingAmpsConfiguration is activated when:
- Micrometer's
Tracerbean is present on the classpath. - The property
spring.micrometer.amps.enabledistrue(default).
Setup¶
Add both dependencies:
<dependency>
<groupId>com.findevglobal.cloud</groupId>
<artifactId>spring-cloud-stream-tracer-amps</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing</artifactId>
</dependency>
No additional configuration is needed. The tracer auto-configures itself.
Disabling¶
To disable Micrometer integration for AMPS while keeping Micrometer active for other components:
Propagation Format¶
The Micrometer integration uses B3 propagation headers:
| Header | Description |
|---|---|
X-B3-TraceId |
128-bit or 64-bit trace identifier |
X-B3-SpanId |
64-bit span identifier |
X-B3-ParentSpanId |
Parent span identifier |
X-B3-Sampled |
Sampling decision (1 or 0) |
These headers are injected into the ampsMessageHeaderParams map and encoded into the AMPS correlation ID.
Span Details¶
The MicrometerTracer creates spans using Micrometer's Tracer and Propagator APIs:
Consumer Span¶
Producer Span¶
Documented Spans¶
The module defines documented spans for Micrometer's span documentation:
| Span Name | Kind | Tag |
|---|---|---|
amps.consumer |
CONSUMER |
amps.topic |
amps.producer |
PRODUCER |
amps.topic |
Example Trace Flow¶
Service A (Producer) Service B (Consumer)
┌─────────────────────┐ ┌─────────────────────┐
│ amps.produce span │──── AMPS ────→ │ amps.consume span │
│ traceId: abc123 │ message │ traceId: abc123 │
│ spanId: def456 │ with B3 │ parentSpanId: def456│
│ topic: orders │ headers │ topic: orders │
└─────────────────────┘ └─────────────────────┘