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

Updating Span Link creation due to header tag propagations for invalid spans #7799

Merged
merged 9 commits into from
Nov 4, 2024

Conversation

mhlidd
Copy link
Contributor

@mhlidd mhlidd commented Oct 17, 2024

What Does This Do

Updates the keys in the Span Link creation to include the attributes field and to only include tracestate when the propagation style is tracecontext. Additionally, wrote a unit test to verify the creation of Span Links when spans passed down through header tags are "invalid" due to differing trace_ids.

Motivation

Currently the implementation of how Span Links are used when DD receives invalid traces are not consistent among libraries. This PR focuses on making the Java library's implementation of Span Links consistent with the following RFC.

Additional Notes

The way that the Java library is sending the traceFlags field is unclear, as there is no real way to differentiate whether a sampling flag is unset, or manually set to 0.

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@pr-commenter
Copy link

pr-commenter bot commented Oct 17, 2024

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mhlidd/tracecontext_inconsistency
git_commit_date 1730731065 1730738630
git_commit_sha 6eac0b8 e3eb2e0
release_version 1.42.0-SNAPSHOT~6eac0b8465 1.43.0-SNAPSHOT~e3eb2e0459
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1730741112 1730741112
ci_job_id 694362723 694362723
ci_pipeline_id 48171225 48171225
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
module Agent Agent
parent None None
variant iast iast

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 53 metrics, 10 unstable metrics.

Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.43.0-SNAPSHOT~e3eb2e0459, baseline=1.42.0-SNAPSHOT~6eac0b8465

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.087 s) : 0, 1086775
Total [baseline] (8.594 s) : 0, 8594493
Agent [candidate] (1.085 s) : 0, 1084973
Total [candidate] (8.596 s) : 0, 8596058
section iast
Agent [baseline] (1.217 s) : 0, 1217320
Total [baseline] (9.206 s) : 0, 9206117
Agent [candidate] (1.21 s) : 0, 1210137
Total [candidate] (9.165 s) : 0, 9164501
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.211 s) : 0, 1210684
Total [baseline] (9.191 s) : 0, 9190637
Agent [candidate] (1.209 s) : 0, 1209082
Total [candidate] (9.127 s) : 0, 9127427
section iast_TELEMETRY_OFF
Agent [baseline] (1.207 s) : 0, 1206696
Total [baseline] (9.152 s) : 0, 9151996
Agent [candidate] (1.223 s) : 0, 1223084
Total [candidate] (9.202 s) : 0, 9202218
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.087 s -
Agent iast 1.217 s 130.545 ms (12.0%)
Agent iast_HARDCODED_SECRET_DISABLED 1.211 s 123.91 ms (11.4%)
Agent iast_TELEMETRY_OFF 1.207 s 119.921 ms (11.0%)
Total tracing 8.594 s -
Total iast 9.206 s 611.623 ms (7.1%)
Total iast_HARDCODED_SECRET_DISABLED 9.191 s 596.144 ms (6.9%)
Total iast_TELEMETRY_OFF 9.152 s 557.503 ms (6.5%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.085 s -
Agent iast 1.21 s 125.163 ms (11.5%)
Agent iast_HARDCODED_SECRET_DISABLED 1.209 s 124.109 ms (11.4%)
Agent iast_TELEMETRY_OFF 1.223 s 138.111 ms (12.7%)
Total tracing 8.596 s -
Total iast 9.165 s 568.443 ms (6.6%)
Total iast_HARDCODED_SECRET_DISABLED 9.127 s 531.37 ms (6.2%)
Total iast_TELEMETRY_OFF 9.202 s 606.16 ms (7.1%)
gantt
    title insecure-bank - break down per module: candidate=1.43.0-SNAPSHOT~e3eb2e0459, baseline=1.42.0-SNAPSHOT~6eac0b8465

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (689.671 ms) : 0, 689671
BytebuddyAgent [candidate] (689.068 ms) : 0, 689068
GlobalTracer [baseline] (317.73 ms) : 0, 317730
GlobalTracer [candidate] (316.865 ms) : 0, 316865
AppSec [baseline] (54.333 ms) : 0, 54333
AppSec [candidate] (54.619 ms) : 0, 54619
Remote Config [baseline] (666.303 µs) : 0, 666
Remote Config [candidate] (677.146 µs) : 0, 677
Telemetry [baseline] (10.588 ms) : 0, 10588
Telemetry [candidate] (9.95 ms) : 0, 9950
section iast
BytebuddyAgent [baseline] (809.402 ms) : 0, 809402
BytebuddyAgent [candidate] (804.158 ms) : 0, 804158
GlobalTracer [baseline] (307.107 ms) : 0, 307107
GlobalTracer [candidate] (305.554 ms) : 0, 305554
AppSec [baseline] (56.407 ms) : 0, 56407
AppSec [candidate] (56.86 ms) : 0, 56860
Remote Config [baseline] (624.581 µs) : 0, 625
Remote Config [candidate] (619.955 µs) : 0, 620
Telemetry [baseline] (7.464 ms) : 0, 7464
Telemetry [candidate] (7.479 ms) : 0, 7479
IAST [baseline] (22.461 ms) : 0, 22461
IAST [candidate] (21.637 ms) : 0, 21637
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (803.622 ms) : 0, 803622
BytebuddyAgent [candidate] (803.543 ms) : 0, 803543
GlobalTracer [baseline] (305.652 ms) : 0, 305652
GlobalTracer [candidate] (305.685 ms) : 0, 305685
AppSec [baseline] (57.455 ms) : 0, 57455
AppSec [candidate] (57.153 ms) : 0, 57153
Remote Config [baseline] (642.095 µs) : 0, 642
Remote Config [candidate] (629.445 µs) : 0, 629
Telemetry [baseline] (7.681 ms) : 0, 7681
Telemetry [candidate] (7.54 ms) : 0, 7540
IAST [baseline] (21.855 ms) : 0, 21855
IAST [candidate] (20.719 ms) : 0, 20719
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (801.452 ms) : 0, 801452
BytebuddyAgent [candidate] (812.962 ms) : 0, 812962
GlobalTracer [baseline] (305.221 ms) : 0, 305221
GlobalTracer [candidate] (309.559 ms) : 0, 309559
AppSec [baseline] (58.053 ms) : 0, 58053
AppSec [candidate] (57.155 ms) : 0, 57155
Remote Config [baseline] (606.723 µs) : 0, 607
Remote Config [candidate] (618.192 µs) : 0, 618
Telemetry [baseline] (7.432 ms) : 0, 7432
Telemetry [candidate] (7.443 ms) : 0, 7443
IAST [baseline] (20.161 ms) : 0, 20161
IAST [candidate] (21.332 ms) : 0, 21332
Loading
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.43.0-SNAPSHOT~e3eb2e0459, baseline=1.42.0-SNAPSHOT~6eac0b8465

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.086 s) : 0, 1086180
Total [baseline] (10.493 s) : 0, 10492980
Agent [candidate] (1.099 s) : 0, 1098927
Total [candidate] (10.461 s) : 0, 10460618
section appsec
Agent [baseline] (1.221 s) : 0, 1221105
Total [baseline] (10.705 s) : 0, 10704883
Agent [candidate] (1.221 s) : 0, 1220513
Total [candidate] (10.67 s) : 0, 10670079
section iast
Agent [baseline] (1.208 s) : 0, 1208144
Total [baseline] (10.885 s) : 0, 10885186
Agent [candidate] (1.217 s) : 0, 1217290
Total [candidate] (11.011 s) : 0, 11011210
section profiling
Agent [baseline] (1.282 s) : 0, 1281962
Total [baseline] (10.784 s) : 0, 10783771
Agent [candidate] (1.28 s) : 0, 1280300
Total [candidate] (10.813 s) : 0, 10812711
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.086 s -
Agent appsec 1.221 s 134.925 ms (12.4%)
Agent iast 1.208 s 121.964 ms (11.2%)
Agent profiling 1.282 s 195.782 ms (18.0%)
Total tracing 10.493 s -
Total appsec 10.705 s 211.904 ms (2.0%)
Total iast 10.885 s 392.207 ms (3.7%)
Total profiling 10.784 s 290.792 ms (2.8%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.099 s -
Agent appsec 1.221 s 121.586 ms (11.1%)
Agent iast 1.217 s 118.363 ms (10.8%)
Agent profiling 1.28 s 181.373 ms (16.5%)
Total tracing 10.461 s -
Total appsec 10.67 s 209.461 ms (2.0%)
Total iast 11.011 s 550.592 ms (5.3%)
Total profiling 10.813 s 352.094 ms (3.4%)
gantt
    title petclinic - break down per module: candidate=1.43.0-SNAPSHOT~e3eb2e0459, baseline=1.42.0-SNAPSHOT~6eac0b8465

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (689.072 ms) : 0, 689072
BytebuddyAgent [candidate] (697.741 ms) : 0, 697741
GlobalTracer [baseline] (317.284 ms) : 0, 317284
GlobalTracer [candidate] (320.947 ms) : 0, 320947
AppSec [baseline] (54.71 ms) : 0, 54710
AppSec [candidate] (54.876 ms) : 0, 54876
Remote Config [baseline] (665.493 µs) : 0, 665
Remote Config [candidate] (674.517 µs) : 0, 675
Telemetry [baseline] (10.717 ms) : 0, 10717
Telemetry [candidate] (10.755 ms) : 0, 10755
section appsec
BytebuddyAgent [baseline] (707.641 ms) : 0, 707641
BytebuddyAgent [candidate] (706.967 ms) : 0, 706967
GlobalTracer [baseline] (314.859 ms) : 0, 314859
GlobalTracer [candidate] (314.953 ms) : 0, 314953
AppSec [baseline] (165.316 ms) : 0, 165316
AppSec [candidate] (166.991 ms) : 0, 166991
IAST [baseline] (21.441 ms) : 0, 21441
IAST [candidate] (19.474 ms) : 0, 19474
Remote Config [baseline] (640.115 µs) : 0, 640
Remote Config [candidate] (634.74 µs) : 0, 635
Telemetry [baseline] (8.155 ms) : 0, 8155
Telemetry [candidate] (7.449 ms) : 0, 7449
section iast
BytebuddyAgent [baseline] (803.247 ms) : 0, 803247
BytebuddyAgent [candidate] (809.727 ms) : 0, 809727
GlobalTracer [baseline] (304.707 ms) : 0, 304707
GlobalTracer [candidate] (307.233 ms) : 0, 307233
AppSec [baseline] (56.938 ms) : 0, 56938
AppSec [candidate] (57.514 ms) : 0, 57514
IAST [baseline] (21.411 ms) : 0, 21411
IAST [candidate] (20.778 ms) : 0, 20778
Remote Config [baseline] (617.45 µs) : 0, 617
Remote Config [candidate] (623.473 µs) : 0, 623
Telemetry [baseline] (7.488 ms) : 0, 7488
Telemetry [candidate] (7.555 ms) : 0, 7555
section profiling
BytebuddyAgent [baseline] (681.439 ms) : 0, 681439
BytebuddyAgent [candidate] (681.318 ms) : 0, 681318
GlobalTracer [baseline] (401.039 ms) : 0, 401039
GlobalTracer [candidate] (400.121 ms) : 0, 400121
AppSec [baseline] (54.558 ms) : 0, 54558
AppSec [candidate] (54.627 ms) : 0, 54627
Remote Config [baseline] (680.017 µs) : 0, 680
Remote Config [candidate] (673.006 µs) : 0, 673
Telemetry [baseline] (12.847 ms) : 0, 12847
Telemetry [candidate] (12.804 ms) : 0, 12804
ProfilingAgent [baseline] (92.249 ms) : 0, 92249
ProfilingAgent [candidate] (91.678 ms) : 0, 91678
Profiling [baseline] (92.272 ms) : 0, 92272
Profiling [candidate] (91.701 ms) : 0, 91701
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
end_time 2024-11-04T16:56:45 2024-11-04T17:05:52
git_branch master mhlidd/tracecontext_inconsistency
git_commit_date 1730731065 1730738630
git_commit_sha 6eac0b8 e3eb2e0
release_version 1.42.0-SNAPSHOT~6eac0b8465 1.43.0-SNAPSHOT~e3eb2e0459
start_time 2024-11-04T16:56:28 2024-11-04T17:05:35
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1730740415 1730740415
ci_job_id 694362725 694362725
ci_pipeline_id 48171225 48171225
cpu_model Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz
variant iast iast

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 7 metrics, 21 unstable metrics.

Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.43.0-SNAPSHOT~e3eb2e0459, baseline=1.42.0-SNAPSHOT~6eac0b8465
    dateFormat X
    axisFormat %s
section baseline
no_agent (446.44 µs) : 417, 476
.   : milestone, 446,
iast (584.282 µs) : 553, 616
.   : milestone, 584,
iast_FULL (832.983 µs) : 800, 866
.   : milestone, 833,
iast_GLOBAL (618.0 µs) : 586, 650
.   : milestone, 618,
iast_HARDCODED_SECRET_DISABLED (585.337 µs) : 552, 619
.   : milestone, 585,
iast_INACTIVE (540.769 µs) : 510, 571
.   : milestone, 541,
iast_TELEMETRY_OFF (578.799 µs) : 546, 611
.   : milestone, 579,
tracing (533.257 µs) : 503, 563
.   : milestone, 533,
section candidate
no_agent (448.604 µs) : 420, 477
.   : milestone, 449,
iast (584.267 µs) : 551, 617
.   : milestone, 584,
iast_FULL (835.233 µs) : 802, 868
.   : milestone, 835,
iast_GLOBAL (624.444 µs) : 593, 656
.   : milestone, 624,
iast_HARDCODED_SECRET_DISABLED (588.28 µs) : 555, 621
.   : milestone, 588,
iast_INACTIVE (539.49 µs) : 509, 570
.   : milestone, 539,
iast_TELEMETRY_OFF (574.063 µs) : 542, 606
.   : milestone, 574,
tracing (532.607 µs) : 503, 563
.   : milestone, 533,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 446.44 µs [417.253 µs, 475.626 µs] -
iast 584.282 µs [552.802 µs, 615.762 µs] 137.842 µs (30.9%)
iast_FULL 832.983 µs [799.909 µs, 866.058 µs] 386.543 µs (86.6%)
iast_GLOBAL 618.0 µs [586.061 µs, 649.938 µs] 171.56 µs (38.4%)
iast_HARDCODED_SECRET_DISABLED 585.337 µs [551.873 µs, 618.8 µs] 138.897 µs (31.1%)
iast_INACTIVE 540.769 µs [510.47 µs, 571.068 µs] 94.329 µs (21.1%)
iast_TELEMETRY_OFF 578.799 µs [546.479 µs, 611.12 µs] 132.36 µs (29.6%)
tracing 533.257 µs [503.139 µs, 563.375 µs] 86.817 µs (19.4%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 448.604 µs [419.827 µs, 477.382 µs] -
iast 584.267 µs [551.468 µs, 617.066 µs] 135.663 µs (30.2%)
iast_FULL 835.233 µs [802.314 µs, 868.151 µs] 386.628 µs (86.2%)
iast_GLOBAL 624.444 µs [593.16 µs, 655.727 µs] 175.839 µs (39.2%)
iast_HARDCODED_SECRET_DISABLED 588.28 µs [555.213 µs, 621.347 µs] 139.676 µs (31.1%)
iast_INACTIVE 539.49 µs [508.625 µs, 570.355 µs] 90.886 µs (20.3%)
iast_TELEMETRY_OFF 574.063 µs [542.365 µs, 605.761 µs] 125.459 µs (28.0%)
tracing 532.607 µs [502.714 µs, 562.5 µs] 84.003 µs (18.7%)
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.43.0-SNAPSHOT~e3eb2e0459, baseline=1.42.0-SNAPSHOT~6eac0b8465
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.686 ms) : 1661, 1712
.   : milestone, 1686,
appsec (2.192 ms) : 2161, 2224
.   : milestone, 2192,
appsec_no_iast (2.183 ms) : 2151, 2215
.   : milestone, 2183,
iast (1.86 ms) : 1830, 1890
.   : milestone, 1860,
profiling (1.955 ms) : 1921, 1988
.   : milestone, 1955,
tracing (1.843 ms) : 1812, 1874
.   : milestone, 1843,
section candidate
no_agent (1.697 ms) : 1672, 1721
.   : milestone, 1697,
appsec (2.195 ms) : 2165, 2225
.   : milestone, 2195,
appsec_no_iast (2.193 ms) : 2161, 2224
.   : milestone, 2193,
iast (1.873 ms) : 1843, 1903
.   : milestone, 1873,
profiling (1.968 ms) : 1935, 2002
.   : milestone, 1968,
tracing (1.877 ms) : 1845, 1909
.   : milestone, 1877,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.686 ms [1.661 ms, 1.712 ms] -
appsec 2.192 ms [2.161 ms, 2.224 ms] 505.998 µs (30.0%)
appsec_no_iast 2.183 ms [2.151 ms, 2.215 ms] 496.354 µs (29.4%)
iast 1.86 ms [1.83 ms, 1.89 ms] 173.553 µs (10.3%)
profiling 1.955 ms [1.921 ms, 1.988 ms] 268.204 µs (15.9%)
tracing 1.843 ms [1.812 ms, 1.874 ms] 156.38 µs (9.3%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.697 ms [1.672 ms, 1.721 ms] -
appsec 2.195 ms [2.165 ms, 2.225 ms] 498.294 µs (29.4%)
appsec_no_iast 2.193 ms [2.161 ms, 2.224 ms] 495.827 µs (29.2%)
iast 1.873 ms [1.843 ms, 1.903 ms] 176.32 µs (10.4%)
profiling 1.968 ms [1.935 ms, 2.002 ms] 271.498 µs (16.0%)
tracing 1.877 ms [1.845 ms, 1.909 ms] 180.216 µs (10.6%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mhlidd/tracecontext_inconsistency
git_commit_date 1730731065 1730738630
git_commit_sha 6eac0b8 e3eb2e0
release_version 1.42.0-SNAPSHOT~6eac0b8465 1.43.0-SNAPSHOT~e3eb2e0459
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1730740484 1730740484
ci_job_id 694362726 694362726
ci_pipeline_id 48171225 48171225
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
variant appsec appsec

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics.

Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.43.0-SNAPSHOT~e3eb2e0459, baseline=1.42.0-SNAPSHOT~6eac0b8465
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.463 ms) : 1452, 1474
.   : milestone, 1463,
appsec (2.341 ms) : 2299, 2382
.   : milestone, 2341,
iast (2.085 ms) : 2032, 2138
.   : milestone, 2085,
iast_GLOBAL (2.136 ms) : 2083, 2189
.   : milestone, 2136,
profiling (1.951 ms) : 1909, 1993
.   : milestone, 1951,
tracing (1.924 ms) : 1884, 1964
.   : milestone, 1924,
section candidate
no_agent (1.467 ms) : 1456, 1478
.   : milestone, 1467,
appsec (2.356 ms) : 2315, 2398
.   : milestone, 2356,
iast (2.077 ms) : 2026, 2129
.   : milestone, 2077,
iast_GLOBAL (2.139 ms) : 2086, 2191
.   : milestone, 2139,
profiling (1.956 ms) : 1914, 1998
.   : milestone, 1956,
tracing (1.925 ms) : 1885, 1965
.   : milestone, 1925,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.463 ms [1.452 ms, 1.474 ms] -
appsec 2.341 ms [2.299 ms, 2.382 ms] 877.56 µs (60.0%)
iast 2.085 ms [2.032 ms, 2.138 ms] 622.065 µs (42.5%)
iast_GLOBAL 2.136 ms [2.083 ms, 2.189 ms] 673.4 µs (46.0%)
profiling 1.951 ms [1.909 ms, 1.993 ms] 487.717 µs (33.3%)
tracing 1.924 ms [1.884 ms, 1.964 ms] 460.74 µs (31.5%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.467 ms [1.456 ms, 1.478 ms] -
appsec 2.356 ms [2.315 ms, 2.398 ms] 889.454 µs (60.6%)
iast 2.077 ms [2.026 ms, 2.129 ms] 610.459 µs (41.6%)
iast_GLOBAL 2.139 ms [2.086 ms, 2.191 ms] 671.792 µs (45.8%)
profiling 1.956 ms [1.914 ms, 1.998 ms] 488.717 µs (33.3%)
tracing 1.925 ms [1.885 ms, 1.965 ms] 458.036 µs (31.2%)
Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.43.0-SNAPSHOT~e3eb2e0459, baseline=1.42.0-SNAPSHOT~6eac0b8465
    dateFormat X
    axisFormat %s
section baseline
no_agent (15.076 s) : 15076000, 15076000
.   : milestone, 15076000,
appsec (15.13 s) : 15130000, 15130000
.   : milestone, 15130000,
iast (18.79 s) : 18790000, 18790000
.   : milestone, 18790000,
iast_GLOBAL (18.139 s) : 18139000, 18139000
.   : milestone, 18139000,
profiling (14.718 s) : 14718000, 14718000
.   : milestone, 14718000,
tracing (15.057 s) : 15057000, 15057000
.   : milestone, 15057000,
section candidate
no_agent (15.664 s) : 15664000, 15664000
.   : milestone, 15664000,
appsec (14.959 s) : 14959000, 14959000
.   : milestone, 14959000,
iast (18.621 s) : 18621000, 18621000
.   : milestone, 18621000,
iast_GLOBAL (18.229 s) : 18229000, 18229000
.   : milestone, 18229000,
profiling (15.775 s) : 15775000, 15775000
.   : milestone, 15775000,
tracing (15.281 s) : 15281000, 15281000
.   : milestone, 15281000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.076 s [15.076 s, 15.076 s] -
appsec 15.13 s [15.13 s, 15.13 s] 54.0 ms (0.4%)
iast 18.79 s [18.79 s, 18.79 s] 3.714 s (24.6%)
iast_GLOBAL 18.139 s [18.139 s, 18.139 s] 3.063 s (20.3%)
profiling 14.718 s [14.718 s, 14.718 s] -358.0 ms (-2.4%)
tracing 15.057 s [15.057 s, 15.057 s] -19.0 ms (-0.1%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.664 s [15.664 s, 15.664 s] -
appsec 14.959 s [14.959 s, 14.959 s] -705.0 ms (-4.5%)
iast 18.621 s [18.621 s, 18.621 s] 2.957 s (18.9%)
iast_GLOBAL 18.229 s [18.229 s, 18.229 s] 2.565 s (16.4%)
profiling 15.775 s [15.775 s, 15.775 s] 111.0 ms (0.7%)
tracing 15.281 s [15.281 s, 15.281 s] -383.0 ms (-2.4%)

@mhlidd mhlidd changed the title adding functionality and testing for attributes in Span Links from co… Updating Span Link creation due to header tag propagations for invalid spans Oct 21, 2024
@mhlidd mhlidd marked this pull request as ready for review October 22, 2024 17:07
@mhlidd mhlidd requested a review from a team as a code owner October 22, 2024 17:07
Copy link
Contributor

@PerfectSlayer PerfectSlayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice additions. I left few questions during the review.

The way that the Java library is sending the traceFlags field is unclear, as there is no real way to differentiate whether a sampling flag is unset, or manually set to 0.

I’m here if you would like to talk about it. Basically, trace context flags are a set a flags, encoding using bit masks on 1 byte type. There is currently only one flag supported, called sampled.

So, there is no such things as set the sampling flag to 0, it’s either the sampled flag is set, or the sampled flag is not set.
Settings the sampled flag will toggle the first bit of the byte to 1. Not settings the sampled flag will leave the byte to 0.

context.addTerminatedContextLink(DDSpanLink.from((ExtractedContext) extracted));
Map<String, String> attributes = new HashMap<>();
attributes.put("reason", "terminated_context");
attributes.put("context_headers", extracted.getPropagationStyle().toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dumb question: where is the spec for this part? Because at some point, context won’t always come from "headers" but message properties too, etc...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are only worried about extracting information from headers here and creating span links for those headers that have inconsistent trace ids. (RFC)

@mhlidd
Copy link
Contributor Author

mhlidd commented Oct 29, 2024

I’m here if you would like to talk about it. Basically, trace context flags are a set a flags, encoding using bit masks on 1 byte type. There is currently only one flag supported, called sampled.

So, there is no such things as set the sampling flag to 0, it’s either the sampled flag is set, or the sampled flag is not set. Settings the sampled flag will toggle the first bit of the byte to 1. Not settings the sampled flag will leave the byte to 0.

I think the important distinction to be made here is that there is a difference between not sampling and sampling unset, since the DD agent may update the sampling state after the span is created if the sampling is unset. Thus, it would be nice to be able to differentiate whether a span is not sampled vs sampling unset. If both are set to 0, there is no way to differentiate the two in the backend, which is also the reason that the bit-shifting was important for v04 encodings. This isn't a feature that is critical to this task, but is more of a nice to have.

@nayeem-kamal nayeem-kamal removed their request for review November 1, 2024 14:11
@PerfectSlayer
Copy link
Contributor

I think the important distinction to be made here is that there is a difference between not sampling and sampling unset, since the DD agent may update the sampling state after the span is created if the sampling is unset. Thus, it would be nice to be able to differentiate whether a span is not sampled vs sampling unset.

What you are describing is the dropped decision from the tracer. But such flag don't exist in tracecontext state, only sampled exist.

If both are set to 0, there is no way to differentiate the two in the backend, which is also the reason that the bit-shifting was important for v04 encodings. This isn't a feature that is critical to this task, but is more of a nice to have.

The v0.4 protocol workaround should not impact the JSON encoding. If they ever come up with a drop flag, we will implement it :)

Copy link
Contributor

@PerfectSlayer PerfectSlayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Don't forget to squash on merge 😉

@mhlidd mhlidd merged commit f49ac98 into master Nov 4, 2024
101 checks passed
@mhlidd mhlidd deleted the mhlidd/tracecontext_inconsistency branch November 4, 2024 19:25
@github-actions github-actions bot added this to the 1.43.0 milestone Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants