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

Add support for TracerDump in TracerFlare #8053

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

mhlidd
Copy link
Contributor

@mhlidd mhlidd commented Dec 4, 2024

What Does This Do

APMAPI-906
Creates a TracerFlare Dump in order to dump traces that have been captured but not yet sent to the agent. This PR introduces a new DUMP_DRAIN element in order to properly extract the pending traces and sends such traces to a JsonExporter in order to write them into the TracerFlare as Json. These traces will be displayed from oldest first and are currently limited to 50 traces in a dump.

Motivation

This PR will help with solving customer issues where traces are captured but not sent to the agent because the root span is never finished/written.

Additional Notes

Contributor Checklist

Jira ticket: APMAPI-906

@pr-commenter
Copy link

pr-commenter bot commented Dec 4, 2024

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mhlidd/pending_traces
git_commit_date 1737572439 1737582245
git_commit_sha 82d8045 0b3278d
release_version 1.46.0-SNAPSHOT~82d80455c5 1.45.0-SNAPSHOT~0b3278dcb9
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1737584790 1737584790
ci_job_id 776866335 776866335
ci_pipeline_id 53749865 53749865
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 15 performance improvements and 15 performance regressions! Performance is the same for 28 metrics, 5 unstable metrics.

scenario Δ mean execution_time candidate mean execution_time baseline mean execution_time
scenario:startup:insecure-bank:iast:Agent.start worse
[+34.362ms; +47.806ms] or [+2.900%; +4.034%]
1.226s 1.185s
scenario:startup:insecure-bank:iast:BytebuddyAgent better
[-22.535ms; -16.755ms] or [-2.703%; -2.010%]
814.003ms 833.649ms
scenario:startup:insecure-bank:iast:GlobalTracer worse
[+60.319ms; +67.888ms] or [+24.432%; +27.497%]
310.991ms 246.888ms
scenario:startup:insecure-bank:iast:Telemetry better
[-1.750ms; -1.206ms] or [-19.625%; -13.526%]
7.438ms 8.916ms
scenario:startup:insecure-bank:iast_HARDCODED_SECRET_DISABLED:Agent.start worse
[+26.880ms; +61.420ms] or [+2.266%; +5.177%]
1.231s 1.186s
scenario:startup:insecure-bank:iast_HARDCODED_SECRET_DISABLED:GlobalTracer worse
[+59.080ms; +66.430ms] or [+23.893%; +26.865%]
310.024ms 247.270ms
scenario:startup:insecure-bank:iast_HARDCODED_SECRET_DISABLED:Remote Config better
[-81.760µs; -41.639µs] or [-12.036%; -6.130%]
617.584µs 679.283µs
scenario:startup:insecure-bank:iast_HARDCODED_SECRET_DISABLED:Telemetry better
[-1.585ms; -1.228ms] or [-17.859%; -13.841%]
7.467ms 8.873ms
scenario:startup:insecure-bank:iast_TELEMETRY_OFF:Agent.start worse
[+32.629ms; +40.273ms] or [+2.760%; +3.406%]
1.219s 1.182s
scenario:startup:insecure-bank:iast_TELEMETRY_OFF:BytebuddyAgent better
[-24.102ms; -18.751ms] or [-2.898%; -2.255%]
810.215ms 831.642ms
scenario:startup:insecure-bank:iast_TELEMETRY_OFF:GlobalTracer worse
[+60.111ms; +61.838ms] or [+24.342%; +25.041%]
307.921ms 246.947ms
scenario:startup:insecure-bank:iast_TELEMETRY_OFF:Remote Config better
[-79.431µs; -17.967µs] or [-11.615%; -2.627%]
635.165µs 683.865µs
scenario:startup:insecure-bank:iast_TELEMETRY_OFF:Telemetry better
[-1.466ms; -1.171ms] or [-16.806%; -13.423%]
7.404ms 8.723ms
scenario:startup:insecure-bank:tracing:Agent.start worse
[+31.531ms; +39.340ms] or [+2.978%; +3.716%]
1.094s 1.059s
scenario:startup:insecure-bank:tracing:BytebuddyAgent better
[-24.027ms; -19.303ms] or [-3.354%; -2.695%]
694.714ms 716.379ms
scenario:startup:insecure-bank:tracing:GlobalTracer worse
[+62.717ms; +64.798ms] or [+24.522%; +25.336%]
319.513ms 255.756ms
scenario:startup:petclinic:appsec:Agent.start worse
[+30.595ms; +46.620ms] or [+2.575%; +3.923%]
1.227s 1.188s
scenario:startup:petclinic:appsec:BytebuddyAgent better
[-22.359ms; -15.671ms] or [-3.060%; -2.145%]
711.634ms 730.649ms
scenario:startup:petclinic:appsec:GlobalTracer worse
[+60.802ms; +66.323ms] or [+24.026%; +26.208%]
316.626ms 253.064ms
scenario:startup:petclinic:appsec:Telemetry better
[-902.325µs; -596.079µs] or [-11.046%; -7.297%]
7.420ms 8.169ms
scenario:startup:petclinic:iast:Agent.start worse
[+30.573ms; +66.072ms] or [+2.584%; +5.584%]
1.231s 1.183s
scenario:startup:petclinic:iast:GlobalTracer worse
[+60.431ms; +66.956ms] or [+24.513%; +27.160%]
310.218ms 246.525ms
scenario:startup:petclinic:iast:Remote Config better
[-72.002µs; -20.853µs] or [-10.786%; -3.124%]
621.102µs 667.530µs
scenario:startup:petclinic:iast:Telemetry better
[-1.338ms; -0.992ms] or [-15.287%; -11.333%]
7.587ms 8.751ms
scenario:startup:petclinic:profiling:Agent.start worse
[+50.631ms; +71.631ms] or [+4.022%; +5.690%]
1.320s 1.259s
scenario:startup:petclinic:profiling:GlobalTracer worse
[+84.636ms; +89.487ms] or [+24.267%; +25.658%]
435.836ms 348.775ms
scenario:startup:petclinic:profiling:Remote Config better
[-94.173µs; -48.674µs] or [-13.002%; -6.720%]
652.853µs 724.276µs
scenario:startup:petclinic:profiling:Telemetry better
[-1116.597µs; -850.091µs] or [-12.734%; -9.695%]
7.785ms 8.769ms
scenario:startup:petclinic:tracing:BytebuddyAgent better
[-39.385ms; -14.816ms] or [-5.438%; -2.046%]
697.174ms 724.274ms
scenario:startup:petclinic:tracing:GlobalTracer worse
[+56.770ms; +65.270ms] or [+21.957%; +25.244%]
319.574ms 258.554ms
Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.45.0-SNAPSHOT~0b3278dcb9, baseline=1.46.0-SNAPSHOT~82d80455c5

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.059 s) : 0, 1058674
Total [baseline] (8.625 s) : 0, 8624574
Agent [candidate] (1.094 s) : 0, 1094109
Total [candidate] (8.628 s) : 0, 8627519
section iast
Agent [baseline] (1.185 s) : 0, 1185036
Total [baseline] (9.209 s) : 0, 9209450
Agent [candidate] (1.226 s) : 0, 1226120
Total [candidate] (9.243 s) : 0, 9242985
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.186 s) : 0, 1186377
Total [baseline] (9.163 s) : 0, 9163255
Agent [candidate] (1.231 s) : 0, 1230527
Total [candidate] (9.202 s) : 0, 9202431
section iast_TELEMETRY_OFF
Agent [baseline] (1.182 s) : 0, 1182278
Total [baseline] (9.182 s) : 0, 9181885
Agent [candidate] (1.219 s) : 0, 1218729
Total [candidate] (9.172 s) : 0, 9171718
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.059 s -
Agent iast 1.185 s 126.362 ms (11.9%)
Agent iast_HARDCODED_SECRET_DISABLED 1.186 s 127.703 ms (12.1%)
Agent iast_TELEMETRY_OFF 1.182 s 123.604 ms (11.7%)
Total tracing 8.625 s -
Total iast 9.209 s 584.876 ms (6.8%)
Total iast_HARDCODED_SECRET_DISABLED 9.163 s 538.681 ms (6.2%)
Total iast_TELEMETRY_OFF 9.182 s 557.312 ms (6.5%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.094 s -
Agent iast 1.226 s 132.011 ms (12.1%)
Agent iast_HARDCODED_SECRET_DISABLED 1.231 s 136.418 ms (12.5%)
Agent iast_TELEMETRY_OFF 1.219 s 124.619 ms (11.4%)
Total tracing 8.628 s -
Total iast 9.243 s 615.466 ms (7.1%)
Total iast_HARDCODED_SECRET_DISABLED 9.202 s 574.911 ms (6.7%)
Total iast_TELEMETRY_OFF 9.172 s 544.198 ms (6.3%)
gantt
    title insecure-bank - break down per module: candidate=1.45.0-SNAPSHOT~0b3278dcb9, baseline=1.46.0-SNAPSHOT~82d80455c5

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (716.379 ms) : 0, 716379
BytebuddyAgent [candidate] (694.714 ms) : 0, 694714
GlobalTracer [baseline] (255.756 ms) : 0, 255756
GlobalTracer [candidate] (319.513 ms) : 0, 319513
AppSec [baseline] (56.602 ms) : 0, 56602
AppSec [candidate] (54.762 ms) : 0, 54762
Remote Config [baseline] (737.468 µs) : 0, 737
Remote Config [candidate] (740.095 µs) : 0, 740
Telemetry [baseline] (14.164 ms) : 0, 14164
Telemetry [candidate] (10.645 ms) : 0, 10645
section iast
BytebuddyAgent [baseline] (833.649 ms) : 0, 833649
BytebuddyAgent [candidate] (814.003 ms) : 0, 814003
GlobalTracer [baseline] (246.888 ms) : 0, 246888
GlobalTracer [candidate] (310.991 ms) : 0, 310991
AppSec [baseline] (58.172 ms) : 0, 58172
AppSec [candidate] (58.318 ms) : 0, 58318
Remote Config [baseline] (661.493 µs) : 0, 661
Remote Config [candidate] (630.138 µs) : 0, 630
Telemetry [baseline] (8.916 ms) : 0, 8916
Telemetry [candidate] (7.438 ms) : 0, 7438
IAST [baseline] (21.735 ms) : 0, 21735
IAST [candidate] (20.916 ms) : 0, 20916
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (834.405 ms) : 0, 834405
BytebuddyAgent [candidate] (819.052 ms) : 0, 819052
GlobalTracer [baseline] (247.27 ms) : 0, 247270
GlobalTracer [candidate] (310.024 ms) : 0, 310024
AppSec [baseline] (58.518 ms) : 0, 58518
AppSec [candidate] (57.444 ms) : 0, 57444
Remote Config [baseline] (679.283 µs) : 0, 679
Remote Config [candidate] (617.584 µs) : 0, 618
Telemetry [baseline] (8.873 ms) : 0, 8873
Telemetry [candidate] (7.467 ms) : 0, 7467
IAST [baseline] (21.579 ms) : 0, 21579
IAST [candidate] (21.917 ms) : 0, 21917
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (831.642 ms) : 0, 831642
BytebuddyAgent [candidate] (810.215 ms) : 0, 810215
GlobalTracer [baseline] (246.947 ms) : 0, 246947
GlobalTracer [candidate] (307.921 ms) : 0, 307921
AppSec [baseline] (58.09 ms) : 0, 58090
AppSec [candidate] (58.116 ms) : 0, 58116
Remote Config [baseline] (683.865 µs) : 0, 684
Remote Config [candidate] (635.165 µs) : 0, 635
Telemetry [baseline] (8.723 ms) : 0, 8723
Telemetry [candidate] (7.404 ms) : 0, 7404
IAST [baseline] (21.161 ms) : 0, 21161
IAST [candidate] (20.669 ms) : 0, 20669
Loading
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.45.0-SNAPSHOT~0b3278dcb9, baseline=1.46.0-SNAPSHOT~82d80455c5

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.07 s) : 0, 1069924
Total [baseline] (10.478 s) : 0, 10477814
Agent [candidate] (1.098 s) : 0, 1097621
Total [candidate] (10.492 s) : 0, 10492315
section appsec
Agent [baseline] (1.188 s) : 0, 1188352
Total [baseline] (10.753 s) : 0, 10752679
Agent [candidate] (1.227 s) : 0, 1226959
Total [candidate] (10.705 s) : 0, 10705496
section iast
Agent [baseline] (1.183 s) : 0, 1183160
Total [baseline] (11.003 s) : 0, 11003132
Agent [candidate] (1.231 s) : 0, 1231482
Total [candidate] (10.987 s) : 0, 10987410
section profiling
Agent [baseline] (1.259 s) : 0, 1258983
Total [baseline] (10.849 s) : 0, 10849101
Agent [candidate] (1.32 s) : 0, 1320113
Total [candidate] (10.897 s) : 0, 10896943
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.07 s -
Agent appsec 1.188 s 118.427 ms (11.1%)
Agent iast 1.183 s 113.235 ms (10.6%)
Agent profiling 1.259 s 189.058 ms (17.7%)
Total tracing 10.478 s -
Total appsec 10.753 s 274.865 ms (2.6%)
Total iast 11.003 s 525.317 ms (5.0%)
Total profiling 10.849 s 371.287 ms (3.5%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.098 s -
Agent appsec 1.227 s 129.338 ms (11.8%)
Agent iast 1.231 s 133.861 ms (12.2%)
Agent profiling 1.32 s 222.492 ms (20.3%)
Total tracing 10.492 s -
Total appsec 10.705 s 213.181 ms (2.0%)
Total iast 10.987 s 495.096 ms (4.7%)
Total profiling 10.897 s 404.628 ms (3.9%)
gantt
    title petclinic - break down per module: candidate=1.45.0-SNAPSHOT~0b3278dcb9, baseline=1.46.0-SNAPSHOT~82d80455c5

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (724.274 ms) : 0, 724274
BytebuddyAgent [candidate] (697.174 ms) : 0, 697174
GlobalTracer [baseline] (258.554 ms) : 0, 258554
GlobalTracer [candidate] (319.574 ms) : 0, 319574
AppSec [baseline] (56.009 ms) : 0, 56009
AppSec [candidate] (54.989 ms) : 0, 54989
Remote Config [baseline] (759.302 µs) : 0, 759
Remote Config [candidate] (731.736 µs) : 0, 732
Telemetry [baseline] (15.142 ms) : 0, 15142
Telemetry [candidate] (11.386 ms) : 0, 11386
section appsec
BytebuddyAgent [baseline] (730.649 ms) : 0, 730649
BytebuddyAgent [candidate] (711.634 ms) : 0, 711634
GlobalTracer [baseline] (253.064 ms) : 0, 253064
GlobalTracer [candidate] (316.626 ms) : 0, 316626
AppSec [baseline] (171.147 ms) : 0, 171147
AppSec [candidate] (167.095 ms) : 0, 167095
Remote Config [baseline] (666.594 µs) : 0, 667
Remote Config [candidate] (646.137 µs) : 0, 646
Telemetry [baseline] (8.169 ms) : 0, 8169
Telemetry [candidate] (7.42 ms) : 0, 7420
IAST [baseline] (19.319 ms) : 0, 19319
IAST [candidate] (19.637 ms) : 0, 19637
section iast
BytebuddyAgent [baseline] (832.675 ms) : 0, 832675
BytebuddyAgent [candidate] (819.604 ms) : 0, 819604
GlobalTracer [baseline] (246.525 ms) : 0, 246525
GlobalTracer [candidate] (310.218 ms) : 0, 310218
AppSec [baseline] (58.119 ms) : 0, 58119
AppSec [candidate] (57.502 ms) : 0, 57502
Remote Config [baseline] (667.53 µs) : 0, 668
Remote Config [candidate] (621.102 µs) : 0, 621
Telemetry [baseline] (8.751 ms) : 0, 8751
Telemetry [candidate] (7.587 ms) : 0, 7587
IAST [baseline] (21.402 ms) : 0, 21402
IAST [candidate] (22.088 ms) : 0, 22088
section profiling
BytebuddyAgent [baseline] (708.158 ms) : 0, 708158
BytebuddyAgent [candidate] (689.659 ms) : 0, 689659
GlobalTracer [baseline] (348.775 ms) : 0, 348775
GlobalTracer [candidate] (435.836 ms) : 0, 435836
AppSec [baseline] (54.734 ms) : 0, 54734
AppSec [candidate] (53.448 ms) : 0, 53448
Remote Config [baseline] (724.276 µs) : 0, 724
Remote Config [candidate] (652.853 µs) : 0, 653
Telemetry [baseline] (8.769 ms) : 0, 8769
Telemetry [candidate] (7.785 ms) : 0, 7785
ProfilingAgent [baseline] (95.574 ms) : 0, 95574
ProfilingAgent [candidate] (93.539 ms) : 0, 93539
Profiling [baseline] (95.599 ms) : 0, 95599
Profiling [candidate] (93.566 ms) : 0, 93566
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
end_time 2025-01-22T21:56:31 2025-01-22T22:03:36
git_branch master mhlidd/pending_traces
git_commit_date 1737572439 1737582245
git_commit_sha 82d8045 0b3278d
release_version 1.46.0-SNAPSHOT~82d80455c5 1.45.0-SNAPSHOT~0b3278dcb9
start_time 2025-01-22T21:56:18 2025-01-22T22:03:22
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1737583771 1737583771
ci_job_id 776866336 776866336
ci_pipeline_id 53749865 53749865
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
variant iast iast

Summary

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

scenario Δ mean http_req_duration Δ mean throughput candidate mean http_req_duration candidate mean throughput baseline mean http_req_duration baseline mean throughput
scenario:load:insecure-bank:iast_FULL better
[-110.081µs; -63.265µs] or [-14.793%; -8.502%]
unstable
[-562.110op/s; +1895.443op/s] or [-9.368%; +31.591%]
657.446µs 6666.667op/s 744.119µs 6000.000op/s
scenario:load:insecure-bank:iast_GLOBAL better
[-66.043µs; -16.953µs] or [-11.619%; -2.983%]
unstable
[-1423.726op/s; +2423.726op/s] or [-18.983%; +32.316%]
526.919µs 8000.000op/s 568.417µs 7500.000op/s
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.45.0-SNAPSHOT~0b3278dcb9, baseline=1.46.0-SNAPSHOT~82d80455c5
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.358 ms) : 1339, 1378
.   : milestone, 1358,
appsec (1.754 ms) : 1730, 1778
.   : milestone, 1754,
appsec_no_iast (1.769 ms) : 1746, 1792
.   : milestone, 1769,
iast (1.5 ms) : 1475, 1524
.   : milestone, 1500,
profiling (1.516 ms) : 1493, 1540
.   : milestone, 1516,
tracing (1.469 ms) : 1444, 1494
.   : milestone, 1469,
section candidate
no_agent (1.351 ms) : 1331, 1370
.   : milestone, 1351,
appsec (1.754 ms) : 1731, 1778
.   : milestone, 1754,
appsec_no_iast (1.765 ms) : 1738, 1791
.   : milestone, 1765,
iast (1.507 ms) : 1484, 1529
.   : milestone, 1507,
profiling (1.536 ms) : 1512, 1559
.   : milestone, 1536,
tracing (1.503 ms) : 1478, 1527
.   : milestone, 1503,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.358 ms [1.339 ms, 1.378 ms] -
appsec 1.754 ms [1.73 ms, 1.778 ms] 396.019 µs (29.2%)
appsec_no_iast 1.769 ms [1.746 ms, 1.792 ms] 410.911 µs (30.2%)
iast 1.5 ms [1.475 ms, 1.524 ms] 141.271 µs (10.4%)
profiling 1.516 ms [1.493 ms, 1.54 ms] 157.935 µs (11.6%)
tracing 1.469 ms [1.444 ms, 1.494 ms] 110.59 µs (8.1%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.351 ms [1.331 ms, 1.37 ms] -
appsec 1.754 ms [1.731 ms, 1.778 ms] 403.886 µs (29.9%)
appsec_no_iast 1.765 ms [1.738 ms, 1.791 ms] 414.051 µs (30.7%)
iast 1.507 ms [1.484 ms, 1.529 ms] 156.268 µs (11.6%)
profiling 1.536 ms [1.512 ms, 1.559 ms] 184.997 µs (13.7%)
tracing 1.503 ms [1.478 ms, 1.527 ms] 151.991 µs (11.3%)
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.45.0-SNAPSHOT~0b3278dcb9, baseline=1.46.0-SNAPSHOT~82d80455c5
    dateFormat X
    axisFormat %s
section baseline
no_agent (382.398 µs) : 362, 403
.   : milestone, 382,
iast (505.962 µs) : 484, 528
.   : milestone, 506,
iast_FULL (744.119 µs) : 722, 766
.   : milestone, 744,
iast_GLOBAL (568.417 µs) : 545, 592
.   : milestone, 568,
iast_HARDCODED_SECRET_DISABLED (511.601 µs) : 490, 534
.   : milestone, 512,
iast_INACTIVE (464.88 µs) : 443, 487
.   : milestone, 465,
iast_TELEMETRY_OFF (495.111 µs) : 474, 517
.   : milestone, 495,
tracing (456.618 µs) : 436, 477
.   : milestone, 457,
section candidate
no_agent (384.477 µs) : 365, 404
.   : milestone, 384,
iast (497.722 µs) : 476, 520
.   : milestone, 498,
iast_FULL (657.446 µs) : 636, 679
.   : milestone, 657,
iast_GLOBAL (526.919 µs) : 505, 549
.   : milestone, 527,
iast_HARDCODED_SECRET_DISABLED (495.955 µs) : 474, 517
.   : milestone, 496,
iast_INACTIVE (460.452 µs) : 439, 482
.   : milestone, 460,
iast_TELEMETRY_OFF (487.029 µs) : 465, 509
.   : milestone, 487,
tracing (454.311 µs) : 433, 475
.   : milestone, 454,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 382.398 µs [361.957 µs, 402.839 µs] -
iast 505.962 µs [484.391 µs, 527.534 µs] 123.564 µs (32.3%)
iast_FULL 744.119 µs [722.146 µs, 766.092 µs] 361.721 µs (94.6%)
iast_GLOBAL 568.417 µs [544.913 µs, 591.92 µs] 186.019 µs (48.6%)
iast_HARDCODED_SECRET_DISABLED 511.601 µs [489.531 µs, 533.672 µs] 129.203 µs (33.8%)
iast_INACTIVE 464.88 µs [443.063 µs, 486.696 µs] 82.482 µs (21.6%)
iast_TELEMETRY_OFF 495.111 µs [473.508 µs, 516.714 µs] 112.713 µs (29.5%)
tracing 456.618 µs [435.767 µs, 477.468 µs] 74.22 µs (19.4%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 384.477 µs [364.979 µs, 403.975 µs] -
iast 497.722 µs [475.832 µs, 519.611 µs] 113.245 µs (29.5%)
iast_FULL 657.446 µs [635.915 µs, 678.977 µs] 272.969 µs (71.0%)
iast_GLOBAL 526.919 µs [504.825 µs, 549.012 µs] 142.442 µs (37.0%)
iast_HARDCODED_SECRET_DISABLED 495.955 µs [474.418 µs, 517.492 µs] 111.478 µs (29.0%)
iast_INACTIVE 460.452 µs [438.616 µs, 482.287 µs] 75.975 µs (19.8%)
iast_TELEMETRY_OFF 487.029 µs [465.323 µs, 508.734 µs] 102.552 µs (26.7%)
tracing 454.311 µs [433.202 µs, 475.419 µs] 69.834 µs (18.2%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mhlidd/pending_traces
git_commit_date 1737572439 1737582245
git_commit_sha 82d8045 0b3278d
release_version 1.46.0-SNAPSHOT~82d80455c5 1.45.0-SNAPSHOT~0b3278dcb9
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1737584349 1737584349
ci_job_id 776866337 776866337
ci_pipeline_id 53749865 53749865
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 biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.45.0-SNAPSHOT~0b3278dcb9, baseline=1.46.0-SNAPSHOT~82d80455c5
    dateFormat X
    axisFormat %s
section baseline
no_agent (14.857 s) : 14857000, 14857000
.   : milestone, 14857000,
appsec (15.186 s) : 15186000, 15186000
.   : milestone, 15186000,
iast (19.062 s) : 19062000, 19062000
.   : milestone, 19062000,
iast_GLOBAL (17.845 s) : 17845000, 17845000
.   : milestone, 17845000,
profiling (15.094 s) : 15094000, 15094000
.   : milestone, 15094000,
tracing (15.005 s) : 15005000, 15005000
.   : milestone, 15005000,
section candidate
no_agent (15.567 s) : 15567000, 15567000
.   : milestone, 15567000,
appsec (15.017 s) : 15017000, 15017000
.   : milestone, 15017000,
iast (18.497 s) : 18497000, 18497000
.   : milestone, 18497000,
iast_GLOBAL (17.984 s) : 17984000, 17984000
.   : milestone, 17984000,
profiling (14.938 s) : 14938000, 14938000
.   : milestone, 14938000,
tracing (14.961 s) : 14961000, 14961000
.   : milestone, 14961000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.857 s [14.857 s, 14.857 s] -
appsec 15.186 s [15.186 s, 15.186 s] 329.0 ms (2.2%)
iast 19.062 s [19.062 s, 19.062 s] 4.205 s (28.3%)
iast_GLOBAL 17.845 s [17.845 s, 17.845 s] 2.988 s (20.1%)
profiling 15.094 s [15.094 s, 15.094 s] 237.0 ms (1.6%)
tracing 15.005 s [15.005 s, 15.005 s] 148.0 ms (1.0%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.567 s [15.567 s, 15.567 s] -
appsec 15.017 s [15.017 s, 15.017 s] -550.0 ms (-3.5%)
iast 18.497 s [18.497 s, 18.497 s] 2.93 s (18.8%)
iast_GLOBAL 17.984 s [17.984 s, 17.984 s] 2.417 s (15.5%)
profiling 14.938 s [14.938 s, 14.938 s] -629.0 ms (-4.0%)
tracing 14.961 s [14.961 s, 14.961 s] -606.0 ms (-3.9%)
Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.45.0-SNAPSHOT~0b3278dcb9, baseline=1.46.0-SNAPSHOT~82d80455c5
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.466 ms) : 1454, 1477
.   : milestone, 1466,
appsec (2.358 ms) : 2315, 2401
.   : milestone, 2358,
iast (2.106 ms) : 2052, 2160
.   : milestone, 2106,
iast_GLOBAL (2.149 ms) : 2095, 2204
.   : milestone, 2149,
profiling (1.946 ms) : 1903, 1989
.   : milestone, 1946,
tracing (1.945 ms) : 1903, 1987
.   : milestone, 1945,
section candidate
no_agent (1.465 ms) : 1454, 1477
.   : milestone, 1465,
appsec (2.34 ms) : 2299, 2382
.   : milestone, 2340,
iast (2.088 ms) : 2036, 2141
.   : milestone, 2088,
iast_GLOBAL (2.131 ms) : 2078, 2184
.   : milestone, 2131,
profiling (1.969 ms) : 1926, 2012
.   : milestone, 1969,
tracing (1.925 ms) : 1885, 1965
.   : milestone, 1925,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.466 ms [1.454 ms, 1.477 ms] -
appsec 2.358 ms [2.315 ms, 2.401 ms] 892.61 µs (60.9%)
iast 2.106 ms [2.052 ms, 2.16 ms] 640.506 µs (43.7%)
iast_GLOBAL 2.149 ms [2.095 ms, 2.204 ms] 683.655 µs (46.6%)
profiling 1.946 ms [1.903 ms, 1.989 ms] 480.231 µs (32.8%)
tracing 1.945 ms [1.903 ms, 1.987 ms] 479.624 µs (32.7%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.465 ms [1.454 ms, 1.477 ms] -
appsec 2.34 ms [2.299 ms, 2.382 ms] 875.135 µs (59.7%)
iast 2.088 ms [2.036 ms, 2.141 ms] 623.19 µs (42.5%)
iast_GLOBAL 2.131 ms [2.078 ms, 2.184 ms] 665.64 µs (45.4%)
profiling 1.969 ms [1.926 ms, 2.012 ms] 503.706 µs (34.4%)
tracing 1.925 ms [1.885 ms, 1.965 ms] 459.717 µs (31.4%)

@mhlidd mhlidd requested a review from PerfectSlayer December 9, 2024 15:13
@PerfectSlayer PerfectSlayer changed the title adding tracerflare.addtext Add pending traces to tracer flare Dec 11, 2024
@mcculls
Copy link
Contributor

mcculls commented Dec 12, 2024

Have you considered tackling this another way, by adding the reporting to DelayingPendingTraceBuffer ? That has all the unfinished (pending) traces not yet sent to the agent. Rather than maintaining a parallel collection of weak references you could just peek into what's in the buffer and write that out - using some limits to avoid sending a massive flare which may be rejected due to its size.

@mhlidd mhlidd force-pushed the mhlidd/pending_traces branch from 4be2999 to 3e4955a Compare December 16, 2024 21:01
}

DumpSupplier supplier = new DumpSupplier(DumpDrain.data);
buffer.queue.fill(supplier, supplier.data.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if filling the queue back with the original element can't be done when handling the dump element.
It would limit having new element inserted in the same time and messing with the queue order. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

If so, does it make sense having the same object implement both Consummer and Supplier?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add this in the new commit!

if (e instanceof PendingTrace) {
PendingTrace trace = (PendingTrace) e;
for (DDSpan span : trace.getSpans()) {
dumpText.append(span.toString()).append("\n");
Copy link
Contributor

Choose a reason for hiding this comment

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

'\n' for single char (instead of using a String object)

@mhlidd mhlidd requested a review from PerfectSlayer December 20, 2024 03:54
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.

Have drain and fill together feels way better! 🙌

Now, about using the collected elements:

  • You can declare your comparator as a private final Comparator<List<Span>> TRACE_BY_START_DATE field so its meaning will be clear and it will only be allocated once
  • You will need to figure out how to filter, limit, and map your elements. I would recommend having a look at the Java Stream API
  • Now you get most of the part in place, try building some tests / triggering your code. You should be able to find some NPE by yourself 😉

@@ -182,11 +242,18 @@ public void run() {

if (pendingTrace instanceof FlushElement) {
// Since this is an MPSC queue, the drain needs to be called on the consumer thread
queue.drain(WriteDrain.WRITE_DRAIN);
queue.drain(WriteDrain.WRITE_DRAIN, 50);
Copy link
Contributor

Choose a reason for hiding this comment

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

Leftover?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm I was trying to use the MPSC drain method that takes in a limit to the number of elements that get drained. Do you think that I should avoid doing this and using the Java stream API instead?


public class TraceDumpWriter implements Writer {

private StringBuilder dumpText;
Copy link
Contributor

Choose a reason for hiding this comment

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

🟠 Code Quality Violation

StringBuilder can lead to memory leaks in long lasting classes (...read more)

StringBuffers and StringBuilders have the potential to grow significantly, which could lead to memory leaks if they are retained within objects with extended lifetimes.

View in Datadog  Leave us feedback  Documentation

@mhlidd mhlidd changed the title Add pending traces to tracer flare Add support for TracerDump in TracerFlare Jan 22, 2025
@mhlidd mhlidd marked this pull request as ready for review January 22, 2025 21:44
@mhlidd mhlidd requested a review from a team as a code owner January 22, 2025 21:44

public class TraceDumpJsonExporter {

private StringBuilder dumpText;
Copy link
Contributor

Choose a reason for hiding this comment

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

🟠 Code Quality Violation

StringBuilder can lead to memory leaks in long lasting classes (...read more)

StringBuffers and StringBuilders have the potential to grow significantly, which could lead to memory leaks if they are retained within objects with extended lifetimes.

View in Datadog  Leave us feedback  Documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants