Commit 2dc6e67
authored
refactor(sampling)!: use sampling from libdatadog [APMSP-3021] (#154)
Moves the sampling code into a separate crate, and uses the moved sampling code from `libdatadog` DataDog/libdatadog#1927
These are the benchmark numbers after DataDog/libdatadog#1977 landed.
### OTel Sampling Benchmarks vs `main`
#### Allocations
| Benchmark | Allocated | Change |
|---|---|---|
| `rule_all_spans_only_rate` | 0.732 KB | ±0.0% (no change) |
| `service_rule_matching` | 0.756 KB | **-92.1%** 🟢 |
| `service_rule_not_matching` | 0.434 KB | -2.9% 🟢 |
| `name_pattern_rule_matching` | 0.746 KB | **-92.2%** 🟢 |
| `name_pattern_rule_not_matching` | 0.460 KB | -7.8% 🟢 |
| `resource_pattern_rule_matching` | 0.502 KB | -7.2% 🟢 |
| `resource_pattern_rule_not_matching` | 0.500 KB | -6.7% 🟢 |
| `tag_rule_matching` | 1.021 KB | **-89.9%** 🟢 |
| `tag_rule_not_matching` | 0.460 KB | -6.5% 🟢 |
| `complex_rule_matching` | 0.477 KB | -9.1% 🟢 |
| `complex_rule_partial_match` | 0.470 KB | -8.2% 🟢 |
| `multiple_rules_first_match` | 0.756 KB | **-92.1%** 🟢 |
| `multiple_rules_last_match` | 0.758 KB | -3.3% 🟢 |
| `many_attributes` | 1.012 KB | **-90.0%** 🟢 |
| `parent_sampled_short_circuit` | ~0 B | no change |
| `parent_not_sampled_short_circuit` | ~0 B | no change |
| `unicode_rule_matching` | 0.496 KB | ±0.0% (no change) |
#### Wall Time
| Benchmark | Time | Change |
|---|---|---|
| `rule_all_spans_only_rate` | 329 ns | -2.9% 🟢 |
| `service_rule_matching` | 461 ns | -14.8% 🟢 |
| `service_rule_not_matching` | 244 ns | -7.6% 🟢 |
| `name_pattern_rule_matching` | 363 ns | -18.0% 🟢 |
| `name_pattern_rule_not_matching` | 177 ns | -14.1% 🟢 |
| `resource_pattern_rule_matching` | 252 ns | -11.0% 🟢 |
| `resource_pattern_rule_not_matching` | 256 ns | -10.7% 🟢 |
| `tag_rule_matching` | 386 ns | -17.5% 🟢 |
| `tag_rule_not_matching` | 204 ns | -13.8% 🟢 |
| `complex_rule_matching` | 386 ns | -10.9% 🟢 |
| `complex_rule_partial_match` | 385 ns | -11.1% 🟢 |
| `multiple_rules_first_match` | 376 ns | -17.6% 🟢 |
| `multiple_rules_last_match` | 510 ns | -6.8% 🟢 |
| `many_attributes` | 392 ns | -16.9% 🟢 |
| `parent_sampled_short_circuit` | 9.2 ns | ~-0.8% (noise) |
| `parent_not_sampled_short_circuit` | 9.2 ns | ~-0.7% (noise) |
| `unicode_rule_matching` | 251 ns | -1.8% 🟢 |
Co-authored-by: bjorn.antonsson <bjorn.antonsson@datadoghq.com>1 parent 4e77aa6 commit 2dc6e67
25 files changed
Lines changed: 1332 additions & 3763 deletions
File tree
- datadog-opentelemetry
- benches
- src
- core
- configuration
- sampling
- tests/integration_tests
- instrumentation
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
Lines changed: 29 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
| |||
79 | 78 | | |
80 | 79 | | |
81 | 80 | | |
82 | | - | |
83 | 81 | | |
84 | 82 | | |
85 | 83 | | |
| |||
100 | 98 | | |
101 | 99 | | |
102 | 100 | | |
103 | | - | |
104 | 101 | | |
105 | 102 | | |
106 | 103 | | |
| |||
121 | 118 | | |
122 | 119 | | |
123 | 120 | | |
124 | | - | |
125 | 121 | | |
126 | 122 | | |
127 | 123 | | |
| |||
140 | 136 | | |
141 | 137 | | |
142 | 138 | | |
143 | | - | |
144 | 139 | | |
145 | 140 | | |
146 | 141 | | |
| |||
159 | 154 | | |
160 | 155 | | |
161 | 156 | | |
162 | | - | |
163 | 157 | | |
164 | 158 | | |
165 | 159 | | |
| |||
181 | 175 | | |
182 | 176 | | |
183 | 177 | | |
184 | | - | |
185 | 178 | | |
186 | 179 | | |
187 | 180 | | |
| |||
203 | 196 | | |
204 | 197 | | |
205 | 198 | | |
206 | | - | |
207 | 199 | | |
208 | 200 | | |
209 | 201 | | |
| |||
225 | 217 | | |
226 | 218 | | |
227 | 219 | | |
228 | | - | |
229 | 220 | | |
230 | 221 | | |
231 | 222 | | |
| |||
247 | 238 | | |
248 | 239 | | |
249 | 240 | | |
250 | | - | |
251 | 241 | | |
252 | 242 | | |
253 | 243 | | |
| |||
272 | 262 | | |
273 | 263 | | |
274 | 264 | | |
275 | | - | |
276 | 265 | | |
277 | 266 | | |
278 | 267 | | |
| |||
298 | 287 | | |
299 | 288 | | |
300 | 289 | | |
301 | | - | |
302 | 290 | | |
303 | 291 | | |
304 | 292 | | |
305 | 293 | | |
306 | 294 | | |
307 | 295 | | |
308 | 296 | | |
309 | | - | |
310 | 297 | | |
311 | 298 | | |
312 | 299 | | |
313 | 300 | | |
314 | 301 | | |
315 | 302 | | |
316 | 303 | | |
317 | | - | |
318 | 304 | | |
319 | 305 | | |
320 | 306 | | |
| |||
337 | 323 | | |
338 | 324 | | |
339 | 325 | | |
340 | | - | |
341 | 326 | | |
342 | 327 | | |
343 | 328 | | |
344 | 329 | | |
345 | 330 | | |
346 | 331 | | |
347 | 332 | | |
348 | | - | |
349 | 333 | | |
350 | 334 | | |
351 | 335 | | |
352 | 336 | | |
353 | 337 | | |
354 | 338 | | |
355 | 339 | | |
356 | | - | |
357 | 340 | | |
358 | 341 | | |
359 | 342 | | |
| |||
375 | 358 | | |
376 | 359 | | |
377 | 360 | | |
378 | | - | |
379 | 361 | | |
380 | 362 | | |
381 | 363 | | |
| |||
400 | 382 | | |
401 | 383 | | |
402 | 384 | | |
403 | | - | |
404 | 385 | | |
405 | 386 | | |
406 | 387 | | |
| |||
414 | 395 | | |
415 | 396 | | |
416 | 397 | | |
417 | | - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
418 | 427 | | |
419 | 428 | | |
420 | 429 | | |
| |||
427 | 436 | | |
428 | 437 | | |
429 | 438 | | |
430 | | - | |
431 | 439 | | |
432 | 440 | | |
433 | 441 | | |
| |||
0 commit comments