Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use unstable sort to group traces in DD exporter. #144

Merged
merged 2 commits into from
Jan 10, 2025

Conversation

mstyura
Copy link
Contributor

@mstyura mstyura commented Jan 2, 2025

Stable sort is not required for grouping, while unstable gives slightly better performance according to opentelemetry-datadog/benches/datadog_exporter.rs

Changes

Changed sort implementation to perform grouping by trace_id to use unstable sort (not preserving order of already sorted items). It has slightly better performance that stable sort while not violating contract of DD api.

Before:

before
Benchmarking export 128 traces with 4 spans: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.9s, enable flat sampling, or reduce sample count to 60.
export 128 traces with 4 spans
                        time:   [1.1379 ms 1.1489 ms 1.1605 ms]
Found 11 outliers among 100 measurements (11.00%)
  7 (7.00%) high mild
  4 (4.00%) high severe

export 256 traces with 4 spans
                        time:   [2.3451 ms 2.3663 ms 2.3889 ms]
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild

export 512 traces with 4 spans
                        time:   [4.9149 ms 4.9865 ms 5.0610 ms]

export 512 traces with 2 spans
                        time:   [2.3401 ms 2.3634 ms 2.3889 ms]
Found 5 outliers among 100 measurements (5.00%)
  4 (4.00%) high mild
  1 (1.00%) high severe

Benchmarking export 512 traces with 1 spans: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.9s, enable flat sampling, or reduce sample count to 60.
export 512 traces with 1 spans
                        time:   [1.1479 ms 1.1569 ms 1.1678 ms]
Found 7 outliers among 100 measurements (7.00%)
  6 (6.00%) high mild
  1 (1.00%) high severe
after
Benchmarking export 128 traces with 4 spans: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.6s, enable flat sampling, or reduce sample count to 60.
export 128 traces with 4 spans
                        time:   [1.0981 ms 1.1063 ms 1.1166 ms]
                        change: [-1.3629% -0.2693% +0.8717%] (p = 0.63 > 0.05)
                        No change in performance detected.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

export 256 traces with 4 spans
                        time:   [2.2418 ms 2.2610 ms 2.2832 ms]
                        change: [-5.6447% -4.4503% -3.1954%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  6 (6.00%) high mild
  5 (5.00%) high severe

export 512 traces with 4 spans
                        time:   [4.6663 ms 4.7158 ms 4.7690 ms]
                        change: [-7.1722% -5.4285% -3.6779%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  7 (7.00%) high mild

export 512 traces with 2 spans
                        time:   [2.2707 ms 2.3037 ms 2.3402 ms]
                        change: [-4.1921% -2.5230% -0.6872%] (p = 0.01 < 0.05)
                        Change within noise threshold.
Found 9 outliers among 100 measurements (9.00%)
  7 (7.00%) high mild
  2 (2.00%) high severe

Benchmarking export 512 traces with 1 spans: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.6s, enable flat sampling, or reduce sample count to 60.
export 512 traces with 1 spans
                        time:   [1.1267 ms 1.1463 ms 1.1705 ms]
                        change: [-3.2121% -2.0460% -0.8733%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 13 outliers among 100 measurements (13.00%)
  8 (8.00%) high mild
  5 (5.00%) high severe
## Merge requirement checklist
  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

Stable sort is not required for routing, while unstable gives slightly better performance according to opentelemetry-datadog/benches/datadog_exporter.rs
@mstyura mstyura requested a review from a team as a code owner January 2, 2025 09:52
Copy link

codecov bot commented Jan 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.1%. Comparing base (2ccb00e) to head (a63c4fa).
Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #144   +/-   ##
=====================================
  Coverage   54.1%   54.1%           
=====================================
  Files         42      42           
  Lines       6276    6276           
=====================================
  Hits        3401    3401           
  Misses      2875    2875           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lalitb lalitb merged commit 0b253eb into open-telemetry:main Jan 10, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants