Commit 3b59ffa
committed
refactor(spring): extract Observation decorators into shared dapr-spring-boot-observation module
Eliminates the verbatim duplication between dapr-spring-boot-autoconfigure
(Spring Boot 3.x) and dapr-spring-boot-4-autoconfigure (Spring Boot 4.x):
both modules previously held 100%-identical copies of ObservationDaprClient
(~820 LOC) and ObservationDaprWorkflowClient (~400 LOC, including the W3C
traceparent/tracestate formatters, repeated 4 times overall).
Introduces a new Spring-agnostic module dapr-spring/dapr-spring-boot-observation
under package io.dapr.spring.observation.client holding a single canonical copy
of both decorators plus a package-private TraceContextFormat helper that
replaces the 4 duplicated formatter copies. The module has zero Spring imports
so it can be shared safely across Spring Boot 3.x and 4.x without API drift.
Autoconfigure modules now depend on dapr-spring-boot-observation (optional),
replacing their direct opentelemetry-api dependency. Consumers who skip
observation wiring still don't pull OTel onto the classpath.
OtelTracingClientInterceptor is now a private static final singleton on
ObservationDaprWorkflowClient instead of allocated per client — justified by
its existing javadoc which already stated it is stateless and shareable.
Tests for the decorators themselves moved to the new module (33 pass); the
Spring-wiring test DaprClientObservationAutoConfigurationTest stays in boot 3
with updated imports.
Net: -1104 lines.
Signed-off-by: Javier Aliaga <javier@diagrid.io>1 parent 00171b1 commit 3b59ffa
14 files changed
Lines changed: 159 additions & 1263 deletions
File tree
- dapr-spring
- dapr-spring-boot-4-autoconfigure
- src/main/java/io/dapr/spring/boot4/autoconfigure/client
- dapr-spring-boot-autoconfigure
- src
- main/java/io/dapr/spring/boot/autoconfigure/client
- test/java/io/dapr/spring/boot/autoconfigure/client
- dapr-spring-boot-observation
- src
- main/java/io/dapr/spring/observation/client
- test/java/io/dapr/spring/observation/client
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
| 93 | + | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
Lines changed: 0 additions & 818 deletions
This file was deleted.
0 commit comments