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

Refactor agent spans and scopes #8321

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

PerfectSlayer
Copy link
Contributor

@PerfectSlayer PerfectSlayer commented Jan 31, 2025

What Does This Do

This PR extracts and refactors span and scope from tracer.
It introduces the ImmutableSpan implementation as a stub implementation for span mutators (AgentSpan inherits from MutableSpan from public API so it can't be changed), and parent abstract class for NoopSpan (that does nothing), BlackHoleSpan (that stops propagation), and ExtractedSpan (that represents a remove span).

Motivation

Additional Notes

This also contains typo / wording fixes from #8313

I hesitate about introducing an isValid method that checks for span validity (tid != 0& sid != 0) to distinguish noop and black hole span implementations.

Contributor Checklist

Jira ticket: LANGPLAT-293

@PerfectSlayer PerfectSlayer added comp: core Tracer core tag: no release notes Changes to exclude from release notes type: refactoring labels Jan 31, 2025
@PerfectSlayer PerfectSlayer changed the title Extract span and scope implementations from tracer Refactor agent span and scope Jan 31, 2025
@PerfectSlayer PerfectSlayer changed the title Refactor agent span and scope Refactor agent spans and scopes Jan 31, 2025
@PerfectSlayer PerfectSlayer force-pushed the bbujon/context-propagation-step3 branch 2 times, most recently from 47a977e to 9d95fd3 Compare January 31, 2025 17:58
@pr-commenter
Copy link

pr-commenter bot commented Jan 31, 2025

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bbujon/context-propagation-step3
git_commit_date 1738937818 1738943047
git_commit_sha e7dd598 466ff09
release_version 1.47.0-SNAPSHOT~e7dd598ab0 1.47.0-SNAPSHOT~466ff09dae
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1738945620 1738945620
ci_job_id 799227025 799227025
ci_pipeline_id 55262395 55262395
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-ahguadnm-project-304-concurrent-0-uk91sjo0 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:50:46 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux Linux runner-ahguadnm-project-304-concurrent-0-uk91sjo0 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:50:46 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
module Agent Agent
parent None None
variant iast iast

Summary

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

Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.47.0-SNAPSHOT~466ff09dae, baseline=1.47.0-SNAPSHOT~e7dd598ab0

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.052 s) : 0, 1052324
Total [baseline] (8.631 s) : 0, 8631396
Agent [candidate] (1.053 s) : 0, 1052503
Total [candidate] (8.669 s) : 0, 8668768
section iast
Agent [baseline] (1.171 s) : 0, 1171136
Total [baseline] (9.185 s) : 0, 9185065
Agent [candidate] (1.175 s) : 0, 1175272
Total [candidate] (9.215 s) : 0, 9214822
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.17 s) : 0, 1170203
Total [baseline] (9.178 s) : 0, 9178219
Agent [candidate] (1.182 s) : 0, 1182032
Total [candidate] (9.198 s) : 0, 9198298
section iast_TELEMETRY_OFF
Agent [baseline] (1.182 s) : 0, 1181999
Total [baseline] (9.199 s) : 0, 9199373
Agent [candidate] (1.175 s) : 0, 1174876
Total [candidate] (9.212 s) : 0, 9212088
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.052 s -
Agent iast 1.171 s 118.812 ms (11.3%)
Agent iast_HARDCODED_SECRET_DISABLED 1.17 s 117.879 ms (11.2%)
Agent iast_TELEMETRY_OFF 1.182 s 129.674 ms (12.3%)
Total tracing 8.631 s -
Total iast 9.185 s 553.668 ms (6.4%)
Total iast_HARDCODED_SECRET_DISABLED 9.178 s 546.823 ms (6.3%)
Total iast_TELEMETRY_OFF 9.199 s 567.976 ms (6.6%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.053 s -
Agent iast 1.175 s 122.769 ms (11.7%)
Agent iast_HARDCODED_SECRET_DISABLED 1.182 s 129.529 ms (12.3%)
Agent iast_TELEMETRY_OFF 1.175 s 122.373 ms (11.6%)
Total tracing 8.669 s -
Total iast 9.215 s 546.054 ms (6.3%)
Total iast_HARDCODED_SECRET_DISABLED 9.198 s 529.53 ms (6.1%)
Total iast_TELEMETRY_OFF 9.212 s 543.319 ms (6.3%)
gantt
    title insecure-bank - break down per module: candidate=1.47.0-SNAPSHOT~466ff09dae, baseline=1.47.0-SNAPSHOT~e7dd598ab0

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (722.482 ms) : 0, 722482
BytebuddyAgent [candidate] (725.054 ms) : 0, 725054
GlobalTracer [baseline] (244.665 ms) : 0, 244665
GlobalTracer [candidate] (244.56 ms) : 0, 244560
AppSec [baseline] (55.445 ms) : 0, 55445
AppSec [candidate] (55.352 ms) : 0, 55352
Remote Config [baseline] (727.835 µs) : 0, 728
Remote Config [candidate] (714.864 µs) : 0, 715
Telemetry [baseline] (13.705 ms) : 0, 13705
Telemetry [candidate] (11.495 ms) : 0, 11495
section iast
BytebuddyAgent [baseline] (834.158 ms) : 0, 834158
BytebuddyAgent [candidate] (837.683 ms) : 0, 837683
GlobalTracer [baseline] (232.831 ms) : 0, 232831
GlobalTracer [candidate] (233.372 ms) : 0, 233372
IAST [baseline] (22.791 ms) : 0, 22791
IAST [candidate] (22.86 ms) : 0, 22860
AppSec [baseline] (56.856 ms) : 0, 56856
AppSec [candidate] (56.694 ms) : 0, 56694
Remote Config [baseline] (608.609 µs) : 0, 609
Remote Config [candidate] (611.984 µs) : 0, 612
Telemetry [baseline] (8.634 ms) : 0, 8634
Telemetry [candidate] (8.755 ms) : 0, 8755
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (832.962 ms) : 0, 832962
BytebuddyAgent [candidate] (841.97 ms) : 0, 841970
GlobalTracer [baseline] (233.211 ms) : 0, 233211
GlobalTracer [candidate] (234.815 ms) : 0, 234815
IAST [baseline] (22.862 ms) : 0, 22862
IAST [candidate] (23.173 ms) : 0, 23173
AppSec [baseline] (56.628 ms) : 0, 56628
AppSec [candidate] (57.236 ms) : 0, 57236
Remote Config [baseline] (621.394 µs) : 0, 621
Remote Config [candidate] (636.146 µs) : 0, 636
Telemetry [baseline] (8.643 ms) : 0, 8643
Telemetry [candidate] (8.79 ms) : 0, 8790
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (843.119 ms) : 0, 843119
BytebuddyAgent [candidate] (836.641 ms) : 0, 836641
GlobalTracer [baseline] (234.777 ms) : 0, 234777
GlobalTracer [candidate] (234.625 ms) : 0, 234625
IAST [baseline] (25.504 ms) : 0, 25504
IAST [candidate] (26.313 ms) : 0, 26313
AppSec [baseline] (53.882 ms) : 0, 53882
AppSec [candidate] (52.708 ms) : 0, 52708
Remote Config [baseline] (622.193 µs) : 0, 622
Remote Config [candidate] (612.355 µs) : 0, 612
Telemetry [baseline] (8.614 ms) : 0, 8614
Telemetry [candidate] (8.59 ms) : 0, 8590
Loading
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.47.0-SNAPSHOT~466ff09dae, baseline=1.47.0-SNAPSHOT~e7dd598ab0

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.043 s) : 0, 1042662
Total [baseline] (10.459 s) : 0, 10459488
Agent [candidate] (1.064 s) : 0, 1064298
Total [candidate] (10.613 s) : 0, 10612874
section appsec
Agent [baseline] (1.184 s) : 0, 1184171
Total [baseline] (10.758 s) : 0, 10757579
Agent [candidate] (1.185 s) : 0, 1185385
Total [candidate] (10.724 s) : 0, 10724425
section iast
Agent [baseline] (1.178 s) : 0, 1177807
Total [baseline] (10.97 s) : 0, 10969944
Agent [candidate] (1.175 s) : 0, 1175245
Total [candidate] (10.948 s) : 0, 10948289
section profiling
Agent [baseline] (1.27 s) : 0, 1269720
Total [baseline] (10.884 s) : 0, 10884190
Agent [candidate] (1.266 s) : 0, 1266325
Total [candidate] (10.856 s) : 0, 10856496
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.043 s -
Agent appsec 1.184 s 141.509 ms (13.6%)
Agent iast 1.178 s 135.145 ms (13.0%)
Agent profiling 1.27 s 227.057 ms (21.8%)
Total tracing 10.459 s -
Total appsec 10.758 s 298.091 ms (2.8%)
Total iast 10.97 s 510.457 ms (4.9%)
Total profiling 10.884 s 424.702 ms (4.1%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.064 s -
Agent appsec 1.185 s 121.087 ms (11.4%)
Agent iast 1.175 s 110.948 ms (10.4%)
Agent profiling 1.266 s 202.027 ms (19.0%)
Total tracing 10.613 s -
Total appsec 10.724 s 111.55 ms (1.1%)
Total iast 10.948 s 335.415 ms (3.2%)
Total profiling 10.856 s 243.622 ms (2.3%)
gantt
    title petclinic - break down per module: candidate=1.47.0-SNAPSHOT~466ff09dae, baseline=1.47.0-SNAPSHOT~e7dd598ab0

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (716.323 ms) : 0, 716323
BytebuddyAgent [candidate] (729.946 ms) : 0, 729946
GlobalTracer [baseline] (243.555 ms) : 0, 243555
GlobalTracer [candidate] (247.537 ms) : 0, 247537
AppSec [baseline] (55.386 ms) : 0, 55386
AppSec [candidate] (56.153 ms) : 0, 56153
Remote Config [baseline] (714.039 µs) : 0, 714
Remote Config [candidate] (730.236 µs) : 0, 730
Telemetry [baseline] (11.495 ms) : 0, 11495
Telemetry [candidate] (14.434 ms) : 0, 14434
section appsec
BytebuddyAgent [baseline] (732.787 ms) : 0, 732787
BytebuddyAgent [candidate] (733.357 ms) : 0, 733357
GlobalTracer [baseline] (239.996 ms) : 0, 239996
GlobalTracer [candidate] (240.482 ms) : 0, 240482
IAST [baseline] (21.693 ms) : 0, 21693
IAST [candidate] (21.831 ms) : 0, 21831
AppSec [baseline] (176.454 ms) : 0, 176454
AppSec [candidate] (176.522 ms) : 0, 176522
Remote Config [baseline] (657.138 µs) : 0, 657
Remote Config [candidate] (657.976 µs) : 0, 658
Telemetry [baseline] (8.257 ms) : 0, 8257
Telemetry [candidate] (8.278 ms) : 0, 8278
section iast
BytebuddyAgent [baseline] (838.715 ms) : 0, 838715
BytebuddyAgent [candidate] (836.865 ms) : 0, 836865
GlobalTracer [baseline] (234.321 ms) : 0, 234321
GlobalTracer [candidate] (234.105 ms) : 0, 234105
IAST [baseline] (23.014 ms) : 0, 23014
IAST [candidate] (22.841 ms) : 0, 22841
AppSec [baseline] (57.025 ms) : 0, 57025
AppSec [candidate] (56.802 ms) : 0, 56802
Remote Config [baseline] (623.458 µs) : 0, 623
Remote Config [candidate] (617.114 µs) : 0, 617
Telemetry [baseline] (8.806 ms) : 0, 8806
Telemetry [candidate] (8.753 ms) : 0, 8753
section profiling
BytebuddyAgent [baseline] (712.15 ms) : 0, 712150
BytebuddyAgent [candidate] (709.047 ms) : 0, 709047
GlobalTracer [baseline] (354.688 ms) : 0, 354688
GlobalTracer [candidate] (354.675 ms) : 0, 354675
AppSec [baseline] (55.35 ms) : 0, 55350
AppSec [candidate] (54.733 ms) : 0, 54733
Remote Config [baseline] (689.336 µs) : 0, 689
Remote Config [candidate] (699.962 µs) : 0, 700
Telemetry [baseline] (8.854 ms) : 0, 8854
Telemetry [candidate] (9.035 ms) : 0, 9035
ProfilingAgent [baseline] (95.46 ms) : 0, 95460
ProfilingAgent [candidate] (95.815 ms) : 0, 95815
Profiling [baseline] (95.484 ms) : 0, 95484
Profiling [candidate] (95.839 ms) : 0, 95839
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
end_time 2025-02-07T15:56:57 2025-02-07T16:04:02
git_branch master bbujon/context-propagation-step3
git_commit_date 1738937818 1738943047
git_commit_sha e7dd598 466ff09
release_version 1.47.0-SNAPSHOT~e7dd598ab0 1.47.0-SNAPSHOT~466ff09dae
start_time 2025-02-07T15:56:44 2025-02-07T16:03:48
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1738944601 1738944601
ci_job_id 799227026 799227026
ci_pipeline_id 55262395 55262395
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-dchtpgt-project-304-concurrent-0-w9pm5zxt 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:50:46 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux Linux runner-dchtpgt-project-304-concurrent-0-w9pm5zxt 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:50:46 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
variant iast iast

Summary

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

Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.47.0-SNAPSHOT~466ff09dae, baseline=1.47.0-SNAPSHOT~e7dd598ab0
    dateFormat X
    axisFormat %s
section baseline
no_agent (382.322 µs) : 363, 402
.   : milestone, 382,
iast (504.934 µs) : 483, 527
.   : milestone, 505,
iast_FULL (747.82 µs) : 726, 770
.   : milestone, 748,
iast_GLOBAL (548.103 µs) : 527, 570
.   : milestone, 548,
iast_HARDCODED_SECRET_DISABLED (504.018 µs) : 483, 525
.   : milestone, 504,
iast_INACTIVE (462.481 µs) : 441, 484
.   : milestone, 462,
iast_TELEMETRY_OFF (498.8 µs) : 475, 522
.   : milestone, 499,
tracing (453.146 µs) : 432, 474
.   : milestone, 453,
section candidate
no_agent (380.665 µs) : 361, 400
.   : milestone, 381,
iast (501.583 µs) : 480, 523
.   : milestone, 502,
iast_FULL (742.229 µs) : 720, 764
.   : milestone, 742,
iast_GLOBAL (551.974 µs) : 530, 574
.   : milestone, 552,
iast_HARDCODED_SECRET_DISABLED (510.019 µs) : 489, 532
.   : milestone, 510,
iast_INACTIVE (468.318 µs) : 447, 489
.   : milestone, 468,
iast_TELEMETRY_OFF (489.648 µs) : 467, 513
.   : milestone, 490,
tracing (454.847 µs) : 434, 476
.   : milestone, 455,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 382.322 µs [362.699 µs, 401.946 µs] -
iast 504.934 µs [482.909 µs, 526.96 µs] 122.612 µs (32.1%)
iast_FULL 747.82 µs [725.823 µs, 769.817 µs] 365.498 µs (95.6%)
iast_GLOBAL 548.103 µs [526.558 µs, 569.648 µs] 165.781 µs (43.4%)
iast_HARDCODED_SECRET_DISABLED 504.018 µs [482.814 µs, 525.222 µs] 121.696 µs (31.8%)
iast_INACTIVE 462.481 µs [441.119 µs, 483.842 µs] 80.158 µs (21.0%)
iast_TELEMETRY_OFF 498.8 µs [475.385 µs, 522.214 µs] 116.478 µs (30.5%)
tracing 453.146 µs [432.157 µs, 474.135 µs] 70.824 µs (18.5%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 380.665 µs [360.964 µs, 400.365 µs] -
iast 501.583 µs [480.177 µs, 522.99 µs] 120.919 µs (31.8%)
iast_FULL 742.229 µs [720.255 µs, 764.203 µs] 361.564 µs (95.0%)
iast_GLOBAL 551.974 µs [529.585 µs, 574.363 µs] 171.309 µs (45.0%)
iast_HARDCODED_SECRET_DISABLED 510.019 µs [488.52 µs, 531.517 µs] 129.354 µs (34.0%)
iast_INACTIVE 468.318 µs [447.323 µs, 489.314 µs] 87.654 µs (23.0%)
iast_TELEMETRY_OFF 489.648 µs [466.653 µs, 512.643 µs] 108.983 µs (28.6%)
tracing 454.847 µs [433.637 µs, 476.058 µs] 74.183 µs (19.5%)
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.47.0-SNAPSHOT~466ff09dae, baseline=1.47.0-SNAPSHOT~e7dd598ab0
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.352 ms) : 1333, 1371
.   : milestone, 1352,
appsec (1.737 ms) : 1713, 1761
.   : milestone, 1737,
appsec_no_iast (1.767 ms) : 1744, 1789
.   : milestone, 1767,
iast (1.52 ms) : 1496, 1544
.   : milestone, 1520,
profiling (1.514 ms) : 1490, 1538
.   : milestone, 1514,
tracing (1.506 ms) : 1482, 1530
.   : milestone, 1506,
section candidate
no_agent (1.368 ms) : 1348, 1388
.   : milestone, 1368,
appsec (1.749 ms) : 1726, 1771
.   : milestone, 1749,
appsec_no_iast (1.762 ms) : 1739, 1785
.   : milestone, 1762,
iast (1.515 ms) : 1491, 1538
.   : milestone, 1515,
profiling (1.569 ms) : 1545, 1594
.   : milestone, 1569,
tracing (1.502 ms) : 1478, 1526
.   : milestone, 1502,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.352 ms [1.333 ms, 1.371 ms] -
appsec 1.737 ms [1.713 ms, 1.761 ms] 385.3 µs (28.5%)
appsec_no_iast 1.767 ms [1.744 ms, 1.789 ms] 414.548 µs (30.7%)
iast 1.52 ms [1.496 ms, 1.544 ms] 167.854 µs (12.4%)
profiling 1.514 ms [1.49 ms, 1.538 ms] 161.738 µs (12.0%)
tracing 1.506 ms [1.482 ms, 1.53 ms] 153.788 µs (11.4%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.368 ms [1.348 ms, 1.388 ms] -
appsec 1.749 ms [1.726 ms, 1.771 ms] 380.299 µs (27.8%)
appsec_no_iast 1.762 ms [1.739 ms, 1.785 ms] 393.895 µs (28.8%)
iast 1.515 ms [1.491 ms, 1.538 ms] 146.473 µs (10.7%)
profiling 1.569 ms [1.545 ms, 1.594 ms] 200.867 µs (14.7%)
tracing 1.502 ms [1.478 ms, 1.526 ms] 133.716 µs (9.8%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bbujon/context-propagation-step3
git_commit_date 1738937818 1738943047
git_commit_sha e7dd598 466ff09
release_version 1.47.0-SNAPSHOT~e7dd598ab0 1.47.0-SNAPSHOT~466ff09dae
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1738945174 1738945174
ci_job_id 799227027 799227027
ci_pipeline_id 55262395 55262395
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-jitdact9-project-304-concurrent-0-lh327p46 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:50:46 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux Linux runner-jitdact9-project-304-concurrent-0-lh327p46 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:50:46 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
variant appsec appsec

Summary

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

Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.47.0-SNAPSHOT~466ff09dae, baseline=1.47.0-SNAPSHOT~e7dd598ab0
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.473 ms) : 1461, 1484
.   : milestone, 1473,
appsec (2.361 ms) : 2317, 2404
.   : milestone, 2361,
iast (2.1 ms) : 2045, 2155
.   : milestone, 2100,
iast_GLOBAL (2.155 ms) : 2100, 2211
.   : milestone, 2155,
profiling (1.98 ms) : 1935, 2025
.   : milestone, 1980,
tracing (1.94 ms) : 1898, 1982
.   : milestone, 1940,
section candidate
no_agent (1.468 ms) : 1456, 1479
.   : milestone, 1468,
appsec (2.357 ms) : 2314, 2400
.   : milestone, 2357,
iast (2.105 ms) : 2050, 2159
.   : milestone, 2105,
iast_GLOBAL (2.154 ms) : 2098, 2209
.   : milestone, 2154,
profiling (2.464 ms) : 2275, 2653
.   : milestone, 2464,
tracing (1.938 ms) : 1896, 1980
.   : milestone, 1938,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.473 ms [1.461 ms, 1.484 ms] -
appsec 2.361 ms [2.317 ms, 2.404 ms] 887.864 µs (60.3%)
iast 2.1 ms [2.045 ms, 2.155 ms] 626.798 µs (42.6%)
iast_GLOBAL 2.155 ms [2.1 ms, 2.211 ms] 682.527 µs (46.3%)
profiling 1.98 ms [1.935 ms, 2.025 ms] 507.187 µs (34.4%)
tracing 1.94 ms [1.898 ms, 1.982 ms] 466.804 µs (31.7%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.468 ms [1.456 ms, 1.479 ms] -
appsec 2.357 ms [2.314 ms, 2.4 ms] 889.16 µs (60.6%)
iast 2.105 ms [2.05 ms, 2.159 ms] 636.782 µs (43.4%)
iast_GLOBAL 2.154 ms [2.098 ms, 2.209 ms] 685.757 µs (46.7%)
profiling 2.464 ms [2.275 ms, 2.653 ms] 996.186 µs (67.9%)
tracing 1.938 ms [1.896 ms, 1.98 ms] 470.169 µs (32.0%)
Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.47.0-SNAPSHOT~466ff09dae, baseline=1.47.0-SNAPSHOT~e7dd598ab0
    dateFormat X
    axisFormat %s
section baseline
no_agent (14.931 s) : 14931000, 14931000
.   : milestone, 14931000,
appsec (15.088 s) : 15088000, 15088000
.   : milestone, 15088000,
iast (18.707 s) : 18707000, 18707000
.   : milestone, 18707000,
iast_GLOBAL (18.215 s) : 18215000, 18215000
.   : milestone, 18215000,
profiling (15.213 s) : 15213000, 15213000
.   : milestone, 15213000,
tracing (14.927 s) : 14927000, 14927000
.   : milestone, 14927000,
section candidate
no_agent (14.992 s) : 14992000, 14992000
.   : milestone, 14992000,
appsec (15.109 s) : 15109000, 15109000
.   : milestone, 15109000,
iast (19.103 s) : 19103000, 19103000
.   : milestone, 19103000,
iast_GLOBAL (18.019 s) : 18019000, 18019000
.   : milestone, 18019000,
profiling (15.12 s) : 15120000, 15120000
.   : milestone, 15120000,
tracing (15.133 s) : 15133000, 15133000
.   : milestone, 15133000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.931 s [14.931 s, 14.931 s] -
appsec 15.088 s [15.088 s, 15.088 s] 157.0 ms (1.1%)
iast 18.707 s [18.707 s, 18.707 s] 3.776 s (25.3%)
iast_GLOBAL 18.215 s [18.215 s, 18.215 s] 3.284 s (22.0%)
profiling 15.213 s [15.213 s, 15.213 s] 282.0 ms (1.9%)
tracing 14.927 s [14.927 s, 14.927 s] -4.0 ms (-0.0%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.992 s [14.992 s, 14.992 s] -
appsec 15.109 s [15.109 s, 15.109 s] 117.0 ms (0.8%)
iast 19.103 s [19.103 s, 19.103 s] 4.111 s (27.4%)
iast_GLOBAL 18.019 s [18.019 s, 18.019 s] 3.027 s (20.2%)
profiling 15.12 s [15.12 s, 15.12 s] 128.0 ms (0.9%)
tracing 15.133 s [15.133 s, 15.133 s] 141.0 ms (0.9%)

@PerfectSlayer PerfectSlayer force-pushed the bbujon/context-propagation-step3 branch 3 times, most recently from 2a4a5ad to 2bb3c30 Compare February 1, 2025 10:53
@PerfectSlayer PerfectSlayer force-pushed the bbujon/context-propagation-step3 branch from 2bb3c30 to 9b9e1ac Compare February 3, 2025 06:54
@PerfectSlayer PerfectSlayer marked this pull request as ready for review February 3, 2025 08:32
@PerfectSlayer PerfectSlayer requested review from a team as code owners February 3, 2025 08:32
@PerfectSlayer PerfectSlayer requested a review from mcculls February 3, 2025 08:32
noopScopeWrapper = new OtelScope(AgentTracer.NoopAgentScope.INSTANCE);
noopSpanWrapper = new OtelSpan(noopSpan(), this);
noopContextWrapper = new OtelSpanContext(AgentSpanContext.noop());
noopScopeWrapper = new OtelScope(AgentScope.noop());
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO we should have distinct names so they can all be static imported... i.e. AgentScope.noopScope() and AgentSpanContext.noopSpanContext() - having the above mix looks inconsistent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used noop() to be consistent with the other components creating noop implementations.
But you're right, having consistency across the tracing API makes more sense here.
I will:

  1. rename them to contains the returned type
  2. move noopSpan() to AgentSpan as static to increase consistency and remove Java8BytecodeBridge.

We will end up with:

  • AgentSpan.noopSpan()
  • AgentSpanContext.noopSpanContext()
  • AgentScope.noopScope()

All static methods returning a singleton object (not accessible outside the tracking package).
Black hole spans creation will still be left to the tracer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I split the fix in distinct commits:

  • AgentSpan.noopSpan(): 421fc23
  • AgentSpanContext.noopSpanContext(): a8ce0d6
  • AgentScope.noopScope(): d7acd78

@PerfectSlayer PerfectSlayer force-pushed the bbujon/context-propagation-step3 branch 5 times, most recently from 0052c55 to 3c34dc6 Compare February 6, 2025 14:16
@PerfectSlayer
Copy link
Contributor Author

All comments should be addressed now :)

@PerfectSlayer PerfectSlayer requested a review from mcculls February 6, 2025 15:32
@PerfectSlayer PerfectSlayer force-pushed the bbujon/context-propagation-step3 branch 2 times, most recently from 468c214 to 2bc6c39 Compare February 7, 2025 12:26
* Returns the noop span instance.
*
* <p>This instance will always be the same, and can be safely tested using object identity (ie
* {@code =}).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* {@code =}).
* {@code ==}).

Copy link
Contributor

Choose a reason for hiding this comment

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

same change for other javadoc below, i.e. s/=/==/

Copy link
Contributor Author

@PerfectSlayer PerfectSlayer Feb 7, 2025

Choose a reason for hiding this comment

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

I will fix the 3 occurrences

return Context.INSTANCE;
}

public static final class Context extends NoopSpanContext {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public static final class Context extends NoopSpanContext {
static final class Context extends NoopSpanContext {

AFAICT it should be ok to make this package-private

Copy link
Contributor

Choose a reason for hiding this comment

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

Also wondering if we should call it InvalidSpanContext...?

if (this.spanContext instanceof TagContext) {
Map<String, String> tags = ((TagContext) this.spanContext).getTags();
//noinspection unchecked
return (Map<String, Object>) (Map<?, ?>) tags;
Copy link
Contributor

Choose a reason for hiding this comment

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

you can simplify this to return (Map) tags; if you use //noinspection unchecked, rawtypes

Copy link
Contributor

@mcculls mcculls left a comment

Choose a reason for hiding this comment

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

Great clean-up, just some trivial comments

…tracer

Add dedicated noop methods for span, span context and scope
Remove unused eligibleForDropping method
Improve Javadoc
@PerfectSlayer PerfectSlayer force-pushed the bbujon/context-propagation-step3 branch from 2bc6c39 to 466ff09 Compare February 7, 2025 15:45
@PerfectSlayer PerfectSlayer merged commit 3f4b7a8 into master Feb 7, 2025
197 checks passed
@PerfectSlayer PerfectSlayer deleted the bbujon/context-propagation-step3 branch February 7, 2025 16:34
@github-actions github-actions bot added this to the 1.47.0 milestone Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: core Tracer core tag: no release notes Changes to exclude from release notes type: refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants