Skip to content

Fix timing of appsec.blocked tag setting and double finishes#5777

Merged
cataphract merged 1 commit into
masterfrom
glopes/appsec.blocked-timing
Aug 25, 2023
Merged

Fix timing of appsec.blocked tag setting and double finishes#5777
cataphract merged 1 commit into
masterfrom
glopes/appsec.blocked-timing

Conversation

@cataphract

Copy link
Copy Markdown
Contributor

Makes sure that appsec.blocked is not set after the root span is finished. This is mainly accomplished by moving the responsibility for setting appsec.blocked (by calling effectivelyBlocked) to the blocking function. This is closer to the place where the blocking actually happens and reduces the sprinkling of calls to effectivelyBlocked throughout advices.

Also fix some double finishes of spans.

The tests now can ensure that both the calls to TraceSegment are made before the root span is finished and that there are no double finishes (as long as the second finish happens before the test finishes).

@pr-commenter

pr-commenter Bot commented Aug 24, 2023

Copy link
Copy Markdown

Benchmarks

Startup

Parameters

Baseline Candidate
commit 1.20.0-SNAPSHOT~ccdadbf2de 1.20.0-SNAPSHOT~8f4feb14ad
config baseline candidate
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
module Agent Agent
parent None None
variant appsec appsec

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 62 cases.

Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.20.0-SNAPSHOT~8f4feb14ad, baseline=1.20.0-SNAPSHOT~ccdadbf2de

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (994.129 ms) : 0, 994129
Total [baseline] (8.663 s) : 0, 8663031
Agent [candidate] (988.695 ms) : 0, 988695
Total [candidate] (8.635 s) : 0, 8634504
section appsec
Agent [baseline] (1.079 s) : 0, 1078557
Total [baseline] (8.706 s) : 0, 8706427
Agent [candidate] (1.073 s) : 0, 1072851
Total [candidate] (8.744 s) : 0, 8744324
section iast
Agent [baseline] (1.1 s) : 0, 1099638
Total [baseline] (9.183 s) : 0, 9183145
Agent [candidate] (1.093 s) : 0, 1092655
Total [candidate] (9.244 s) : 0, 9243904
section profiling
Agent [baseline] (1.158 s) : 0, 1158083
Total [baseline] (8.85 s) : 0, 8850490
Agent [candidate] (1.158 s) : 0, 1158094
Total [candidate] (8.884 s) : 0, 8883910
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 994.129 ms -
Agent appsec 1.079 s 84.428 ms (8.5%)
Agent iast 1.1 s 105.51 ms (10.6%)
Agent profiling 1.158 s 163.954 ms (16.5%)
Total tracing 8.663 s -
Total appsec 8.706 s 43.396 ms (0.5%)
Total iast 9.183 s 520.114 ms (6.0%)
Total profiling 8.85 s 187.459 ms (2.2%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 988.695 ms -
Agent appsec 1.073 s 84.156 ms (8.5%)
Agent iast 1.093 s 103.96 ms (10.5%)
Agent profiling 1.158 s 169.399 ms (17.1%)
Total tracing 8.635 s -
Total appsec 8.744 s 109.821 ms (1.3%)
Total iast 9.244 s 609.4 ms (7.1%)
Total profiling 8.884 s 249.407 ms (2.9%)
gantt
    title insecure-bank - break down per module: candidate=1.20.0-SNAPSHOT~8f4feb14ad, baseline=1.20.0-SNAPSHOT~ccdadbf2de

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (616.789 ms) : 0, 616789
BytebuddyAgent [candidate] (613.223 ms) : 0, 613223
GlobalTracer [baseline] (286.179 ms) : 0, 286179
GlobalTracer [candidate] (284.393 ms) : 0, 284393
AppSec [baseline] (49.846 ms) : 0, 49846
AppSec [candidate] (50.194 ms) : 0, 50194
Remote Config [baseline] (664.972 µs) : 0, 665
Remote Config [candidate] (665.185 µs) : 0, 665
Telemetry [baseline] (6.037 ms) : 0, 6037
Telemetry [candidate] (5.974 ms) : 0, 5974
section appsec
BytebuddyAgent [baseline] (615.822 ms) : 0, 615822
BytebuddyAgent [candidate] (612.97 ms) : 0, 612970
GlobalTracer [baseline] (285.838 ms) : 0, 285838
GlobalTracer [candidate] (284.328 ms) : 0, 284328
AppSec [baseline] (135.832 ms) : 0, 135832
AppSec [candidate] (134.805 ms) : 0, 134805
Remote Config [baseline] (721.767 µs) : 0, 722
Remote Config [candidate] (720.751 µs) : 0, 721
Telemetry [baseline] (5.783 ms) : 0, 5783
Telemetry [candidate] (5.736 ms) : 0, 5736
section iast
BytebuddyAgent [baseline] (724.515 ms) : 0, 724515
BytebuddyAgent [candidate] (719.439 ms) : 0, 719439
GlobalTracer [baseline] (272.66 ms) : 0, 272660
GlobalTracer [candidate] (271.418 ms) : 0, 271418
AppSec [baseline] (47.604 ms) : 0, 47604
AppSec [candidate] (47.21 ms) : 0, 47210
IAST [baseline] (14.008 ms) : 0, 14008
IAST [candidate] (13.935 ms) : 0, 13935
Remote Config [baseline] (551.096 µs) : 0, 551
Remote Config [candidate] (559.82 µs) : 0, 560
Telemetry [baseline] (5.725 ms) : 0, 5725
Telemetry [candidate] (5.726 ms) : 0, 5726
section profiling
BytebuddyAgent [baseline] (626.271 ms) : 0, 626271
BytebuddyAgent [candidate] (625.658 ms) : 0, 625658
GlobalTracer [baseline] (346.528 ms) : 0, 346528
GlobalTracer [candidate] (346.527 ms) : 0, 346527
AppSec [baseline] (49.097 ms) : 0, 49097
AppSec [candidate] (49.168 ms) : 0, 49168
Remote Config [baseline] (665.813 µs) : 0, 666
Remote Config [candidate] (644.6 µs) : 0, 645
Telemetry [baseline] (6.017 ms) : 0, 6017
Telemetry [candidate] (5.946 ms) : 0, 5946
ProfilingAgent [baseline] (76.674 ms) : 0, 76674
ProfilingAgent [candidate] (77.211 ms) : 0, 77211
Profiling [baseline] (76.698 ms) : 0, 76698
Profiling [candidate] (77.236 ms) : 0, 77236
Loading
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.20.0-SNAPSHOT~8f4feb14ad, baseline=1.20.0-SNAPSHOT~ccdadbf2de

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (988.909 ms) : 0, 988909
Total [baseline] (9.182 s) : 0, 9182268
Agent [candidate] (988.899 ms) : 0, 988899
Total [candidate] (9.186 s) : 0, 9186194
section appsec
Agent [baseline] (1.077 s) : 0, 1077042
Total [baseline] (9.296 s) : 0, 9296368
Agent [candidate] (1.075 s) : 0, 1075496
Total [candidate] (9.246 s) : 0, 9246214
section iast
Agent [baseline] (1.089 s) : 0, 1089430
Total [baseline] (9.423 s) : 0, 9423390
Agent [candidate] (1.09 s) : 0, 1090416
Total [candidate] (9.424 s) : 0, 9423691
section profiling
Agent [baseline] (1.163 s) : 0, 1162768
Total [baseline] (9.456 s) : 0, 9456311
Agent [candidate] (1.16 s) : 0, 1159677
Total [candidate] (9.479 s) : 0, 9479022
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 988.909 ms -
Agent appsec 1.077 s 88.133 ms (8.9%)
Agent iast 1.089 s 100.521 ms (10.2%)
Agent profiling 1.163 s 173.859 ms (17.6%)
Total tracing 9.182 s -
Total appsec 9.296 s 114.1 ms (1.2%)
Total iast 9.423 s 241.121 ms (2.6%)
Total profiling 9.456 s 274.043 ms (3.0%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 988.899 ms -
Agent appsec 1.075 s 86.597 ms (8.8%)
Agent iast 1.09 s 101.517 ms (10.3%)
Agent profiling 1.16 s 170.779 ms (17.3%)
Total tracing 9.186 s -
Total appsec 9.246 s 60.02 ms (0.7%)
Total iast 9.424 s 237.497 ms (2.6%)
Total profiling 9.479 s 292.829 ms (3.2%)
gantt
    title petclinic - break down per module: candidate=1.20.0-SNAPSHOT~8f4feb14ad, baseline=1.20.0-SNAPSHOT~ccdadbf2de

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (613.591 ms) : 0, 613591
BytebuddyAgent [candidate] (613.141 ms) : 0, 613141
GlobalTracer [baseline] (284.031 ms) : 0, 284031
GlobalTracer [candidate] (284.803 ms) : 0, 284803
AppSec [baseline] (50.209 ms) : 0, 50209
AppSec [candidate] (49.963 ms) : 0, 49963
Remote Config [baseline] (660.912 µs) : 0, 661
Remote Config [candidate] (663.928 µs) : 0, 664
Telemetry [baseline] (6.048 ms) : 0, 6048
Telemetry [candidate] (5.993 ms) : 0, 5993
section appsec
BytebuddyAgent [baseline] (616.36 ms) : 0, 616360
BytebuddyAgent [candidate] (614.037 ms) : 0, 614037
GlobalTracer [baseline] (284.622 ms) : 0, 284622
GlobalTracer [candidate] (285.694 ms) : 0, 285694
AppSec [baseline] (135.019 ms) : 0, 135019
AppSec [candidate] (135.039 ms) : 0, 135039
Remote Config [baseline] (729.062 µs) : 0, 729
Remote Config [candidate] (725.206 µs) : 0, 725
Telemetry [baseline] (5.739 ms) : 0, 5739
Telemetry [candidate] (5.752 ms) : 0, 5752
section iast
BytebuddyAgent [baseline] (717.771 ms) : 0, 717771
BytebuddyAgent [candidate] (718.107 ms) : 0, 718107
GlobalTracer [baseline] (270.294 ms) : 0, 270294
GlobalTracer [candidate] (270.377 ms) : 0, 270377
AppSec [baseline] (47.201 ms) : 0, 47201
AppSec [candidate] (47.653 ms) : 0, 47653
IAST [baseline] (13.718 ms) : 0, 13718
IAST [candidate] (13.782 ms) : 0, 13782
Remote Config [baseline] (545.451 µs) : 0, 545
Remote Config [candidate] (550.092 µs) : 0, 550
Telemetry [baseline] (5.701 ms) : 0, 5701
Telemetry [candidate] (5.692 ms) : 0, 5692
section profiling
BytebuddyAgent [baseline] (628.203 ms) : 0, 628203
BytebuddyAgent [candidate] (626.865 ms) : 0, 626865
GlobalTracer [baseline] (347.885 ms) : 0, 347885
GlobalTracer [candidate] (346.929 ms) : 0, 346929
AppSec [baseline] (49.368 ms) : 0, 49368
AppSec [candidate] (49.146 ms) : 0, 49146
Remote Config [baseline] (655.774 µs) : 0, 656
Remote Config [candidate] (653.975 µs) : 0, 654
Telemetry [baseline] (6.03 ms) : 0, 6030
Telemetry [candidate] (6.019 ms) : 0, 6019
ProfilingAgent [baseline] (77.789 ms) : 0, 77789
ProfilingAgent [candidate] (77.096 ms) : 0, 77096
Profiling [baseline] (77.814 ms) : 0, 77814
Profiling [candidate] (77.121 ms) : 0, 77121
Loading

Load

Parameters

Baseline Candidate
commit 1.20.0-SNAPSHOT~ccdadbf2de 1.20.0-SNAPSHOT~8f4feb14ad
config baseline candidate
end_time 2023-08-25T08:37:01 2023-08-25T08:55:06
start_time 2023-08-25T08:36:44 2023-08-25T08:54:49
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
variant appsec appsec

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 cases.

Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.20.0-SNAPSHOT~8f4feb14ad, baseline=1.20.0-SNAPSHOT~ccdadbf2de
    dateFormat X
    axisFormat %s
section baseline
no_agent (360.645 µs) : 340, 381
.   : milestone, 361,
appsec (665.638 µs) : 645, 687
.   : milestone, 666,
iast (459.911 µs) : 439, 481
.   : milestone, 460,
iast_FULL (516.435 µs) : 496, 537
.   : milestone, 516,
iast_INACTIVE (430.068 µs) : 410, 450
.   : milestone, 430,
profiling (425.495 µs) : 405, 446
.   : milestone, 425,
tracing (430.252 µs) : 409, 451
.   : milestone, 430,
section candidate
no_agent (362.28 µs) : 341, 383
.   : milestone, 362,
appsec (661.067 µs) : 641, 681
.   : milestone, 661,
iast (457.106 µs) : 436, 478
.   : milestone, 457,
iast_FULL (523.528 µs) : 503, 544
.   : milestone, 524,
iast_INACTIVE (428.423 µs) : 408, 449
.   : milestone, 428,
profiling (434.499 µs) : 414, 455
.   : milestone, 434,
tracing (431.142 µs) : 409, 453
.   : milestone, 431,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 360.645 µs [340.407 µs, 380.883 µs] -
appsec 665.638 µs [644.653 µs, 686.623 µs] 304.993 µs (84.6%)
iast 459.911 µs [438.756 µs, 481.066 µs] 99.266 µs (27.5%)
iast_FULL 516.435 µs [496.003 µs, 536.866 µs] 155.789 µs (43.2%)
iast_INACTIVE 430.068 µs [409.658 µs, 450.478 µs] 69.422 µs (19.2%)
profiling 425.495 µs [405.17 µs, 445.819 µs] 64.85 µs (18.0%)
tracing 430.252 µs [409.492 µs, 451.013 µs] 69.607 µs (19.3%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 362.28 µs [341.468 µs, 383.093 µs] -
appsec 661.067 µs [640.725 µs, 681.408 µs] 298.786 µs (82.5%)
iast 457.106 µs [436.343 µs, 477.869 µs] 94.825 µs (26.2%)
iast_FULL 523.528 µs [503.009 µs, 544.046 µs] 161.247 µs (44.5%)
iast_INACTIVE 428.423 µs [407.562 µs, 449.284 µs] 66.143 µs (18.3%)
profiling 434.499 µs [414.066 µs, 454.931 µs] 72.218 µs (19.9%)
tracing 431.142 µs [409.461 µs, 452.824 µs] 68.862 µs (19.0%)
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.20.0-SNAPSHOT~8f4feb14ad, baseline=1.20.0-SNAPSHOT~ccdadbf2de
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.34 ms) : 1320, 1359
.   : milestone, 1340,
appsec (1.658 ms) : 1634, 1682
.   : milestone, 1658,
iast (1.448 ms) : 1424, 1472
.   : milestone, 1448,
profiling (1.458 ms) : 1434, 1483
.   : milestone, 1458,
tracing (1.455 ms) : 1431, 1479
.   : milestone, 1455,
section candidate
no_agent (1.324 ms) : 1305, 1343
.   : milestone, 1324,
appsec (1.668 ms) : 1644, 1692
.   : milestone, 1668,
iast (1.456 ms) : 1432, 1481
.   : milestone, 1456,
profiling (1.464 ms) : 1440, 1489
.   : milestone, 1464,
tracing (1.463 ms) : 1439, 1487
.   : milestone, 1463,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.34 ms [1.32 ms, 1.359 ms] -
appsec 1.658 ms [1.634 ms, 1.682 ms] 318.486 µs (23.8%)
iast 1.448 ms [1.424 ms, 1.472 ms] 108.726 µs (8.1%)
profiling 1.458 ms [1.434 ms, 1.483 ms] 118.761 µs (8.9%)
tracing 1.455 ms [1.431 ms, 1.479 ms] 115.586 µs (8.6%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.324 ms [1.305 ms, 1.343 ms] -
appsec 1.668 ms [1.644 ms, 1.692 ms] 343.862 µs (26.0%)
iast 1.456 ms [1.432 ms, 1.481 ms] 132.053 µs (10.0%)
profiling 1.464 ms [1.44 ms, 1.489 ms] 140.233 µs (10.6%)
tracing 1.463 ms [1.439 ms, 1.487 ms] 138.458 µs (10.5%)

@cataphract
cataphract force-pushed the glopes/appsec.blocked-timing branch from e950b01 to 79edfe4 Compare August 24, 2023 16:11
@cataphract cataphract added the comp: asm waf Application Security Management (WAF) label Aug 24, 2023
@cataphract
cataphract force-pushed the glopes/appsec.blocked-timing branch from 79edfe4 to 0866457 Compare August 24, 2023 16:49
@cataphract
cataphract force-pushed the glopes/appsec.blocked-timing branch from 0866457 to 8f4feb1 Compare August 25, 2023 08:14
@cataphract
cataphract merged commit acb417b into master Aug 25, 2023
@cataphract
cataphract deleted the glopes/appsec.blocked-timing branch August 25, 2023 10:00
@github-actions github-actions Bot added this to the 1.20.0 milestone Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: asm waf Application Security Management (WAF) type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants