Add JFR scrubbing before profile upload#10577
Add JFR scrubbing before profile upload#10577gh-worker-dd-mergequeue-cf854d[bot] merged 7 commits intomasterfrom
Conversation
322c7a1 to
51136f3
Compare
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 61 metrics, 10 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.60.0-SNAPSHOT~3cbadcf0a2, baseline=1.60.0-SNAPSHOT~d77d632808
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.062 s) : 0, 1062111
Total [baseline] (8.723 s) : 0, 8723320
Agent [candidate] (1.065 s) : 0, 1065238
Total [candidate] (8.743 s) : 0, 8743248
section iast
Agent [baseline] (1.246 s) : 0, 1246275
Total [baseline] (9.416 s) : 0, 9416009
Agent [candidate] (1.231 s) : 0, 1231163
Total [candidate] (9.403 s) : 0, 9402636
gantt
title insecure-bank - break down per module: candidate=1.60.0-SNAPSHOT~3cbadcf0a2, baseline=1.60.0-SNAPSHOT~d77d632808
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.195 ms) : 0, 1195
crashtracking [candidate] (1.203 ms) : 0, 1203
BytebuddyAgent [baseline] (627.67 ms) : 0, 627670
BytebuddyAgent [candidate] (627.68 ms) : 0, 627680
AgentMeter [baseline] (29.003 ms) : 0, 29003
AgentMeter [candidate] (29.037 ms) : 0, 29037
GlobalTracer [baseline] (257.19 ms) : 0, 257190
GlobalTracer [candidate] (257.317 ms) : 0, 257317
AppSec [baseline] (33.149 ms) : 0, 33149
AppSec [candidate] (32.888 ms) : 0, 32888
Debugger [baseline] (63.518 ms) : 0, 63518
Debugger [candidate] (65.125 ms) : 0, 65125
Remote Config [baseline] (625.673 µs) : 0, 626
Remote Config [candidate] (599.139 µs) : 0, 599
Telemetry [baseline] (9.034 ms) : 0, 9034
Telemetry [candidate] (9.04 ms) : 0, 9040
Flare Poller [baseline] (4.548 ms) : 0, 4548
Flare Poller [candidate] (6.135 ms) : 0, 6135
section iast
crashtracking [baseline] (1.235 ms) : 0, 1235
crashtracking [candidate] (1.193 ms) : 0, 1193
BytebuddyAgent [baseline] (807.38 ms) : 0, 807380
BytebuddyAgent [candidate] (794.925 ms) : 0, 794925
AgentMeter [baseline] (11.799 ms) : 0, 11799
AgentMeter [candidate] (11.277 ms) : 0, 11277
GlobalTracer [baseline] (250.154 ms) : 0, 250154
GlobalTracer [candidate] (248.085 ms) : 0, 248085
AppSec [baseline] (35.899 ms) : 0, 35899
AppSec [candidate] (34.773 ms) : 0, 34773
Debugger [baseline] (63.629 ms) : 0, 63629
Debugger [candidate] (65.058 ms) : 0, 65058
Remote Config [baseline] (558.703 µs) : 0, 559
Remote Config [candidate] (545.812 µs) : 0, 546
Telemetry [baseline] (8.62 ms) : 0, 8620
Telemetry [candidate] (8.715 ms) : 0, 8715
Flare Poller [baseline] (3.404 ms) : 0, 3404
Flare Poller [candidate] (3.533 ms) : 0, 3533
IAST [baseline] (27.32 ms) : 0, 27320
IAST [candidate] (26.994 ms) : 0, 26994
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.60.0-SNAPSHOT~3cbadcf0a2, baseline=1.60.0-SNAPSHOT~d77d632808
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.064 s) : 0, 1064395
Total [baseline] (10.905 s) : 0, 10904843
Agent [candidate] (1.065 s) : 0, 1064583
Total [candidate] (10.846 s) : 0, 10846428
section appsec
Agent [baseline] (1.24 s) : 0, 1239968
Total [baseline] (10.997 s) : 0, 10997473
Agent [candidate] (1.247 s) : 0, 1246505
Total [candidate] (11.123 s) : 0, 11123492
section iast
Agent [baseline] (1.233 s) : 0, 1233342
Total [baseline] (11.203 s) : 0, 11202714
Agent [candidate] (1.231 s) : 0, 1231056
Total [candidate] (11.186 s) : 0, 11186319
section profiling
Agent [baseline] (1.189 s) : 0, 1189392
Total [baseline] (10.905 s) : 0, 10904699
Agent [candidate] (1.208 s) : 0, 1207830
Total [candidate] (11.017 s) : 0, 11017364
gantt
title petclinic - break down per module: candidate=1.60.0-SNAPSHOT~3cbadcf0a2, baseline=1.60.0-SNAPSHOT~d77d632808
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.184 ms) : 0, 1184
crashtracking [candidate] (1.187 ms) : 0, 1187
BytebuddyAgent [baseline] (626.622 ms) : 0, 626622
BytebuddyAgent [candidate] (627.215 ms) : 0, 627215
AgentMeter [baseline] (28.937 ms) : 0, 28937
AgentMeter [candidate] (29.117 ms) : 0, 29117
GlobalTracer [baseline] (257.489 ms) : 0, 257489
GlobalTracer [candidate] (257.546 ms) : 0, 257546
AppSec [baseline] (32.959 ms) : 0, 32959
AppSec [candidate] (32.887 ms) : 0, 32887
Debugger [baseline] (65.803 ms) : 0, 65803
Debugger [candidate] (62.345 ms) : 0, 62345
Remote Config [baseline] (633.85 µs) : 0, 634
Remote Config [candidate] (630.26 µs) : 0, 630
Telemetry [baseline] (9.318 ms) : 0, 9318
Telemetry [candidate] (13.134 ms) : 0, 13134
Flare Poller [baseline] (5.435 ms) : 0, 5435
Flare Poller [candidate] (4.505 ms) : 0, 4505
section appsec
crashtracking [baseline] (1.208 ms) : 0, 1208
crashtracking [candidate] (1.2 ms) : 0, 1200
BytebuddyAgent [baseline] (658.14 ms) : 0, 658140
BytebuddyAgent [candidate] (661.704 ms) : 0, 661704
AgentMeter [baseline] (11.946 ms) : 0, 11946
AgentMeter [candidate] (11.992 ms) : 0, 11992
GlobalTracer [baseline] (258.657 ms) : 0, 258657
GlobalTracer [candidate] (259.893 ms) : 0, 259893
AppSec [baseline] (167.855 ms) : 0, 167855
AppSec [candidate] (168.965 ms) : 0, 168965
Debugger [baseline] (66.722 ms) : 0, 66722
Debugger [candidate] (67.022 ms) : 0, 67022
Remote Config [baseline] (650.472 µs) : 0, 650
Remote Config [candidate] (652.169 µs) : 0, 652
Telemetry [baseline] (9.541 ms) : 0, 9541
Telemetry [candidate] (9.48 ms) : 0, 9480
Flare Poller [baseline] (3.7 ms) : 0, 3700
Flare Poller [candidate] (3.689 ms) : 0, 3689
IAST [baseline] (25.444 ms) : 0, 25444
IAST [candidate] (25.671 ms) : 0, 25671
section iast
crashtracking [baseline] (1.191 ms) : 0, 1191
crashtracking [candidate] (1.185 ms) : 0, 1185
BytebuddyAgent [baseline] (796.92 ms) : 0, 796920
BytebuddyAgent [candidate] (794.418 ms) : 0, 794418
AgentMeter [baseline] (11.331 ms) : 0, 11331
AgentMeter [candidate] (11.276 ms) : 0, 11276
GlobalTracer [baseline] (248.079 ms) : 0, 248079
GlobalTracer [candidate] (247.457 ms) : 0, 247457
AppSec [baseline] (34.713 ms) : 0, 34713
AppSec [candidate] (35.016 ms) : 0, 35016
Debugger [baseline] (65.691 ms) : 0, 65691
Debugger [candidate] (65.893 ms) : 0, 65893
Remote Config [baseline] (541.5 µs) : 0, 542
Remote Config [candidate] (536.12 µs) : 0, 536
Telemetry [baseline] (8.56 ms) : 0, 8560
Telemetry [candidate] (8.652 ms) : 0, 8652
Flare Poller [baseline] (3.448 ms) : 0, 3448
Flare Poller [candidate] (3.436 ms) : 0, 3436
IAST [baseline] (26.806 ms) : 0, 26806
IAST [candidate] (27.066 ms) : 0, 27066
section profiling
crashtracking [baseline] (1.179 ms) : 0, 1179
crashtracking [candidate] (1.192 ms) : 0, 1192
BytebuddyAgent [baseline] (681.141 ms) : 0, 681141
BytebuddyAgent [candidate] (692.37 ms) : 0, 692370
AgentMeter [baseline] (8.539 ms) : 0, 8539
AgentMeter [candidate] (8.685 ms) : 0, 8685
GlobalTracer [baseline] (215.914 ms) : 0, 215914
GlobalTracer [candidate] (218.993 ms) : 0, 218993
AppSec [baseline] (32.321 ms) : 0, 32321
AppSec [candidate] (33.118 ms) : 0, 33118
Debugger [baseline] (67.03 ms) : 0, 67030
Debugger [candidate] (67.835 ms) : 0, 67835
Remote Config [baseline] (625.237 µs) : 0, 625
Remote Config [candidate] (643.064 µs) : 0, 643
Telemetry [baseline] (8.946 ms) : 0, 8946
Telemetry [candidate] (9.089 ms) : 0, 9089
Flare Poller [baseline] (3.706 ms) : 0, 3706
Flare Poller [candidate] (3.848 ms) : 0, 3848
ProfilingAgent [baseline] (99.463 ms) : 0, 99463
ProfilingAgent [candidate] (100.583 ms) : 0, 100583
Profiling [baseline] (100.032 ms) : 0, 100032
Profiling [candidate] (101.168 ms) : 0, 101168
LoadParameters
See matching parameters
SummaryFound 1 performance improvements and 0 performance regressions! Performance is the same for 20 metrics, 15 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.60.0-SNAPSHOT~3cbadcf0a2, baseline=1.60.0-SNAPSHOT~d77d632808
dateFormat X
axisFormat %s
section baseline
no_agent (18.359 ms) : 18171, 18547
. : milestone, 18359,
appsec (18.572 ms) : 18380, 18764
. : milestone, 18572,
code_origins (17.623 ms) : 17450, 17795
. : milestone, 17623,
iast (17.733 ms) : 17556, 17909
. : milestone, 17733,
profiling (18.264 ms) : 18077, 18451
. : milestone, 18264,
tracing (18.612 ms) : 18426, 18797
. : milestone, 18612,
section candidate
no_agent (17.175 ms) : 17004, 17346
. : milestone, 17175,
appsec (18.316 ms) : 18132, 18500
. : milestone, 18316,
code_origins (17.909 ms) : 17727, 18092
. : milestone, 17909,
iast (17.378 ms) : 17207, 17549
. : milestone, 17378,
profiling (18.646 ms) : 18464, 18828
. : milestone, 18646,
tracing (18.464 ms) : 18278, 18650
. : milestone, 18464,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.60.0-SNAPSHOT~3cbadcf0a2, baseline=1.60.0-SNAPSHOT~d77d632808
dateFormat X
axisFormat %s
section baseline
no_agent (1.174 ms) : 1162, 1185
. : milestone, 1174,
iast (3.176 ms) : 3133, 3218
. : milestone, 3176,
iast_FULL (5.685 ms) : 5628, 5742
. : milestone, 5685,
iast_GLOBAL (3.637 ms) : 3577, 3698
. : milestone, 3637,
profiling (2.083 ms) : 2064, 2102
. : milestone, 2083,
tracing (1.769 ms) : 1756, 1783
. : milestone, 1769,
section candidate
no_agent (1.175 ms) : 1164, 1187
. : milestone, 1175,
iast (3.273 ms) : 3232, 3315
. : milestone, 3273,
iast_FULL (5.842 ms) : 5784, 5901
. : milestone, 5842,
iast_GLOBAL (3.589 ms) : 3528, 3649
. : milestone, 3589,
profiling (1.96 ms) : 1941, 1979
. : milestone, 1960,
tracing (1.76 ms) : 1746, 1774
. : milestone, 1760,
DacapoParameters
See matching parameters
SummaryFound 1 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 0 unstable metrics.
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.60.0-SNAPSHOT~3cbadcf0a2, baseline=1.60.0-SNAPSHOT~d77d632808
dateFormat X
axisFormat %s
section baseline
no_agent (1.474 ms) : 1463, 1486
. : milestone, 1474,
appsec (3.795 ms) : 3573, 4016
. : milestone, 3795,
iast (2.244 ms) : 2175, 2312
. : milestone, 2244,
iast_GLOBAL (2.29 ms) : 2220, 2359
. : milestone, 2290,
profiling (2.099 ms) : 2043, 2155
. : milestone, 2099,
tracing (2.051 ms) : 1998, 2104
. : milestone, 2051,
section candidate
no_agent (1.472 ms) : 1460, 1483
. : milestone, 1472,
appsec (2.51 ms) : 2456, 2565
. : milestone, 2510,
iast (2.252 ms) : 2183, 2321
. : milestone, 2252,
iast_GLOBAL (2.283 ms) : 2214, 2351
. : milestone, 2283,
profiling (2.07 ms) : 2016, 2124
. : milestone, 2070,
tracing (2.05 ms) : 1997, 2103
. : milestone, 2050,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.60.0-SNAPSHOT~3cbadcf0a2, baseline=1.60.0-SNAPSHOT~d77d632808
dateFormat X
axisFormat %s
section baseline
no_agent (14.896 s) : 14896000, 14896000
. : milestone, 14896000,
appsec (15.057 s) : 15057000, 15057000
. : milestone, 15057000,
iast (18.01 s) : 18010000, 18010000
. : milestone, 18010000,
iast_GLOBAL (18.232 s) : 18232000, 18232000
. : milestone, 18232000,
profiling (14.807 s) : 14807000, 14807000
. : milestone, 14807000,
tracing (14.554 s) : 14554000, 14554000
. : milestone, 14554000,
section candidate
no_agent (15.466 s) : 15466000, 15466000
. : milestone, 15466000,
appsec (15.083 s) : 15083000, 15083000
. : milestone, 15083000,
iast (18.116 s) : 18116000, 18116000
. : milestone, 18116000,
iast_GLOBAL (17.795 s) : 17795000, 17795000
. : milestone, 17795000,
profiling (15.579 s) : 15579000, 15579000
. : milestone, 15579000,
tracing (14.502 s) : 14502000, 14502000
. : milestone, 14502000,
|
0efec0b to
6d2f36d
Compare
bd39939 to
46507cd
Compare
The JVM only eagerly resolves superclass and interfaces during defineClass. Field types, method parameter/return types, and declared exceptions are resolved lazily. Marking them as REQUIRES created false dependency cycles that broke topological sort ordering when injecting large helper batches (2000+ classes). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Scrub sensitive fields (system properties, JVM arguments, environment variables, process command lines) from JFR recordings before upload. - Add profiling-scrubber module wrapping jafar-tools Scrubber - Wire ScrubRecordingDataListener decorator into ProfilingAgent - Add RecordingData.getPath() to avoid stream materialization for file-backed recordings (ddprof) - Add config: dd.profiling.scrub.enabled, dd.profiling.scrub.fail-open, dd.profiling.scrub.event-type-excludes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Guard ThrowableInstanceAdvice during native-image build to prevent JFR event class initialization errors - Enable profiling scrubber in native image build args - Add smoke test verifying JFR files with system property events are produced (scrubbing assertion deferred until jafar handles SubstrateVM JFR chunk format) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
46507cd to
52dde93
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mcculls
left a comment
There was a problem hiding this comment.
Thanks for the related cleanup
|
The |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
What Does This Do
Adds configurable scrubbing of sensitive fields in JFR profiling recordings before upload. Sensitive data (system properties, JVM arguments, environment variables, command lines) is replaced with redacted values.
Motivation
Prevents accidental exposure of sensitive information (credentials, API keys, internal paths) in profiling data uploaded to Datadog backend.
Additional Notes
This is a proof of concept. All string values from the defined attributes will be scrubbed, there is no support for regex and similar matching. It is disabled by default and present only to be able to infer the extra overhead it would expose on a real-life system after enabling.
If the concept is validated, we will add proper value matching and enable scrubbing by default in a later PR.
profiling-scrubber module (new)
JfrScrubberwraps jafar-toolsScrubber(Java 8 compatible)DefaultScrubDefinitiondefines fields to scrub per event type:jdk.InitialSystemProperty/value,jdk.JVMInformation/jvmArguments,jdk.InitialEnvironmentVariable/value,jdk.SystemProcess/commandLinedd.profiling.scrub.event-type-excludesPipeline wiring
ScrubRecordingDataListenerdecoratesRecordingDataListener, scrubbing JFR data before delegating to the upload listenerRecordingData.getPath()(new) to avoid stream materialization for file-backed recordings (ddprof)dd.profiling.scrub.fail-open) passes unscrubbed data on scrubber errors, with null-safety guard to prevent passing already-released dataConfiguration
dd.profiling.scrub.enabled(default: false) — master switchdd.profiling.scrub.fail-open(default: false) — upload unscrubbed data on scrubber failuredd.profiling.scrub.event-type-excludes— comma-separated event types to skipNative image support
ThrowableInstanceAdviceduring native-image build to prevent JFR event class initialization errorsHelperScanner.visitField()andvisitMethod()changed fromREQUIREStoUSES.This fix was necessary to support the jafar classes injected transitively via
VMRuntimeModule.injectHelperDependencies(). The previous behavior marked field types and method parameter/return types as load-time dependencies (REQUIRES), which created false dependency cycles. WhenremoveCycles()broke these, subclasses could be positioned before their superclass in the topological sort, causingNoClassDefFoundErrorduring batch class injection.The fix is correct per the JVM spec:
defineClassonly eagerly resolves superclass and interfaces (handled byvisit()). Field types, method parameter/return types, and declared exceptions are resolved lazily. However, this change affects all instrumentations that useinjectHelperDependencies(), not just profiling. If any instrumentation relies on the old (incorrect) ordering where field/method types were treated as load-time dependencies, this change could surface latent issues.Requesting review from someone familiar with
HelperScanner/HelperInjectorinternals to verify no regressions.Testing
JfrScrubberTest(scrubbing correctness, exclusion, no-op),ScrubRecordingDataListenerTest(decorator behavior, fail-open, error paths)JFRBasedProfilingIntegrationTest— verifies end-to-end scrubbing ofjdk.InitialSystemPropertyandjdk.JVMInformationin a real profiling sessionSpringBootNativeInstrumentationTest— verifies native image builds and runs with scrubbing enabledContributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: PROF-13548
Note: Once your PR is ready to merge, add it to the merge queue by commenting
/merge./merge -ccancels the queue request./merge -f --reason "reason"skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.