-
Notifications
You must be signed in to change notification settings - Fork 292
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 aws sns instrumentation for AWS lambda #6908
Conversation
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 49 metrics, 14 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.35.0-SNAPSHOT~14a9d87393, baseline=1.35.0-SNAPSHOT~dadbd53b67
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.062 s) : 0, 1062161
Total [baseline] (8.632 s) : 0, 8631528
Agent [candidate] (1.073 s) : 0, 1073161
Total [candidate] (8.57 s) : 0, 8570490
section iast
Agent [baseline] (1.165 s) : 0, 1164810
Total [baseline] (8.977 s) : 0, 8977457
Agent [candidate] (1.164 s) : 0, 1163668
Total [candidate] (8.984 s) : 0, 8983529
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.174 s) : 0, 1173627
Total [baseline] (8.97 s) : 0, 8969805
Agent [candidate] (1.165 s) : 0, 1165369
Total [candidate] (8.974 s) : 0, 8973795
section iast_TELEMETRY_OFF
Agent [baseline] (1.161 s) : 0, 1161152
Total [baseline] (9.013 s) : 0, 9013260
Agent [candidate] (1.172 s) : 0, 1171817
Total [candidate] (8.993 s) : 0, 8993253
gantt
title insecure-bank - break down per module: candidate=1.35.0-SNAPSHOT~14a9d87393, baseline=1.35.0-SNAPSHOT~dadbd53b67
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (655.557 ms) : 0, 655557
BytebuddyAgent [candidate] (662.201 ms) : 0, 662201
GlobalTracer [baseline] (313.789 ms) : 0, 313789
GlobalTracer [candidate] (316.996 ms) : 0, 316996
AppSec [baseline] (50.009 ms) : 0, 50009
AppSec [candidate] (50.564 ms) : 0, 50564
Remote Config [baseline] (661.416 µs) : 0, 661
Remote Config [candidate] (682.597 µs) : 0, 683
Telemetry [baseline] (7.585 ms) : 0, 7585
Telemetry [candidate] (7.759 ms) : 0, 7759
section iast
BytebuddyAgent [baseline] (777.743 ms) : 0, 777743
BytebuddyAgent [candidate] (778.276 ms) : 0, 778276
GlobalTracer [baseline] (291.726 ms) : 0, 291726
GlobalTracer [candidate] (291.423 ms) : 0, 291423
AppSec [baseline] (50.047 ms) : 0, 50047
AppSec [candidate] (46.983 ms) : 0, 46983
IAST [baseline] (22.303 ms) : 0, 22303
IAST [candidate] (26.235 ms) : 0, 26235
Remote Config [baseline] (584.511 µs) : 0, 585
Remote Config [candidate] (593.415 µs) : 0, 593
Telemetry [baseline] (9.155 ms) : 0, 9155
Telemetry [candidate] (6.912 ms) : 0, 6912
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (784.462 ms) : 0, 784462
BytebuddyAgent [candidate] (777.822 ms) : 0, 777822
GlobalTracer [baseline] (294.274 ms) : 0, 294274
GlobalTracer [candidate] (292.086 ms) : 0, 292086
AppSec [baseline] (48.038 ms) : 0, 48038
AppSec [candidate] (46.724 ms) : 0, 46724
IAST [baseline] (25.139 ms) : 0, 25139
IAST [candidate] (27.174 ms) : 0, 27174
Remote Config [baseline] (599.773 µs) : 0, 600
Remote Config [candidate] (591.925 µs) : 0, 592
Telemetry [baseline] (7.712 ms) : 0, 7712
Telemetry [candidate] (7.628 ms) : 0, 7628
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (776.456 ms) : 0, 776456
BytebuddyAgent [candidate] (782.742 ms) : 0, 782742
GlobalTracer [baseline] (291.832 ms) : 0, 291832
GlobalTracer [candidate] (293.925 ms) : 0, 293925
AppSec [baseline] (48.977 ms) : 0, 48977
AppSec [candidate] (50.188 ms) : 0, 50188
IAST [baseline] (22.302 ms) : 0, 22302
IAST [candidate] (22.751 ms) : 0, 22751
Remote Config [baseline] (625.626 µs) : 0, 626
Remote Config [candidate] (583.864 µs) : 0, 584
Telemetry [baseline] (7.665 ms) : 0, 7665
Telemetry [candidate] (8.264 ms) : 0, 8264
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.35.0-SNAPSHOT~14a9d87393, baseline=1.35.0-SNAPSHOT~dadbd53b67
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.066 s) : 0, 1065726
Total [baseline] (10.447 s) : 0, 10446663
Agent [candidate] (1.065 s) : 0, 1064625
Total [candidate] (10.353 s) : 0, 10353226
section appsec
Agent [baseline] (1.177 s) : 0, 1176856
Total [baseline] (10.469 s) : 0, 10469093
Agent [candidate] (1.184 s) : 0, 1183859
Total [candidate] (10.554 s) : 0, 10553678
section iast
Agent [baseline] (1.172 s) : 0, 1171720
Total [baseline] (10.775 s) : 0, 10774806
Agent [candidate] (1.165 s) : 0, 1165137
Total [candidate] (10.749 s) : 0, 10749487
section profiling
Agent [baseline] (1.257 s) : 0, 1256615
Total [baseline] (10.605 s) : 0, 10605190
Agent [candidate] (1.266 s) : 0, 1266257
Total [candidate] (10.6 s) : 0, 10600281
gantt
title petclinic - break down per module: candidate=1.35.0-SNAPSHOT~14a9d87393, baseline=1.35.0-SNAPSHOT~dadbd53b67
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (657.344 ms) : 0, 657344
BytebuddyAgent [candidate] (656.714 ms) : 0, 656714
GlobalTracer [baseline] (315.338 ms) : 0, 315338
GlobalTracer [candidate] (314.761 ms) : 0, 314761
AppSec [baseline] (50.18 ms) : 0, 50180
AppSec [candidate] (50.083 ms) : 0, 50083
Remote Config [baseline] (665.423 µs) : 0, 665
Remote Config [candidate] (684.512 µs) : 0, 685
Telemetry [baseline] (7.559 ms) : 0, 7559
Telemetry [candidate] (7.664 ms) : 0, 7664
section appsec
BytebuddyAgent [baseline] (675.007 ms) : 0, 675007
BytebuddyAgent [candidate] (679.421 ms) : 0, 679421
GlobalTracer [baseline] (295.961 ms) : 0, 295961
GlobalTracer [candidate] (297.393 ms) : 0, 297393
AppSec [baseline] (152.971 ms) : 0, 152971
AppSec [candidate] (153.444 ms) : 0, 153444
IAST [baseline] (18.805 ms) : 0, 18805
IAST [candidate] (19.038 ms) : 0, 19038
Remote Config [baseline] (617.774 µs) : 0, 618
Remote Config [candidate] (626.2 µs) : 0, 626
Telemetry [baseline] (8.463 ms) : 0, 8463
Telemetry [candidate] (8.791 ms) : 0, 8791
section iast
BytebuddyAgent [baseline] (784.483 ms) : 0, 784483
BytebuddyAgent [candidate] (778.685 ms) : 0, 778685
GlobalTracer [baseline] (294.414 ms) : 0, 294414
GlobalTracer [candidate] (292.029 ms) : 0, 292029
AppSec [baseline] (49.66 ms) : 0, 49660
AppSec [candidate] (48.36 ms) : 0, 48360
IAST [baseline] (22.323 ms) : 0, 22323
IAST [candidate] (24.628 ms) : 0, 24628
Remote Config [baseline] (589.465 µs) : 0, 589
Remote Config [candidate] (585.38 µs) : 0, 585
Telemetry [baseline] (6.955 ms) : 0, 6955
Telemetry [candidate] (7.621 ms) : 0, 7621
section profiling
BytebuddyAgent [baseline] (660.131 ms) : 0, 660131
BytebuddyAgent [candidate] (666.082 ms) : 0, 666082
GlobalTracer [baseline] (385.005 ms) : 0, 385005
GlobalTracer [candidate] (387.122 ms) : 0, 387122
AppSec [baseline] (50.7 ms) : 0, 50700
AppSec [candidate] (50.648 ms) : 0, 50648
Remote Config [baseline] (795.655 µs) : 0, 796
Remote Config [candidate] (848.965 µs) : 0, 849
Telemetry [baseline] (7.449 ms) : 0, 7449
Telemetry [candidate] (7.522 ms) : 0, 7522
ProfilingAgent [baseline] (96.188 ms) : 0, 96188
ProfilingAgent [candidate] (97.056 ms) : 0, 97056
Profiling [baseline] (96.212 ms) : 0, 96212
Profiling [candidate] (97.08 ms) : 0, 97080
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.35.0-SNAPSHOT~14a9d87393, baseline=1.35.0-SNAPSHOT~dadbd53b67
dateFormat X
axisFormat %s
section baseline
no_agent (368.784 µs) : 348, 389
. : milestone, 369,
iast (480.049 µs) : 459, 501
. : milestone, 480,
iast_FULL (551.57 µs) : 530, 573
. : milestone, 552,
iast_GLOBAL (503.083 µs) : 482, 524
. : milestone, 503,
iast_HARDCODED_SECRET_DISABLED (478.002 µs) : 457, 500
. : milestone, 478,
iast_INACTIVE (454.794 µs) : 433, 477
. : milestone, 455,
iast_TELEMETRY_OFF (482.811 µs) : 461, 504
. : milestone, 483,
tracing (441.758 µs) : 421, 463
. : milestone, 442,
section candidate
no_agent (370.811 µs) : 351, 391
. : milestone, 371,
iast (483.049 µs) : 461, 505
. : milestone, 483,
iast_FULL (553.72 µs) : 531, 576
. : milestone, 554,
iast_GLOBAL (502.704 µs) : 482, 524
. : milestone, 503,
iast_HARDCODED_SECRET_DISABLED (477.824 µs) : 457, 498
. : milestone, 478,
iast_INACTIVE (451.039 µs) : 430, 472
. : milestone, 451,
iast_TELEMETRY_OFF (467.399 µs) : 446, 488
. : milestone, 467,
tracing (442.913 µs) : 422, 463
. : milestone, 443,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.35.0-SNAPSHOT~14a9d87393, baseline=1.35.0-SNAPSHOT~dadbd53b67
dateFormat X
axisFormat %s
section baseline
no_agent (1.347 ms) : 1328, 1366
. : milestone, 1347,
appsec (1.707 ms) : 1682, 1732
. : milestone, 1707,
appsec_no_iast (1.685 ms) : 1660, 1710
. : milestone, 1685,
iast (1.477 ms) : 1454, 1500
. : milestone, 1477,
profiling (1.486 ms) : 1462, 1511
. : milestone, 1486,
tracing (1.47 ms) : 1445, 1496
. : milestone, 1470,
section candidate
no_agent (1.347 ms) : 1327, 1367
. : milestone, 1347,
appsec (1.728 ms) : 1704, 1752
. : milestone, 1728,
appsec_no_iast (1.722 ms) : 1698, 1746
. : milestone, 1722,
iast (1.479 ms) : 1456, 1503
. : milestone, 1479,
profiling (1.483 ms) : 1459, 1507
. : milestone, 1483,
tracing (1.471 ms) : 1445, 1496
. : milestone, 1471,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics. Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.35.0-SNAPSHOT~14a9d87393, baseline=1.35.0-SNAPSHOT~dadbd53b67
dateFormat X
axisFormat %s
section baseline
no_agent (14.819 s) : 14819000, 14819000
. : milestone, 14819000,
appsec (15.264 s) : 15264000, 15264000
. : milestone, 15264000,
iast (19.029 s) : 19029000, 19029000
. : milestone, 19029000,
iast_GLOBAL (17.873 s) : 17873000, 17873000
. : milestone, 17873000,
profiling (14.927 s) : 14927000, 14927000
. : milestone, 14927000,
tracing (15.316 s) : 15316000, 15316000
. : milestone, 15316000,
section candidate
no_agent (14.94 s) : 14940000, 14940000
. : milestone, 14940000,
appsec (15.153 s) : 15153000, 15153000
. : milestone, 15153000,
iast (18.595 s) : 18595000, 18595000
. : milestone, 18595000,
iast_GLOBAL (17.928 s) : 17928000, 17928000
. : milestone, 17928000,
profiling (15.089 s) : 15089000, 15089000
. : milestone, 15089000,
tracing (15.015 s) : 15015000, 15015000
. : milestone, 15015000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.35.0-SNAPSHOT~14a9d87393, baseline=1.35.0-SNAPSHOT~dadbd53b67
dateFormat X
axisFormat %s
section baseline
no_agent (1.472 ms) : 1461, 1484
. : milestone, 1472,
appsec (2.203 ms) : 2170, 2237
. : milestone, 2203,
iast (1.956 ms) : 1915, 1996
. : milestone, 1956,
iast_GLOBAL (2.0 ms) : 1959, 2042
. : milestone, 2000,
profiling (1.857 ms) : 1824, 1890
. : milestone, 1857,
tracing (1.837 ms) : 1805, 1870
. : milestone, 1837,
section candidate
no_agent (1.47 ms) : 1459, 1482
. : milestone, 1470,
appsec (2.212 ms) : 2178, 2247
. : milestone, 2212,
iast (1.973 ms) : 1932, 2015
. : milestone, 1973,
iast_GLOBAL (2.007 ms) : 1966, 2048
. : milestone, 2007,
profiling (1.856 ms) : 1824, 1889
. : milestone, 1856,
tracing (1.833 ms) : 1801, 1865
. : milestone, 1833,
|
I think you are doing the wrong injection type. Pathway contexts are for DSM. This is not useless, but if you want to do trace context propagation, you need to look at how it's done here Line 36 in ee9c0f8
|
b47db03
to
b9ff84d
Compare
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.
LGTM overall, tests for v2 need to be added
...sns-2.0/src/main/java/datadog/trace/instrumentation/aws/v2/sns/SnsClientInstrumentation.java
Outdated
Show resolved
Hide resolved
dd-java-agent/instrumentation/aws-java-sns-2.0/src/test/groovy/SnsClientTest.groovy
Show resolved
Hide resolved
.../aws-java-sns-1.0/src/main/java/datadog/trace/instrumentation/aws/v1/sns/SnsInterceptor.java
Show resolved
Hide resolved
.../aws-java-sns-1.0/src/main/java/datadog/trace/instrumentation/aws/v1/sns/SnsInterceptor.java
Outdated
Show resolved
Hide resolved
...sns-1.0/src/main/java/datadog/trace/instrumentation/aws/v1/sns/SnsClientInstrumentation.java
Outdated
Show resolved
Hide resolved
...sns-2.0/src/main/java/datadog/trace/instrumentation/aws/v2/sns/SnsClientInstrumentation.java
Outdated
Show resolved
Hide resolved
dd-java-agent/instrumentation/aws-java-sns-2.0/src/test/groovy/SnsClientTest.groovy
Outdated
Show resolved
Hide resolved
9375d36
to
26dc5c4
Compare
169ed63
to
fcd2358
Compare
82f6cdc
to
ae1a5b5
Compare
.../aws-java-sns-1.0/src/main/java/datadog/trace/instrumentation/aws/v1/sns/SnsInterceptor.java
Outdated
Show resolved
Hide resolved
.../aws-java-sns-1.0/src/main/java/datadog/trace/instrumentation/aws/v1/sns/SnsInterceptor.java
Outdated
Show resolved
Hide resolved
.../aws-java-sns-2.0/src/main/java/datadog/trace/instrumentation/aws/v2/sns/SnsInterceptor.java
Show resolved
Hide resolved
7e2774e
to
345f066
Compare
What Does This Do
Add AWS SNS Instrumentation for AWS Lambda. (Currently the trace is not connected even though the basic sdk instrumentation adds the X-Amzn-Trace-Id header in the AWS Request)
Implementation
ExecutionInterceptor
and add the tracecontext intoMessageAttributes
per message._datadog
messageAttribute to pass on the trace context. The messageAttribute use binary value. Therefore the implementation first converts the tracecontext into a json string then convert it to byteBuffer.Motivation
Testing
sdk v1 single message
Some Considerations
AWSTraceHeader
in SQS message's attributes (NOTE: NOT MessageAttributes. Also note that this is not a result fromReceiveMessage
calls.)ReceiveMessage
requests'getAttributeNames
we can use in SNS case?Jira ticket: https://datadoghq.atlassian.net/browse/SVLS-4780