Commit eb07178
authored
refactor: O11Y-742 - Replaced ConditionalSpanExporter with SpansSampler (#289)
## Summary
This change simplifies the trace exporting pipeline by moving the
filtering responsibility from the exporter (ConditionalSpanExporter) to
the sampler (SpansSampler), which is the more appropriate place for this
logic.
## How did you test this change?
Unit tests
## Are there any deployment considerations?
No
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Moves span filtering to an OpenTelemetry sampler (`SpansSampler`),
removes `ConditionalSpanExporter`, wires sampler into tracer provider,
and updates sampling utilities and tests.
>
> - **Tracing/Sampling**:
> - **Sampler Integration**: Set tracer provider sampler to new
`SpansSampler` in `InstrumentationManager`, controlling normal vs error
spans via options.
> - **Exporter Pipeline**: Remove `ConditionalSpanExporter` usage;
`createSpanExporter` now directly wraps base exporter with
`SamplingTraceExporter`.
> - **API Adjustments**: Update `spanProcessor` type to `SpanProcessor`.
> - **Sampling Utilities**:
> - Update `sampleSpans` to use `SpanData.spanId`/`parentSpanId` and
adjust cloning to merge attributes.
> - **Tests**:
> - Add `SpansSamplerTest` covering sampling decisions and description.
> - Remove `ConditionalSpanExporterTest`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f634859. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent c984f4b commit eb07178
File tree
6 files changed
+127
-303
lines changed- sdk/@launchdarkly/observability-android/lib/src
- main/kotlin/com/launchdarkly/observability
- client
- sampling
- test/kotlin/com/launchdarkly/observability
- client
- sampling
6 files changed
+127
-303
lines changedLines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 12 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
76 | | - | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
169 | 171 | | |
170 | 172 | | |
171 | 173 | | |
172 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
173 | 182 | | |
174 | 183 | | |
175 | 184 | | |
| |||
218 | 227 | | |
219 | 228 | | |
220 | 229 | | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
| 230 | + | |
228 | 231 | | |
229 | 232 | | |
230 | 233 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
0 commit comments