-
Notifications
You must be signed in to change notification settings - Fork 293
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
Properly capture lambda payloads for all handler types. #8264
base: master
Are you sure you want to change the base?
Conversation
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
BenchmarksStartupParameters
See matching parameters
SummaryFound 1 performance improvements and 8 performance regressions! Performance is the same for 51 metrics, 3 unstable metrics.
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.46.0-SNAPSHOT~adb1dce868, baseline=1.46.0-SNAPSHOT~64e6e864bc
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.04 s) : 0, 1040178
Total [baseline] (8.635 s) : 0, 8635432
Agent [candidate] (1.057 s) : 0, 1056719
Total [candidate] (8.652 s) : 0, 8651938
section iast
Agent [baseline] (1.173 s) : 0, 1173288
Total [baseline] (9.252 s) : 0, 9251585
Agent [candidate] (1.193 s) : 0, 1192615
Total [candidate] (9.254 s) : 0, 9253750
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.165 s) : 0, 1165495
Total [baseline] (9.166 s) : 0, 9165523
Agent [candidate] (1.187 s) : 0, 1186862
Total [candidate] (9.245 s) : 0, 9245340
section iast_TELEMETRY_OFF
Agent [baseline] (1.171 s) : 0, 1170525
Total [baseline] (9.297 s) : 0, 9297184
Agent [candidate] (1.185 s) : 0, 1184738
Total [candidate] (9.225 s) : 0, 9225277
gantt
title insecure-bank - break down per module: candidate=1.46.0-SNAPSHOT~adb1dce868, baseline=1.46.0-SNAPSHOT~64e6e864bc
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (715.758 ms) : 0, 715758
BytebuddyAgent [candidate] (715.239 ms) : 0, 715239
GlobalTracer [baseline] (238.735 ms) : 0, 238735
GlobalTracer [candidate] (255.884 ms) : 0, 255884
AppSec [baseline] (55.595 ms) : 0, 55595
AppSec [candidate] (55.638 ms) : 0, 55638
Remote Config [baseline] (717.155 µs) : 0, 717
Remote Config [candidate] (752.77 µs) : 0, 753
Telemetry [baseline] (14.333 ms) : 0, 14333
Telemetry [candidate] (14.274 ms) : 0, 14274
section iast
BytebuddyAgent [baseline] (837.27 ms) : 0, 837270
BytebuddyAgent [candidate] (839.009 ms) : 0, 839009
GlobalTracer [baseline] (230.647 ms) : 0, 230647
GlobalTracer [candidate] (248.624 ms) : 0, 248624
AppSec [baseline] (59.124 ms) : 0, 59124
AppSec [candidate] (58.558 ms) : 0, 58558
IAST [baseline] (21.659 ms) : 0, 21659
IAST [candidate] (21.668 ms) : 0, 21668
Remote Config [baseline] (678.842 µs) : 0, 679
Remote Config [candidate] (671.657 µs) : 0, 672
Telemetry [baseline] (8.905 ms) : 0, 8905
Telemetry [candidate] (8.912 ms) : 0, 8912
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (832.224 ms) : 0, 832224
BytebuddyAgent [candidate] (834.496 ms) : 0, 834496
GlobalTracer [baseline] (228.904 ms) : 0, 228904
GlobalTracer [candidate] (247.91 ms) : 0, 247910
AppSec [baseline] (58.517 ms) : 0, 58517
AppSec [candidate] (58.239 ms) : 0, 58239
IAST [baseline] (21.346 ms) : 0, 21346
IAST [candidate] (21.557 ms) : 0, 21557
Remote Config [baseline] (659.218 µs) : 0, 659
Remote Config [candidate] (668.869 µs) : 0, 669
Telemetry [baseline] (8.788 ms) : 0, 8788
Telemetry [candidate] (8.884 ms) : 0, 8884
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (835.926 ms) : 0, 835926
BytebuddyAgent [candidate] (833.114 ms) : 0, 833114
GlobalTracer [baseline] (230.231 ms) : 0, 230231
GlobalTracer [candidate] (248.012 ms) : 0, 248012
AppSec [baseline] (58.83 ms) : 0, 58830
AppSec [candidate] (57.997 ms) : 0, 57997
IAST [baseline] (20.961 ms) : 0, 20961
IAST [candidate] (21.129 ms) : 0, 21129
Remote Config [baseline] (649.439 µs) : 0, 649
Remote Config [candidate] (668.344 µs) : 0, 668
Telemetry [baseline] (8.767 ms) : 0, 8767
Telemetry [candidate] (8.701 ms) : 0, 8701
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.46.0-SNAPSHOT~adb1dce868, baseline=1.46.0-SNAPSHOT~64e6e864bc
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.036 s) : 0, 1035788
Total [baseline] (10.522 s) : 0, 10521814
Agent [candidate] (1.062 s) : 0, 1062318
Total [candidate] (10.526 s) : 0, 10525571
section appsec
Agent [baseline] (1.184 s) : 0, 1183885
Total [baseline] (10.769 s) : 0, 10769118
Agent [candidate] (1.192 s) : 0, 1191986
Total [candidate] (10.781 s) : 0, 10780741
section iast
Agent [baseline] (1.17 s) : 0, 1170170
Total [baseline] (10.911 s) : 0, 10911170
Agent [candidate] (1.185 s) : 0, 1185190
Total [candidate] (11.01 s) : 0, 11009928
section profiling
Agent [baseline] (1.252 s) : 0, 1252329
Total [baseline] (10.835 s) : 0, 10835339
Agent [candidate] (1.253 s) : 0, 1253111
Total [candidate] (10.789 s) : 0, 10789247
gantt
title petclinic - break down per module: candidate=1.46.0-SNAPSHOT~adb1dce868, baseline=1.46.0-SNAPSHOT~64e6e864bc
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (713.587 ms) : 0, 713587
BytebuddyAgent [candidate] (719.147 ms) : 0, 719147
GlobalTracer [baseline] (238.707 ms) : 0, 238707
GlobalTracer [candidate] (257.122 ms) : 0, 257122
AppSec [baseline] (55.562 ms) : 0, 55562
AppSec [candidate] (55.799 ms) : 0, 55799
Remote Config [baseline] (710.949 µs) : 0, 711
Remote Config [candidate] (748.693 µs) : 0, 749
Telemetry [baseline] (12.287 ms) : 0, 12287
Telemetry [candidate] (14.414 ms) : 0, 14414
section appsec
BytebuddyAgent [baseline] (734.593 ms) : 0, 734593
BytebuddyAgent [candidate] (733.103 ms) : 0, 733103
GlobalTracer [baseline] (237.816 ms) : 0, 237816
GlobalTracer [candidate] (253.823 ms) : 0, 253823
AppSec [baseline] (177.492 ms) : 0, 177492
AppSec [candidate] (171.432 ms) : 0, 171432
IAST [baseline] (20.229 ms) : 0, 20229
IAST [candidate] (19.351 ms) : 0, 19351
Remote Config [baseline] (658.619 µs) : 0, 659
Remote Config [candidate] (668.257 µs) : 0, 668
Telemetry [baseline] (8.204 ms) : 0, 8204
Telemetry [candidate] (8.257 ms) : 0, 8257
section iast
BytebuddyAgent [baseline] (835.35 ms) : 0, 835350
BytebuddyAgent [candidate] (832.648 ms) : 0, 832648
GlobalTracer [baseline] (230.799 ms) : 0, 230799
GlobalTracer [candidate] (247.693 ms) : 0, 247693
AppSec [baseline] (58.107 ms) : 0, 58107
AppSec [candidate] (58.487 ms) : 0, 58487
IAST [baseline] (21.511 ms) : 0, 21511
IAST [candidate] (21.72 ms) : 0, 21720
Remote Config [baseline] (657.1 µs) : 0, 657
Remote Config [candidate] (670.908 µs) : 0, 671
Telemetry [baseline] (8.698 ms) : 0, 8698
Telemetry [candidate] (8.879 ms) : 0, 8879
section profiling
BytebuddyAgent [baseline] (703.441 ms) : 0, 703441
BytebuddyAgent [candidate] (703.386 ms) : 0, 703386
GlobalTracer [baseline] (348.19 ms) : 0, 348190
GlobalTracer [candidate] (349.357 ms) : 0, 349357
AppSec [baseline] (54.414 ms) : 0, 54414
AppSec [candidate] (54.019 ms) : 0, 54019
Remote Config [baseline] (707.603 µs) : 0, 708
Remote Config [candidate] (717.762 µs) : 0, 718
Telemetry [baseline] (8.75 ms) : 0, 8750
Telemetry [candidate] (8.834 ms) : 0, 8834
ProfilingAgent [baseline] (94.86 ms) : 0, 94860
ProfilingAgent [candidate] (94.833 ms) : 0, 94833
Profiling [baseline] (94.884 ms) : 0, 94884
Profiling [candidate] (94.858 ms) : 0, 94858
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 17 unstable metrics. Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.46.0-SNAPSHOT~adb1dce868, baseline=1.46.0-SNAPSHOT~64e6e864bc
dateFormat X
axisFormat %s
section baseline
no_agent (381.379 µs) : 362, 401
. : milestone, 381,
iast (503.278 µs) : 482, 525
. : milestone, 503,
iast_FULL (746.443 µs) : 724, 769
. : milestone, 746,
iast_GLOBAL (553.47 µs) : 530, 577
. : milestone, 553,
iast_HARDCODED_SECRET_DISABLED (504.069 µs) : 481, 527
. : milestone, 504,
iast_INACTIVE (456.811 µs) : 435, 478
. : milestone, 457,
iast_TELEMETRY_OFF (491.322 µs) : 468, 515
. : milestone, 491,
tracing (451.126 µs) : 430, 472
. : milestone, 451,
section candidate
no_agent (374.368 µs) : 355, 394
. : milestone, 374,
iast (510.25 µs) : 488, 532
. : milestone, 510,
iast_FULL (742.455 µs) : 720, 765
. : milestone, 742,
iast_GLOBAL (554.352 µs) : 532, 577
. : milestone, 554,
iast_HARDCODED_SECRET_DISABLED (502.958 µs) : 481, 524
. : milestone, 503,
iast_INACTIVE (457.466 µs) : 436, 479
. : milestone, 457,
iast_TELEMETRY_OFF (495.591 µs) : 473, 518
. : milestone, 496,
tracing (449.238 µs) : 428, 470
. : milestone, 449,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.46.0-SNAPSHOT~adb1dce868, baseline=1.46.0-SNAPSHOT~64e6e864bc
dateFormat X
axisFormat %s
section baseline
no_agent (1.349 ms) : 1329, 1368
. : milestone, 1349,
appsec (1.738 ms) : 1714, 1762
. : milestone, 1738,
appsec_no_iast (1.76 ms) : 1736, 1785
. : milestone, 1760,
iast (1.498 ms) : 1474, 1522
. : milestone, 1498,
profiling (1.512 ms) : 1489, 1535
. : milestone, 1512,
tracing (1.484 ms) : 1459, 1509
. : milestone, 1484,
section candidate
no_agent (1.362 ms) : 1341, 1383
. : milestone, 1362,
appsec (1.744 ms) : 1720, 1769
. : milestone, 1744,
appsec_no_iast (1.73 ms) : 1707, 1754
. : milestone, 1730,
iast (1.503 ms) : 1478, 1528
. : milestone, 1503,
profiling (1.519 ms) : 1497, 1542
. : milestone, 1519,
tracing (1.489 ms) : 1464, 1514
. : milestone, 1489,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 1 unstable metrics. Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.46.0-SNAPSHOT~adb1dce868, baseline=1.46.0-SNAPSHOT~64e6e864bc
dateFormat X
axisFormat %s
section baseline
no_agent (14.953 s) : 14953000, 14953000
. : milestone, 14953000,
appsec (15.202 s) : 15202000, 15202000
. : milestone, 15202000,
iast (18.798 s) : 18798000, 18798000
. : milestone, 18798000,
iast_GLOBAL (17.71 s) : 17710000, 17710000
. : milestone, 17710000,
profiling (15.073 s) : 15073000, 15073000
. : milestone, 15073000,
tracing (15.094 s) : 15094000, 15094000
. : milestone, 15094000,
section candidate
no_agent (15.455 s) : 15455000, 15455000
. : milestone, 15455000,
appsec (14.924 s) : 14924000, 14924000
. : milestone, 14924000,
iast (19.094 s) : 19094000, 19094000
. : milestone, 19094000,
iast_GLOBAL (18.005 s) : 18005000, 18005000
. : milestone, 18005000,
profiling (14.894 s) : 14894000, 14894000
. : milestone, 14894000,
tracing (14.928 s) : 14928000, 14928000
. : milestone, 14928000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.46.0-SNAPSHOT~adb1dce868, baseline=1.46.0-SNAPSHOT~64e6e864bc
dateFormat X
axisFormat %s
section baseline
no_agent (1.47 ms) : 1459, 1482
. : milestone, 1470,
appsec (2.345 ms) : 2302, 2388
. : milestone, 2345,
iast (2.11 ms) : 2055, 2165
. : milestone, 2110,
iast_GLOBAL (2.146 ms) : 2092, 2201
. : milestone, 2146,
profiling (2.465 ms) : 2277, 2653
. : milestone, 2465,
tracing (1.943 ms) : 1901, 1986
. : milestone, 1943,
section candidate
no_agent (1.479 ms) : 1467, 1490
. : milestone, 1479,
appsec (2.353 ms) : 2309, 2396
. : milestone, 2353,
iast (2.108 ms) : 2053, 2163
. : milestone, 2108,
iast_GLOBAL (2.152 ms) : 2097, 2208
. : milestone, 2152,
profiling (1.988 ms) : 1943, 2033
. : milestone, 1988,
tracing (1.942 ms) : 1900, 1984
. : milestone, 1942,
|
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the lambdainternal.EventHandlerLoader$PojoHandlerAsStreamHandler.handleRequest
is not published publicly, there is no way to test non-streaming handlers.
import java.io.IOException; | ||
import okio.BufferedSink; | ||
|
||
public final class ReadFromOutputStreamJsonAdapter extends JsonAdapter<ByteArrayOutputStream> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is another failure in the tests related to this:
groovy.lang.GroovyRuntimeException: Could not find matching constructor for: java.io.ByteArrayOutputStream([B)
at datadog.trace.lambda.LambdaHandlerTest.test moshi toJson OutputStream(LambdaHandlerTest.groovy:315)
23ba390
to
adb1dce
Compare
What Does This Do
Fixes regression described in #8247
Motivation
Additional Notes
Under the hood, the lambda runtime will convert non-streaming handlers to streaming handlers. (see https://github.com/cagataygurturk/lambda-java-runtime/blob/99706a1db64f95f8f86d3db96ca8a39297d1b669/lambdainternal/EventHandlerLoader.java#L721).
When both the non-streaming and streaming handlers were instrumented, only the streaming instrumentation would execute.
Thanks to #5422 we are able to properly capture the inbound event payloads for streaming handlers.
This PR uses that same logic to extract response payloads from response
OutputStream
objects.Now that we are only relying on the streaming handler instrumentation, the non-streaming instrumentation can be removed.
Testing
A lambda layer for this PR was published to serverless sandbox as
arn:aws:lambda:us-east-1:425362996713:layer:dd-trace-java-REY:1
The Trace Propagation Functional Tests were run using this layer (note that there are other unrelated failures in the test run). See https://github.com/DataDog/serverless-self-monitoring/actions/runs/12895384522
Contributor Checklist
type:
and (comp:
orinst:
) labels in addition to any usefull labelsclose
,fix
or any linking keywords when referencing an issue.Use
solves
instead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]