Commit fbf2ff6
authored
refactor: introduce granular ObservabilityOptions (#323)
## Summary
Refactor the monolithic `Options` data class into a more granular
`ObservabilityOptions` structure. This change introduces nested classes
for `TracesApi`, `MetricsApi`, and `Instrumentations`, and replaces
boolean flags (`disableLogs`, `disableTraces`, `disableMetrics`,
`disableErrorTracking`).
- `disableLogs` is replaced by `logsApiLevel`, which allows filtering
logs by severity.
- `disableTraces` and `disableErrorTracking` are replaced by `tracesApi`
to control spans and errors separately.
- `disableMetrics` is replaced by the `metricsApi` object.
- Automatic instrumentations like crash reporting and launch time can
now be configured under the `instrumentations` property.
## How did you test this change?
Unit tested
## Are there any deployment considerations?
No
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Introduces ObservabilityOptions with log-level filtering and
per-signal/instrumentation toggles, updating SDK, tests, and sample app
to the new API.
>
> - **Core (SDK)**:
> - Replace `Options` with new ``ObservabilityOptions`` featuring
``TracesApi``, ``MetricsApi``, ``Instrumentations`` and ``LogLevel``.
> - Update
``InstrumentationManager``/``ObservabilityClient``/``ObservabilityContext``/``Observability``
to use new options.
> - Implement severity-based log exporting via ``logsApiLevel``; gate
spans/errors/metrics via ``tracesApi``/``metricsApi``; toggle crash
reporting, activity lifecycle, and launch time instrumentation via
``instrumentations``.
> - Add activity instrumentation suppression and helper to add
launch-time instrumentation; remove legacy disable-flag logic.
> - **E2E/Tests**:
> - Rewrite tests to assert behavior for ``logsApiLevel``, ``tracesApi``
includes (errors/spans), ``metricsApi`` enabled/disabled, and crash
reporting; initialize sampling tests with new options.
> - **Sample app**:
> - Migrate to ``ObservabilityOptions`` in `e2e` app; adjust default log
severity to ``INFO``.
> - **Build**:
> - Minor dependency organization for OTEL Android/Instrumentations.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
d3d187b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 63dcf12 commit fbf2ff6
File tree
13 files changed
+350
-193
lines changed- e2e/android/app/src
- main/java/com/example/androidobservability
- test/java/com/example/androidobservability
- sdk/@launchdarkly/observability-android/lib
- src
- main/kotlin/com/launchdarkly/observability
- api
- client
- plugin
- test/kotlin/com/launchdarkly/observability
- client
- replay
13 files changed
+350
-193
lines changedLines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| |||
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
42 | | - | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
Lines changed: 80 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
| 30 | + | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
| 45 | + | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
51 | 66 | | |
52 | 67 | | |
53 | 68 | | |
54 | 69 | | |
55 | 70 | | |
56 | 71 | | |
57 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
58 | 90 | | |
59 | | - | |
60 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
61 | 95 | | |
62 | 96 | | |
63 | 97 | | |
| |||
72 | 106 | | |
73 | 107 | | |
74 | 108 | | |
75 | | - | |
76 | | - | |
| 109 | + | |
| 110 | + | |
77 | 111 | | |
78 | 112 | | |
79 | 113 | | |
| |||
86 | 120 | | |
87 | 121 | | |
88 | 122 | | |
89 | | - | |
90 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
91 | 126 | | |
92 | 127 | | |
93 | 128 | | |
| |||
99 | 134 | | |
100 | 135 | | |
101 | 136 | | |
102 | | - | |
103 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
104 | 140 | | |
105 | 141 | | |
106 | 142 | | |
| |||
112 | 148 | | |
113 | 149 | | |
114 | 150 | | |
115 | | - | |
116 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
117 | 155 | | |
118 | 156 | | |
119 | 157 | | |
| |||
128 | 166 | | |
129 | 167 | | |
130 | 168 | | |
131 | | - | |
132 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
133 | 173 | | |
134 | 174 | | |
135 | 175 | | |
| |||
148 | 188 | | |
149 | 189 | | |
150 | 190 | | |
151 | | - | |
152 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
153 | 195 | | |
154 | 196 | | |
155 | 197 | | |
| |||
163 | 205 | | |
164 | 206 | | |
165 | 207 | | |
166 | | - | |
167 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
168 | 213 | | |
169 | 214 | | |
170 | 215 | | |
| |||
189 | 234 | | |
190 | 235 | | |
191 | 236 | | |
192 | | - | |
| 237 | + | |
193 | 238 | | |
194 | 239 | | |
195 | | - | |
| 240 | + | |
196 | 241 | | |
197 | 242 | | |
198 | 243 | | |
| |||
216 | 261 | | |
217 | 262 | | |
218 | 263 | | |
219 | | - | |
220 | | - | |
| 264 | + | |
| 265 | + | |
221 | 266 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
226 | 275 | | |
227 | 276 | | |
228 | 277 | | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| |||
203 | 205 | | |
204 | 206 | | |
205 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
206 | 222 | | |
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | | - | |
53 | 52 | | |
54 | 53 | | |
55 | | - | |
| 54 | + | |
56 | 55 | | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
0 commit comments