Conversation
…dropped when number of attributes exceeded limits
| .region(Region.of("us-east-1")) | ||
| .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create("test", "test"))) | ||
| .build() | ||
| .endpointOverride(URI.create(endPoint)) |
There was a problem hiding this comment.
These parts and below were auto-formatted on commit
71e79cc to
c1725ee
Compare
| public class SnsInterceptorTest { | ||
|
|
||
| @Test | ||
| void publishBatchPreservesEntriesAndOnlyInjectsBelowTheMessageAttributeLimit() { |
There was a problem hiding this comment.
New test that reproduces the issue
| } | ||
|
|
||
| @Test | ||
| void publishPreservesReadonlyAttributesWhileAddingDatadogContext() { |
There was a problem hiding this comment.
Migrated from Spock to JUnit
…to SnsInterceptorTest
a63cb8c to
f5bcaf7
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.62.0-SNAPSHOT~46a68e05b5, baseline=1.62.0-SNAPSHOT~63343baba3
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.062 s) : 0, 1061527
Total [baseline] (8.848 s) : 0, 8847606
Agent [candidate] (1.061 s) : 0, 1061110
Total [candidate] (8.828 s) : 0, 8827673
section iast
Agent [baseline] (1.239 s) : 0, 1239378
Total [baseline] (9.647 s) : 0, 9646644
Agent [candidate] (1.231 s) : 0, 1231237
Total [candidate] (9.564 s) : 0, 9564164
gantt
title insecure-bank - break down per module: candidate=1.62.0-SNAPSHOT~46a68e05b5, baseline=1.62.0-SNAPSHOT~63343baba3
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.243 ms) : 0, 1243
crashtracking [candidate] (1.247 ms) : 0, 1247
BytebuddyAgent [baseline] (635.703 ms) : 0, 635703
BytebuddyAgent [candidate] (636.93 ms) : 0, 636930
AgentMeter [baseline] (29.729 ms) : 0, 29729
AgentMeter [candidate] (29.735 ms) : 0, 29735
GlobalTracer [baseline] (249.643 ms) : 0, 249643
GlobalTracer [candidate] (249.751 ms) : 0, 249751
AppSec [baseline] (32.607 ms) : 0, 32607
AppSec [candidate] (32.298 ms) : 0, 32298
Debugger [baseline] (59.194 ms) : 0, 59194
Debugger [candidate] (58.834 ms) : 0, 58834
Remote Config [baseline] (585.815 µs) : 0, 586
Remote Config [candidate] (592.185 µs) : 0, 592
Telemetry [baseline] (8.82 ms) : 0, 8820
Telemetry [candidate] (7.992 ms) : 0, 7992
Flare Poller [baseline] (7.595 ms) : 0, 7595
Flare Poller [candidate] (7.444 ms) : 0, 7444
section iast
crashtracking [baseline] (1.258 ms) : 0, 1258
crashtracking [candidate] (1.235 ms) : 0, 1235
BytebuddyAgent [baseline] (817.171 ms) : 0, 817171
BytebuddyAgent [candidate] (809.333 ms) : 0, 809333
AgentMeter [baseline] (11.461 ms) : 0, 11461
AgentMeter [candidate] (11.421 ms) : 0, 11421
GlobalTracer [baseline] (239.222 ms) : 0, 239222
GlobalTracer [candidate] (239.155 ms) : 0, 239155
AppSec [baseline] (29.365 ms) : 0, 29365
AppSec [candidate] (26.623 ms) : 0, 26623
Debugger [baseline] (62.982 ms) : 0, 62982
Debugger [candidate] (64.889 ms) : 0, 64889
Remote Config [baseline] (532.071 µs) : 0, 532
Remote Config [candidate] (526.62 µs) : 0, 527
Telemetry [baseline] (7.791 ms) : 0, 7791
Telemetry [candidate] (7.749 ms) : 0, 7749
Flare Poller [baseline] (3.476 ms) : 0, 3476
Flare Poller [candidate] (3.417 ms) : 0, 3417
IAST [baseline] (29.087 ms) : 0, 29087
IAST [candidate] (29.98 ms) : 0, 29980
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.62.0-SNAPSHOT~46a68e05b5, baseline=1.62.0-SNAPSHOT~63343baba3
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.06 s) : 0, 1059571
Total [baseline] (11.086 s) : 0, 11086431
Agent [candidate] (1.063 s) : 0, 1063192
Total [candidate] (11.152 s) : 0, 11152453
section appsec
Agent [baseline] (1.269 s) : 0, 1269072
Total [baseline] (11.092 s) : 0, 11091906
Agent [candidate] (1.261 s) : 0, 1260548
Total [candidate] (10.969 s) : 0, 10969313
section iast
Agent [baseline] (1.241 s) : 0, 1241246
Total [baseline] (11.4 s) : 0, 11400410
Agent [candidate] (1.235 s) : 0, 1234634
Total [candidate] (11.461 s) : 0, 11460744
section profiling
Agent [baseline] (1.187 s) : 0, 1187253
Total [baseline] (11.006 s) : 0, 11005864
Agent [candidate] (1.187 s) : 0, 1186941
Total [candidate] (11.067 s) : 0, 11066609
gantt
title petclinic - break down per module: candidate=1.62.0-SNAPSHOT~46a68e05b5, baseline=1.62.0-SNAPSHOT~63343baba3
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.242 ms) : 0, 1242
crashtracking [candidate] (1.24 ms) : 0, 1240
BytebuddyAgent [baseline] (633.156 ms) : 0, 633156
BytebuddyAgent [candidate] (635.112 ms) : 0, 635112
AgentMeter [baseline] (29.897 ms) : 0, 29897
AgentMeter [candidate] (29.64 ms) : 0, 29640
GlobalTracer [baseline] (250.684 ms) : 0, 250684
GlobalTracer [candidate] (249.521 ms) : 0, 249521
AppSec [baseline] (32.597 ms) : 0, 32597
AppSec [candidate] (32.461 ms) : 0, 32461
Debugger [baseline] (60.318 ms) : 0, 60318
Debugger [candidate] (60.268 ms) : 0, 60268
Remote Config [baseline] (597.395 µs) : 0, 597
Remote Config [candidate] (598.388 µs) : 0, 598
Telemetry [baseline] (8.08 ms) : 0, 8080
Telemetry [candidate] (8.105 ms) : 0, 8105
Flare Poller [baseline] (6.778 ms) : 0, 6778
Flare Poller [candidate] (9.84 ms) : 0, 9840
section appsec
crashtracking [baseline] (1.251 ms) : 0, 1251
crashtracking [candidate] (1.252 ms) : 0, 1252
BytebuddyAgent [baseline] (678.342 ms) : 0, 678342
BytebuddyAgent [candidate] (673.995 ms) : 0, 673995
AgentMeter [baseline] (12.18 ms) : 0, 12180
AgentMeter [candidate] (12.128 ms) : 0, 12128
GlobalTracer [baseline] (250.026 ms) : 0, 250026
GlobalTracer [candidate] (248.626 ms) : 0, 248626
IAST [baseline] (24.5 ms) : 0, 24500
IAST [candidate] (24.275 ms) : 0, 24275
AppSec [baseline] (186.803 ms) : 0, 186803
AppSec [candidate] (187.168 ms) : 0, 187168
Debugger [baseline] (67.171 ms) : 0, 67171
Debugger [candidate] (64.804 ms) : 0, 64804
Remote Config [baseline] (595.21 µs) : 0, 595
Remote Config [candidate] (588.811 µs) : 0, 589
Telemetry [baseline] (8.079 ms) : 0, 8079
Telemetry [candidate] (7.836 ms) : 0, 7836
Flare Poller [baseline] (3.553 ms) : 0, 3553
Flare Poller [candidate] (3.432 ms) : 0, 3432
section iast
crashtracking [baseline] (1.228 ms) : 0, 1228
crashtracking [candidate] (1.225 ms) : 0, 1225
BytebuddyAgent [baseline] (815.833 ms) : 0, 815833
BytebuddyAgent [candidate] (810.782 ms) : 0, 810782
AgentMeter [baseline] (11.538 ms) : 0, 11538
AgentMeter [candidate] (11.462 ms) : 0, 11462
GlobalTracer [baseline] (240.467 ms) : 0, 240467
GlobalTracer [candidate] (239.795 ms) : 0, 239795
IAST [baseline] (28.586 ms) : 0, 28586
IAST [candidate] (29.292 ms) : 0, 29292
AppSec [baseline] (27.939 ms) : 0, 27939
AppSec [candidate] (27.502 ms) : 0, 27502
Debugger [baseline] (67.528 ms) : 0, 67528
Debugger [candidate] (65.751 ms) : 0, 65751
Remote Config [baseline] (537.594 µs) : 0, 538
Remote Config [candidate] (535.669 µs) : 0, 536
Telemetry [baseline] (7.825 ms) : 0, 7825
Telemetry [candidate] (7.829 ms) : 0, 7829
Flare Poller [baseline] (3.442 ms) : 0, 3442
Flare Poller [candidate] (3.454 ms) : 0, 3454
section profiling
crashtracking [baseline] (1.184 ms) : 0, 1184
crashtracking [candidate] (1.183 ms) : 0, 1183
BytebuddyAgent [baseline] (692.804 ms) : 0, 692804
BytebuddyAgent [candidate] (692.852 ms) : 0, 692852
AgentMeter [baseline] (9.268 ms) : 0, 9268
AgentMeter [candidate] (9.206 ms) : 0, 9206
GlobalTracer [baseline] (207.386 ms) : 0, 207386
GlobalTracer [candidate] (207.372 ms) : 0, 207372
AppSec [baseline] (32.868 ms) : 0, 32868
AppSec [candidate] (32.968 ms) : 0, 32968
Debugger [baseline] (65.946 ms) : 0, 65946
Debugger [candidate] (65.9 ms) : 0, 65900
Remote Config [baseline] (579.237 µs) : 0, 579
Remote Config [candidate] (585.871 µs) : 0, 586
Telemetry [baseline] (7.788 ms) : 0, 7788
Telemetry [candidate] (7.781 ms) : 0, 7781
Flare Poller [baseline] (3.552 ms) : 0, 3552
Flare Poller [candidate] (3.523 ms) : 0, 3523
ProfilingAgent [baseline] (94.289 ms) : 0, 94289
ProfilingAgent [candidate] (94.16 ms) : 0, 94160
Profiling [baseline] (94.848 ms) : 0, 94848
Profiling [candidate] (94.717 ms) : 0, 94717
LoadParameters
See matching parameters
SummaryFound 5 performance improvements and 1 performance regressions! Performance is the same for 14 metrics, 16 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.62.0-SNAPSHOT~46a68e05b5, baseline=1.62.0-SNAPSHOT~63343baba3
dateFormat X
axisFormat %s
section baseline
no_agent (17.294 ms) : 17120, 17467
. : milestone, 17294,
appsec (18.728 ms) : 18536, 18921
. : milestone, 18728,
code_origins (19.067 ms) : 18878, 19257
. : milestone, 19067,
iast (18.708 ms) : 18520, 18896
. : milestone, 18708,
profiling (19.009 ms) : 18820, 19197
. : milestone, 19009,
tracing (18.099 ms) : 17918, 18281
. : milestone, 18099,
section candidate
no_agent (18.267 ms) : 18084, 18450
. : milestone, 18267,
appsec (18.754 ms) : 18566, 18941
. : milestone, 18754,
code_origins (17.941 ms) : 17764, 18118
. : milestone, 17941,
iast (17.921 ms) : 17744, 18099
. : milestone, 17921,
profiling (18.264 ms) : 18084, 18445
. : milestone, 18264,
tracing (19.079 ms) : 18887, 19271
. : milestone, 19079,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.62.0-SNAPSHOT~46a68e05b5, baseline=1.62.0-SNAPSHOT~63343baba3
dateFormat X
axisFormat %s
section baseline
no_agent (1.266 ms) : 1253, 1279
. : milestone, 1266,
iast (3.522 ms) : 3472, 3571
. : milestone, 3522,
iast_FULL (5.989 ms) : 5928, 6049
. : milestone, 5989,
iast_GLOBAL (3.711 ms) : 3652, 3770
. : milestone, 3711,
profiling (2.22 ms) : 2198, 2241
. : milestone, 2220,
tracing (1.871 ms) : 1855, 1888
. : milestone, 1871,
section candidate
no_agent (1.248 ms) : 1237, 1260
. : milestone, 1248,
iast (3.389 ms) : 3339, 3439
. : milestone, 3389,
iast_FULL (6.038 ms) : 5977, 6100
. : milestone, 6038,
iast_GLOBAL (3.727 ms) : 3664, 3789
. : milestone, 3727,
profiling (2.185 ms) : 2165, 2206
. : milestone, 2185,
tracing (1.903 ms) : 1886, 1919
. : milestone, 1903,
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.62.0-SNAPSHOT~46a68e05b5, baseline=1.62.0-SNAPSHOT~63343baba3
dateFormat X
axisFormat %s
section baseline
no_agent (15.531 s) : 15531000, 15531000
. : milestone, 15531000,
appsec (14.828 s) : 14828000, 14828000
. : milestone, 14828000,
iast (18.255 s) : 18255000, 18255000
. : milestone, 18255000,
iast_GLOBAL (18.432 s) : 18432000, 18432000
. : milestone, 18432000,
profiling (15.511 s) : 15511000, 15511000
. : milestone, 15511000,
tracing (14.87 s) : 14870000, 14870000
. : milestone, 14870000,
section candidate
no_agent (15.4 s) : 15400000, 15400000
. : milestone, 15400000,
appsec (14.941 s) : 14941000, 14941000
. : milestone, 14941000,
iast (18.924 s) : 18924000, 18924000
. : milestone, 18924000,
iast_GLOBAL (17.957 s) : 17957000, 17957000
. : milestone, 17957000,
profiling (15.439 s) : 15439000, 15439000
. : milestone, 15439000,
tracing (14.75 s) : 14750000, 14750000
. : milestone, 14750000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.62.0-SNAPSHOT~46a68e05b5, baseline=1.62.0-SNAPSHOT~63343baba3
dateFormat X
axisFormat %s
section baseline
no_agent (1.484 ms) : 1472, 1495
. : milestone, 1484,
appsec (3.839 ms) : 3614, 4063
. : milestone, 3839,
iast (2.282 ms) : 2213, 2352
. : milestone, 2282,
iast_GLOBAL (2.321 ms) : 2251, 2391
. : milestone, 2321,
profiling (2.105 ms) : 2050, 2160
. : milestone, 2105,
tracing (2.077 ms) : 2023, 2130
. : milestone, 2077,
section candidate
no_agent (1.492 ms) : 1481, 1504
. : milestone, 1492,
appsec (3.886 ms) : 3655, 4117
. : milestone, 3886,
iast (2.284 ms) : 2213, 2354
. : milestone, 2284,
iast_GLOBAL (2.33 ms) : 2259, 2400
. : milestone, 2330,
profiling (2.093 ms) : 2038, 2148
. : milestone, 2093,
tracing (2.082 ms) : 2029, 2136
. : milestone, 2082,
|
| withDatadogAttribute(entry.messageAttributes(), sdkBytes); | ||
| modified = entry.toBuilder().messageAttributes(messageAttributes).build(); | ||
| } | ||
| entries.add(modified); |
There was a problem hiding this comment.
Bug fix. Now add entry unconditionally
| Map<String, MessageAttributeValue> modified = new HashMap<>(attributes); | ||
| // Use Binary since SNS subscription filter policies fail silently with JSON strings | ||
| // https://github.com/DataDog/datadog-lambda-js/pull/269 | ||
| modified.put( |
There was a problem hiding this comment.
Extract duplicated parts to this helper method
| return context.request(); | ||
| } | ||
|
|
||
| private DataStreamsTags getTags(String snsTopicName) { |
There was a problem hiding this comment.
Inlined getTags as it's used only once
| public class SnsInterceptor implements ExecutionInterceptor { | ||
|
|
||
| // SQS subscriber limit; SNS inherits it when SQS is used as a subscriber | ||
| private static final int MAX_MESSAGE_ATTRIBUTES = 10; |
There was a problem hiding this comment.
Introduce a constant for clarity and deduplication
| abstract String expectedOperation(String awsService, String awsOperation) | ||
| abstract String expectedService(String awsService, String awsOperation) | ||
|
|
||
| def "trace details propagated when message attributes are readonly"() { |
There was a problem hiding this comment.
This test has been moved to the JUnit test suit
324b6af to
4463b14
Compare
4463b14 to
46a68e0
Compare
What Does This Do
Fixes SNS v2 batch injection bug that causes a batch entry to be dropped when the number of attributes exceeded limits.
Motivation
Fix the bug affecting the application's logic due to an instrumentation flaw.
Additional Notes
Ref: #7150
Contributor 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: APMS-19177
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.