Skip to content

Wrap servlet original PrintWriter on rum injector #9146

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

Merged
merged 2 commits into from
Jul 15, 2025

Conversation

amarziali
Copy link
Contributor

What Does This Do

In case we inject content for RUM, it wraps the servlet printwriter instead of creating one with the underlying outputstream in order not to skip potential mechanisms beneath HttpServletResponse

Motivation

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@amarziali amarziali requested review from a team as code owners July 10, 2025 14:34
@amarziali amarziali requested a review from smola July 10, 2025 14:34
@amarziali amarziali added type: enhancement Enhancements and improvements comp: rum Realtime User Monitoring labels Jul 10, 2025
@amarziali amarziali requested a review from mcculls July 10, 2025 14:34
}
}
} else {
// use slow path because the length to write is small and within the lookbehind buffer size
super.write(b, off, len);
for (int i = off; i < off + len; i++) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mcculls added the loop not to delegate to super

}
}

private int arrayContains(byte[] array, byte[] search) {
for (int i = 0; i < array.length - search.length; i++) {
private int arrayContains(byte[] array, int off, int len, byte[] search) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed the signature to take into account potential offset and len

@@ -3,24 +3,6 @@ package datadog.trace.bootstrap.instrumentation.buffer
import datadog.trace.test.util.DDSpecification

class InjectingPipeOutputStreamTest extends DDSpecification {

static class ExceptionControlledOutputStream extends FilterOutputStream {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

was a leftover. I need to implement that when I will test the reliability in case of exception (next PR)

@amarziali amarziali requested a review from PerfectSlayer July 10, 2025 14:37
@amarziali amarziali enabled auto-merge (squash) July 10, 2025 14:37
@amarziali amarziali force-pushed the andrea.marziali/printwriter branch from a4d11be to 39fb03d Compare July 10, 2025 15:13
@pr-commenter
Copy link

pr-commenter bot commented Jul 10, 2025

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master andrea.marziali/printwriter
git_commit_date 1752163579 1752164523
git_commit_sha a90ccbc 23a97d9
release_version 1.52.0-SNAPSHOT~a90ccbcd72 1.52.0-SNAPSHOT~23a97d92c1
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1752166384 1752166384
ci_job_id 1023338844 1023338844
ci_pipeline_id 70203230 70203230
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-u9jsg3qm 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-u9jsg3qm 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
module Agent Agent
parent None None

Summary

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

Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.52.0-SNAPSHOT~23a97d92c1, baseline=1.52.0-SNAPSHOT~a90ccbcd72

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (994.243 ms) : 0, 994243
Total [baseline] (8.585 s) : 0, 8584746
Agent [candidate] (993.308 ms) : 0, 993308
Total [candidate] (8.535 s) : 0, 8535444
section iast
Agent [baseline] (1.149 s) : 0, 1148701
Total [baseline] (9.298 s) : 0, 9298226
Agent [candidate] (1.133 s) : 0, 1133358
Total [candidate] (9.303 s) : 0, 9303320
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 994.243 ms -
Agent iast 1.149 s 154.458 ms (15.5%)
Total tracing 8.585 s -
Total iast 9.298 s 713.48 ms (8.3%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 993.308 ms -
Agent iast 1.133 s 140.05 ms (14.1%)
Total tracing 8.535 s -
Total iast 9.303 s 767.876 ms (9.0%)
gantt
    title insecure-bank - break down per module: candidate=1.52.0-SNAPSHOT~23a97d92c1, baseline=1.52.0-SNAPSHOT~a90ccbcd72

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (686.589 ms) : 0, 686589
BytebuddyAgent [candidate] (685.619 ms) : 0, 685619
GlobalTracer [baseline] (241.91 ms) : 0, 241910
GlobalTracer [candidate] (241.784 ms) : 0, 241784
AppSec [baseline] (30.157 ms) : 0, 30157
AppSec [candidate] (30.337 ms) : 0, 30337
Debugger [baseline] (5.944 ms) : 0, 5944
Debugger [candidate] (5.959 ms) : 0, 5959
Remote Config [baseline] (683.968 µs) : 0, 684
Remote Config [candidate] (683.521 µs) : 0, 684
Telemetry [baseline] (8.24 ms) : 0, 8240
Telemetry [candidate] (8.249 ms) : 0, 8249
section iast
BytebuddyAgent [baseline] (820.18 ms) : 0, 820180
BytebuddyAgent [candidate] (808.701 ms) : 0, 808701
GlobalTracer [baseline] (234.361 ms) : 0, 234361
GlobalTracer [candidate] (232.187 ms) : 0, 232187
AppSec [baseline] (31.866 ms) : 0, 31866
AppSec [candidate] (30.361 ms) : 0, 30361
Debugger [baseline] (5.784 ms) : 0, 5784
Debugger [candidate] (5.724 ms) : 0, 5724
Remote Config [baseline] (588.084 µs) : 0, 588
Remote Config [candidate] (568.773 µs) : 0, 569
Telemetry [baseline] (8.021 ms) : 0, 8021
Telemetry [candidate] (7.917 ms) : 0, 7917
IAST [baseline] (26.951 ms) : 0, 26951
IAST [candidate] (27.189 ms) : 0, 27189
Loading
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.52.0-SNAPSHOT~23a97d92c1, baseline=1.52.0-SNAPSHOT~a90ccbcd72

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (995.856 ms) : 0, 995856
Total [baseline] (10.579 s) : 0, 10579480
Agent [candidate] (997.956 ms) : 0, 997956
Total [candidate] (10.6 s) : 0, 10600117
section appsec
Agent [baseline] (1.176 s) : 0, 1176420
Total [baseline] (10.742 s) : 0, 10742228
Agent [candidate] (1.175 s) : 0, 1174729
Total [candidate] (10.785 s) : 0, 10785320
section iast
Agent [baseline] (1.133 s) : 0, 1132806
Total [baseline] (10.831 s) : 0, 10831232
Agent [candidate] (1.133 s) : 0, 1132655
Total [candidate] (10.829 s) : 0, 10829056
section profiling
Agent [baseline] (1.246 s) : 0, 1246350
Total [baseline] (11.022 s) : 0, 11022321
Agent [candidate] (1.245 s) : 0, 1245212
Total [candidate] (10.989 s) : 0, 10988652
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 995.856 ms -
Agent appsec 1.176 s 180.564 ms (18.1%)
Agent iast 1.133 s 136.95 ms (13.8%)
Agent profiling 1.246 s 250.494 ms (25.2%)
Total tracing 10.579 s -
Total appsec 10.742 s 162.748 ms (1.5%)
Total iast 10.831 s 251.752 ms (2.4%)
Total profiling 11.022 s 442.841 ms (4.2%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 997.956 ms -
Agent appsec 1.175 s 176.772 ms (17.7%)
Agent iast 1.133 s 134.698 ms (13.5%)
Agent profiling 1.245 s 247.256 ms (24.8%)
Total tracing 10.6 s -
Total appsec 10.785 s 185.203 ms (1.7%)
Total iast 10.829 s 228.939 ms (2.2%)
Total profiling 10.989 s 388.536 ms (3.7%)
gantt
    title petclinic - break down per module: candidate=1.52.0-SNAPSHOT~23a97d92c1, baseline=1.52.0-SNAPSHOT~a90ccbcd72

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (687.438 ms) : 0, 687438
BytebuddyAgent [candidate] (689.246 ms) : 0, 689246
GlobalTracer [baseline] (242.484 ms) : 0, 242484
GlobalTracer [candidate] (242.589 ms) : 0, 242589
AppSec [baseline] (30.349 ms) : 0, 30349
AppSec [candidate] (30.321 ms) : 0, 30321
Debugger [baseline] (5.937 ms) : 0, 5937
Debugger [candidate] (5.995 ms) : 0, 5995
Remote Config [baseline] (671.72 µs) : 0, 672
Remote Config [candidate] (674.924 µs) : 0, 675
Telemetry [baseline] (8.182 ms) : 0, 8182
Telemetry [candidate] (8.203 ms) : 0, 8203
section appsec
BytebuddyAgent [baseline] (711.296 ms) : 0, 711296
BytebuddyAgent [candidate] (709.448 ms) : 0, 709448
GlobalTracer [baseline] (235.441 ms) : 0, 235441
GlobalTracer [candidate] (235.275 ms) : 0, 235275
IAST [baseline] (23.614 ms) : 0, 23614
IAST [candidate] (23.437 ms) : 0, 23437
AppSec [baseline] (170.882 ms) : 0, 170882
AppSec [candidate] (171.326 ms) : 0, 171326
Debugger [baseline] (5.705 ms) : 0, 5705
Debugger [candidate] (5.729 ms) : 0, 5729
Remote Config [baseline] (599.577 µs) : 0, 600
Remote Config [candidate] (595.835 µs) : 0, 596
Telemetry [baseline] (8.042 ms) : 0, 8042
Telemetry [candidate] (8.081 ms) : 0, 8081
section iast
BytebuddyAgent [baseline] (807.475 ms) : 0, 807475
BytebuddyAgent [candidate] (807.837 ms) : 0, 807837
GlobalTracer [baseline] (232.278 ms) : 0, 232278
GlobalTracer [candidate] (232.188 ms) : 0, 232188
IAST [baseline] (26.508 ms) : 0, 26508
IAST [candidate] (28.791 ms) : 0, 28791
AppSec [baseline] (31.526 ms) : 0, 31526
AppSec [candidate] (28.857 ms) : 0, 28857
Debugger [baseline] (5.76 ms) : 0, 5760
Debugger [candidate] (5.738 ms) : 0, 5738
Remote Config [baseline] (576.757 µs) : 0, 577
Remote Config [candidate] (572.677 µs) : 0, 573
Telemetry [baseline] (7.91 ms) : 0, 7910
Telemetry [candidate] (7.899 ms) : 0, 7899
section profiling
BytebuddyAgent [baseline] (677.125 ms) : 0, 677125
BytebuddyAgent [candidate] (677.965 ms) : 0, 677965
GlobalTracer [baseline] (362.713 ms) : 0, 362713
GlobalTracer [candidate] (361.438 ms) : 0, 361438
AppSec [baseline] (34.026 ms) : 0, 34026
AppSec [candidate] (33.134 ms) : 0, 33134
Debugger [baseline] (9.901 ms) : 0, 9901
Debugger [candidate] (9.132 ms) : 0, 9132
Remote Config [baseline] (674.893 µs) : 0, 675
Remote Config [candidate] (676.494 µs) : 0, 676
Telemetry [baseline] (8.123 ms) : 0, 8123
Telemetry [candidate] (9.507 ms) : 0, 9507
ProfilingAgent [baseline] (105.154 ms) : 0, 105154
ProfilingAgent [candidate] (104.826 ms) : 0, 104826
Profiling [baseline] (105.178 ms) : 0, 105178
Profiling [candidate] (104.849 ms) : 0, 104849
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master andrea.marziali/printwriter
git_commit_date 1752163579 1752164523
git_commit_sha a90ccbc 23a97d9
release_version 1.52.0-SNAPSHOT~a90ccbcd72 1.52.0-SNAPSHOT~23a97d92c1
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1752166059 1752166059
ci_job_id 1023338846 1023338846
ci_pipeline_id 70203230 70203230
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-1-tk0d67ke 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-1-tk0d67ke 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

Found 2 performance improvements and 1 performance regressions! Performance is the same for 9 metrics, 12 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_GLOBAL:high_load better
[-806.967µs; -415.350µs] or [-7.510%; -3.865%]
unstable
[-28.680op/s; +80.430op/s] or [-6.629%; +18.590%]
10.134ms 458.531op/s 10.746ms 432.656op/s
scenario:load:petclinic:appsec:high_load better
[-1.939ms; -1.042ms] or [-4.073%; -2.190%]
unstable
[-3.938op/s; +10.288op/s] or [-4.005%; +10.464%]
46.102ms 101.487op/s 47.592ms 98.312op/s
scenario:load:petclinic:profiling:high_load worse
[+2.162ms; +3.138ms] or [+4.547%; +6.599%]
unstable
[-11.966op/s; +1.516op/s] or [-12.156%; +1.540%]
50.206ms 93.213op/s 47.556ms 98.438op/s
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.52.0-SNAPSHOT~23a97d92c1, baseline=1.52.0-SNAPSHOT~a90ccbcd72
    dateFormat X
    axisFormat %s
section baseline
no_agent (36.542 ms) : 36252, 36831
.   : milestone, 36542,
appsec (47.592 ms) : 47172, 48013
.   : milestone, 47592,
code_origins (45.057 ms) : 44683, 45432
.   : milestone, 45057,
iast (43.504 ms) : 43120, 43888
.   : milestone, 43504,
profiling (47.556 ms) : 47101, 48011
.   : milestone, 47556,
tracing (44.408 ms) : 44041, 44774
.   : milestone, 44408,
section candidate
no_agent (37.466 ms) : 37165, 37766
.   : milestone, 37466,
appsec (46.102 ms) : 45690, 46515
.   : milestone, 46102,
code_origins (43.831 ms) : 43457, 44204
.   : milestone, 43831,
iast (42.781 ms) : 42412, 43150
.   : milestone, 42781,
profiling (50.206 ms) : 49754, 50658
.   : milestone, 50206,
tracing (44.616 ms) : 44251, 44981
.   : milestone, 44616,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 36.542 ms [36.252 ms, 36.831 ms] -
appsec 47.592 ms [47.172 ms, 48.013 ms] 11.051 ms (30.2%)
code_origins 45.057 ms [44.683 ms, 45.432 ms] 8.516 ms (23.3%)
iast 43.504 ms [43.12 ms, 43.888 ms] 6.963 ms (19.1%)
profiling 47.556 ms [47.101 ms, 48.011 ms] 11.014 ms (30.1%)
tracing 44.408 ms [44.041 ms, 44.774 ms] 7.866 ms (21.5%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 37.466 ms [37.165 ms, 37.766 ms] -
appsec 46.102 ms [45.69 ms, 46.515 ms] 8.636 ms (23.1%)
code_origins 43.831 ms [43.457 ms, 44.204 ms] 6.365 ms (17.0%)
iast 42.781 ms [42.412 ms, 43.15 ms] 5.315 ms (14.2%)
profiling 50.206 ms [49.754 ms, 50.658 ms] 12.741 ms (34.0%)
tracing 44.616 ms [44.251 ms, 44.981 ms] 7.15 ms (19.1%)
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.52.0-SNAPSHOT~23a97d92c1, baseline=1.52.0-SNAPSHOT~a90ccbcd72
    dateFormat X
    axisFormat %s
section baseline
no_agent (4.363 ms) : 4312, 4413
.   : milestone, 4363,
iast (9.608 ms) : 9440, 9777
.   : milestone, 9608,
iast_FULL (14.174 ms) : 13897, 14451
.   : milestone, 14174,
iast_GLOBAL (10.746 ms) : 10555, 10936
.   : milestone, 10746,
profiling (8.466 ms) : 8341, 8591
.   : milestone, 8466,
tracing (7.696 ms) : 7579, 7812
.   : milestone, 7696,
section candidate
no_agent (4.374 ms) : 4325, 4422
.   : milestone, 4374,
iast (9.503 ms) : 9346, 9661
.   : milestone, 9503,
iast_FULL (14.439 ms) : 14154, 14724
.   : milestone, 14439,
iast_GLOBAL (10.134 ms) : 9962, 10307
.   : milestone, 10134,
profiling (8.74 ms) : 8605, 8876
.   : milestone, 8740,
tracing (7.781 ms) : 7671, 7891
.   : milestone, 7781,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.363 ms [4.312 ms, 4.413 ms] -
iast 9.608 ms [9.44 ms, 9.777 ms] 5.246 ms (120.2%)
iast_FULL 14.174 ms [13.897 ms, 14.451 ms] 9.811 ms (224.9%)
iast_GLOBAL 10.746 ms [10.555 ms, 10.936 ms] 6.383 ms (146.3%)
profiling 8.466 ms [8.341 ms, 8.591 ms] 4.103 ms (94.1%)
tracing 7.696 ms [7.579 ms, 7.812 ms] 3.333 ms (76.4%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.374 ms [4.325 ms, 4.422 ms] -
iast 9.503 ms [9.346 ms, 9.661 ms] 5.13 ms (117.3%)
iast_FULL 14.439 ms [14.154 ms, 14.724 ms] 10.065 ms (230.1%)
iast_GLOBAL 10.134 ms [9.962 ms, 10.307 ms] 5.761 ms (131.7%)
profiling 8.74 ms [8.605 ms, 8.876 ms] 4.367 ms (99.8%)
tracing 7.781 ms [7.671 ms, 7.891 ms] 3.407 ms (77.9%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master andrea.marziali/printwriter
git_commit_date 1752163579 1752164523
git_commit_sha a90ccbc 23a97d9
release_version 1.52.0-SNAPSHOT~a90ccbcd72 1.52.0-SNAPSHOT~23a97d92c1
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1752166540 1752166540
ci_job_id 1023338848 1023338848
ci_pipeline_id 70203230 70203230
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-t7kjn8xe 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-t7kjn8xe 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

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

Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.52.0-SNAPSHOT~23a97d92c1, baseline=1.52.0-SNAPSHOT~a90ccbcd72
    dateFormat X
    axisFormat %s
section baseline
no_agent (14.927 s) : 14927000, 14927000
.   : milestone, 14927000,
appsec (14.705 s) : 14705000, 14705000
.   : milestone, 14705000,
iast (18.276 s) : 18276000, 18276000
.   : milestone, 18276000,
iast_GLOBAL (18.081 s) : 18081000, 18081000
.   : milestone, 18081000,
profiling (15.361 s) : 15361000, 15361000
.   : milestone, 15361000,
tracing (14.885 s) : 14885000, 14885000
.   : milestone, 14885000,
section candidate
no_agent (15.054 s) : 15054000, 15054000
.   : milestone, 15054000,
appsec (15.098 s) : 15098000, 15098000
.   : milestone, 15098000,
iast (18.098 s) : 18098000, 18098000
.   : milestone, 18098000,
iast_GLOBAL (18.233 s) : 18233000, 18233000
.   : milestone, 18233000,
profiling (15.432 s) : 15432000, 15432000
.   : milestone, 15432000,
tracing (15.004 s) : 15004000, 15004000
.   : milestone, 15004000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.927 s [14.927 s, 14.927 s] -
appsec 14.705 s [14.705 s, 14.705 s] -222.0 ms (-1.5%)
iast 18.276 s [18.276 s, 18.276 s] 3.349 s (22.4%)
iast_GLOBAL 18.081 s [18.081 s, 18.081 s] 3.154 s (21.1%)
profiling 15.361 s [15.361 s, 15.361 s] 434.0 ms (2.9%)
tracing 14.885 s [14.885 s, 14.885 s] -42.0 ms (-0.3%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.054 s [15.054 s, 15.054 s] -
appsec 15.098 s [15.098 s, 15.098 s] 44.0 ms (0.3%)
iast 18.098 s [18.098 s, 18.098 s] 3.044 s (20.2%)
iast_GLOBAL 18.233 s [18.233 s, 18.233 s] 3.179 s (21.1%)
profiling 15.432 s [15.432 s, 15.432 s] 378.0 ms (2.5%)
tracing 15.004 s [15.004 s, 15.004 s] -50.0 ms (-0.3%)
Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.52.0-SNAPSHOT~23a97d92c1, baseline=1.52.0-SNAPSHOT~a90ccbcd72
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.478 ms) : 1466, 1490
.   : milestone, 1478,
appsec (2.421 ms) : 2371, 2471
.   : milestone, 2421,
iast (2.207 ms) : 2144, 2270
.   : milestone, 2207,
iast_GLOBAL (2.242 ms) : 2180, 2305
.   : milestone, 2242,
profiling (2.047 ms) : 1997, 2098
.   : milestone, 2047,
tracing (2.017 ms) : 1969, 2065
.   : milestone, 2017,
section candidate
no_agent (1.475 ms) : 1464, 1487
.   : milestone, 1475,
appsec (2.418 ms) : 2368, 2468
.   : milestone, 2418,
iast (2.203 ms) : 2140, 2265
.   : milestone, 2203,
iast_GLOBAL (2.237 ms) : 2175, 2300
.   : milestone, 2237,
profiling (2.504 ms) : 2328, 2679
.   : milestone, 2504,
tracing (2.015 ms) : 1966, 2064
.   : milestone, 2015,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.478 ms [1.466 ms, 1.49 ms] -
appsec 2.421 ms [2.371 ms, 2.471 ms] 942.922 µs (63.8%)
iast 2.207 ms [2.144 ms, 2.27 ms] 729.11 µs (49.3%)
iast_GLOBAL 2.242 ms [2.18 ms, 2.305 ms] 764.442 µs (51.7%)
profiling 2.047 ms [1.997 ms, 2.098 ms] 569.427 µs (38.5%)
tracing 2.017 ms [1.969 ms, 2.065 ms] 538.939 µs (36.5%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.475 ms [1.464 ms, 1.487 ms] -
appsec 2.418 ms [2.368 ms, 2.468 ms] 942.585 µs (63.9%)
iast 2.203 ms [2.14 ms, 2.265 ms] 727.618 µs (49.3%)
iast_GLOBAL 2.237 ms [2.175 ms, 2.3 ms] 762.286 µs (51.7%)
profiling 2.504 ms [2.328 ms, 2.679 ms] 1.028 ms (69.7%)
tracing 2.015 ms [1.966 ms, 2.064 ms] 539.764 µs (36.6%)

* @return The marker chars, {@code null} if RUM injection is disabled.
*/
@Nullable
public char[] getMarker() {
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 char[] getMarker() {
public char[] getMarkerChars() {

just to make clear this returns chars whereas getMarker(String encoding) returns bytes

(you could also change the old method to getMarkerBytes to make it even clearer)

* @return The HTML snippet chars to inject, {@code null} if RUM injection is disabled.
*/
@Nullable
public char[] getSnippet() {
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 char[] getSnippet() {
public char[] getSnippetChars() {

Same reason as below - maybe also consider renaming getSnippet(String encoding) to getSnippetBytes(String encoding)

import java.io.Writer;

/**
* An Writer containing a circular buffer with a lookbehind buffer of n bytes. The first time that
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
* An Writer containing a circular buffer with a lookbehind buffer of n bytes. The first time that
* A Writer containing a circular buffer with a lookbehind buffer of n bytes. The first time that

}

@Override
public void write(int b) throws IOException {
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 void write(int b) throws IOException {
public void write(int c) throws IOException {

matches the Writer javadoc


@Override
public void flush() throws IOException {
downstream.flush();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we also need this in the updated InjectingPipeOutputStream

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes in the outputstream I didn't implement the first time since extending FilterOutputStream but now is not the case anymore thanks

@amarziali amarziali merged commit 1ae2692 into master Jul 15, 2025
507 checks passed
@amarziali amarziali deleted the andrea.marziali/printwriter branch July 15, 2025 11:19
@github-actions github-actions bot added this to the 1.52.0 milestone Jul 15, 2025
@amarziali amarziali restored the andrea.marziali/printwriter branch July 15, 2025 12:24
@amarziali amarziali deleted the andrea.marziali/printwriter branch July 15, 2025 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: rum Realtime User Monitoring type: enhancement Enhancements and improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants