Commit 1572290
fix:
* Fix _dd.p.ksr formatting to use 6 significant digits without trailing zeros
Replace std::to_string() (which uses sprintf "%f" producing 6 trailing
decimal places) with snprintf "%.6g" which produces up to 6 significant
digits with no trailing zeros. This matches the behavior of Python's
f"{rate:.6g}" and Go's strconv.FormatFloat(rate, 'g', 6, 64).
Examples: 1.0 -> "1", 0.5 -> "0.5", 0.0 -> "0"
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix clang-format violation in trace_segment.cpp
Reformat the emplace_back call to match clang-format's expected style
(arguments on one line with alignment) to fix the verify CI job.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Do not set _dd.p.ksr when using the DEFAULT sampling mechanism
The ksr trace tag should only be set when the sampling decision comes
from an explicit source (agent rate, rule, or remote rule). When the
DEFAULT mechanism is used — meaning no agent configuration has been
received yet — the rate is a hardcoded 100% and ksr is meaningless.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Replace snprintf with std::to_chars for _dd.p.ksr formatting
Address PR feedback: remove format_rate function and use
std::to_chars with std::chars_format::general inline instead
of snprintf.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Update src/datadog/trace_segment.cpp
Co-authored-by: Damien Mehala <damien.mehala@datadoghq.com>
* Apply suggestion from @bm1549
* Fix clang-format violation and logic bug in ksr error handling
Fix two issues introduced by GitHub suggestion commits:
1. Correct the error condition: `ec == std::errc()` means success, not
failure — changed to `ec != std::errc()` to properly detect errors.
2. Fix indentation from 4-space to 2-space to match project style and
pass clang-format checks.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Damien Mehala <damien.mehala@datadoghq.com>_dd.p.ksr formatting to use 6 significant digits without trailing zeros (#288)1 parent f8c3913 commit 1572290
File tree
3 files changed
+41
-16
lines changed- src/datadog
- test
3 files changed
+41
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
321 | 322 | | |
322 | 323 | | |
323 | 324 | | |
324 | | - | |
325 | | - | |
326 | | - | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
327 | 342 | | |
328 | 343 | | |
329 | 344 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
784 | 784 | | |
785 | 785 | | |
786 | 786 | | |
787 | | - | |
788 | | - | |
| 787 | + | |
| 788 | + | |
789 | 789 | | |
790 | 790 | | |
791 | 791 | | |
| |||
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
797 | | - | |
798 | | - | |
| 797 | + | |
| 798 | + | |
799 | 799 | | |
800 | 800 | | |
801 | 801 | | |
| |||
825 | 825 | | |
826 | 826 | | |
827 | 827 | | |
828 | | - | |
| 828 | + | |
829 | 829 | | |
830 | 830 | | |
831 | 831 | | |
| |||
836 | 836 | | |
837 | 837 | | |
838 | 838 | | |
839 | | - | |
| 839 | + | |
840 | 840 | | |
841 | 841 | | |
842 | 842 | | |
| |||
847 | 847 | | |
848 | 848 | | |
849 | 849 | | |
850 | | - | |
| 850 | + | |
851 | 851 | | |
852 | 852 | | |
853 | 853 | | |
| |||
857 | 857 | | |
858 | 858 | | |
859 | 859 | | |
860 | | - | |
| 860 | + | |
861 | 861 | | |
862 | 862 | | |
863 | 863 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
310 | 312 | | |
311 | 313 | | |
312 | 314 | | |
313 | | - | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
314 | 318 | | |
315 | 319 | | |
316 | 320 | | |
| |||
325 | 329 | | |
326 | 330 | | |
327 | 331 | | |
328 | | - | |
| 332 | + | |
| 333 | + | |
329 | 334 | | |
330 | 335 | | |
331 | 336 | | |
| |||
348 | 353 | | |
349 | 354 | | |
350 | 355 | | |
351 | | - | |
| 356 | + | |
| 357 | + | |
352 | 358 | | |
353 | 359 | | |
354 | 360 | | |
| |||
361 | 367 | | |
362 | 368 | | |
363 | 369 | | |
364 | | - | |
| 370 | + | |
365 | 371 | | |
366 | 372 | | |
367 | 373 | | |
| |||
392 | 398 | | |
393 | 399 | | |
394 | 400 | | |
395 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
396 | 406 | | |
397 | 407 | | |
398 | 408 | | |
| |||
0 commit comments