-
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
Instrument Java Websocket API (JSR356) #8440
base: master
Are you sure you want to change the base?
Conversation
...et-1.0/src/main/java/datadog/trace/instrumentation/websocket/jsr256/TracingOutputStream.java
Outdated
Show resolved
Hide resolved
...ebsocket-1.0/src/main/java/datadog/trace/instrumentation/websocket/jsr256/TracingWriter.java
Outdated
Show resolved
Hide resolved
...trap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/WebsocketDecorator.java
Show resolved
Hide resolved
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 58 metrics, 5 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.48.0-SNAPSHOT~700b1c341a, baseline=1.48.0-SNAPSHOT~6055d50b80
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.039 s) : 0, 1038650
Total [baseline] (8.701 s) : 0, 8701130
Agent [candidate] (1.042 s) : 0, 1042154
Total [candidate] (8.65 s) : 0, 8650428
section iast
Agent [baseline] (1.173 s) : 0, 1172863
Total [baseline] (9.309 s) : 0, 9308892
Agent [candidate] (1.173 s) : 0, 1173480
Total [candidate] (9.249 s) : 0, 9248844
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.169 s) : 0, 1168826
Total [baseline] (9.162 s) : 0, 9162101
Agent [candidate] (1.172 s) : 0, 1172317
Total [candidate] (9.215 s) : 0, 9215359
section iast_TELEMETRY_OFF
Agent [baseline] (1.174 s) : 0, 1173966
Total [baseline] (9.255 s) : 0, 9254688
Agent [candidate] (1.169 s) : 0, 1168570
Total [candidate] (9.218 s) : 0, 9218188
gantt
title insecure-bank - break down per module: candidate=1.48.0-SNAPSHOT~700b1c341a, baseline=1.48.0-SNAPSHOT~6055d50b80
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (718.002 ms) : 0, 718002
BytebuddyAgent [candidate] (719.381 ms) : 0, 719381
GlobalTracer [baseline] (240.265 ms) : 0, 240265
GlobalTracer [candidate] (239.968 ms) : 0, 239968
AppSec [baseline] (55.45 ms) : 0, 55450
AppSec [candidate] (55.098 ms) : 0, 55098
Remote Config [baseline] (689.361 µs) : 0, 689
Remote Config [candidate] (687.012 µs) : 0, 687
Telemetry [baseline] (9.34 ms) : 0, 9340
Telemetry [candidate] (12.102 ms) : 0, 12102
section iast
BytebuddyAgent [baseline] (836.677 ms) : 0, 836677
BytebuddyAgent [candidate] (839.451 ms) : 0, 839451
GlobalTracer [baseline] (231.602 ms) : 0, 231602
GlobalTracer [candidate] (230.355 ms) : 0, 230355
IAST [baseline] (23.053 ms) : 0, 23053
IAST [candidate] (22.818 ms) : 0, 22818
AppSec [baseline] (57.185 ms) : 0, 57185
AppSec [candidate] (56.609 ms) : 0, 56609
Remote Config [baseline] (622.636 µs) : 0, 623
Remote Config [candidate] (607.241 µs) : 0, 607
Telemetry [baseline] (8.838 ms) : 0, 8838
Telemetry [candidate] (8.695 ms) : 0, 8695
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (835.545 ms) : 0, 835545
BytebuddyAgent [candidate] (838.087 ms) : 0, 838087
GlobalTracer [baseline] (229.856 ms) : 0, 229856
GlobalTracer [candidate] (230.743 ms) : 0, 230743
IAST [baseline] (23.543 ms) : 0, 23543
IAST [candidate] (22.832 ms) : 0, 22832
AppSec [baseline] (55.589 ms) : 0, 55589
AppSec [candidate] (56.486 ms) : 0, 56486
Remote Config [baseline] (609.674 µs) : 0, 610
Remote Config [candidate] (613.099 µs) : 0, 613
Telemetry [baseline] (8.725 ms) : 0, 8725
Telemetry [candidate] (8.66 ms) : 0, 8660
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (838.897 ms) : 0, 838897
BytebuddyAgent [candidate] (834.969 ms) : 0, 834969
GlobalTracer [baseline] (231.666 ms) : 0, 231666
GlobalTracer [candidate] (230.402 ms) : 0, 230402
IAST [baseline] (22.321 ms) : 0, 22321
IAST [candidate] (22.307 ms) : 0, 22307
AppSec [baseline] (56.699 ms) : 0, 56699
AppSec [candidate] (56.848 ms) : 0, 56848
Remote Config [baseline] (610.377 µs) : 0, 610
Remote Config [candidate] (621.287 µs) : 0, 621
Telemetry [baseline] (8.654 ms) : 0, 8654
Telemetry [candidate] (8.555 ms) : 0, 8555
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.48.0-SNAPSHOT~700b1c341a, baseline=1.48.0-SNAPSHOT~6055d50b80
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.042 s) : 0, 1041809
Total [baseline] (10.482 s) : 0, 10481645
Agent [candidate] (1.047 s) : 0, 1046529
Total [candidate] (10.509 s) : 0, 10509490
section appsec
Agent [baseline] (1.188 s) : 0, 1187651
Total [baseline] (10.743 s) : 0, 10742917
Agent [candidate] (1.187 s) : 0, 1186918
Total [candidate] (10.794 s) : 0, 10793677
section iast
Agent [baseline] (1.178 s) : 0, 1177676
Total [baseline] (10.991 s) : 0, 10990942
Agent [candidate] (1.171 s) : 0, 1170649
Total [candidate] (11.029 s) : 0, 11028756
section profiling
Agent [baseline] (1.259 s) : 0, 1259258
Total [baseline] (10.795 s) : 0, 10795018
Agent [candidate] (1.258 s) : 0, 1257986
Total [candidate] (10.802 s) : 0, 10801931
gantt
title petclinic - break down per module: candidate=1.48.0-SNAPSHOT~700b1c341a, baseline=1.48.0-SNAPSHOT~6055d50b80
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (718.546 ms) : 0, 718546
BytebuddyAgent [candidate] (722.086 ms) : 0, 722086
GlobalTracer [baseline] (239.581 ms) : 0, 239581
GlobalTracer [candidate] (241.064 ms) : 0, 241064
AppSec [baseline] (55.263 ms) : 0, 55263
AppSec [candidate] (55.383 ms) : 0, 55383
Remote Config [baseline] (685.373 µs) : 0, 685
Remote Config [candidate] (694.091 µs) : 0, 694
Telemetry [baseline] (12.772 ms) : 0, 12772
Telemetry [candidate] (12.281 ms) : 0, 12281
section appsec
BytebuddyAgent [baseline] (738.942 ms) : 0, 738942
BytebuddyAgent [candidate] (738.347 ms) : 0, 738347
GlobalTracer [baseline] (236.877 ms) : 0, 236877
GlobalTracer [candidate] (237.276 ms) : 0, 237276
AppSec [baseline] (177.153 ms) : 0, 177153
AppSec [candidate] (176.271 ms) : 0, 176271
Remote Config [baseline] (662.062 µs) : 0, 662
Remote Config [candidate] (657.616 µs) : 0, 658
Telemetry [baseline] (8.278 ms) : 0, 8278
Telemetry [candidate] (8.689 ms) : 0, 8689
IAST [baseline] (21.47 ms) : 0, 21470
IAST [candidate] (21.423 ms) : 0, 21423
section iast
BytebuddyAgent [baseline] (842.165 ms) : 0, 842165
BytebuddyAgent [candidate] (837.151 ms) : 0, 837151
GlobalTracer [baseline] (231.165 ms) : 0, 231165
GlobalTracer [candidate] (230.126 ms) : 0, 230126
AppSec [baseline] (56.052 ms) : 0, 56052
AppSec [candidate] (56.568 ms) : 0, 56568
Remote Config [baseline] (614.976 µs) : 0, 615
Remote Config [candidate] (601.011 µs) : 0, 601
Telemetry [baseline] (8.753 ms) : 0, 8753
Telemetry [candidate] (8.642 ms) : 0, 8642
IAST [baseline] (23.874 ms) : 0, 23874
IAST [candidate] (22.601 ms) : 0, 22601
section profiling
BytebuddyAgent [baseline] (709.769 ms) : 0, 709769
BytebuddyAgent [candidate] (708.682 ms) : 0, 708682
GlobalTracer [baseline] (348.752 ms) : 0, 348752
GlobalTracer [candidate] (349.405 ms) : 0, 349405
AppSec [baseline] (54.852 ms) : 0, 54852
AppSec [candidate] (53.821 ms) : 0, 53821
Remote Config [baseline] (674.229 µs) : 0, 674
Remote Config [candidate] (669.983 µs) : 0, 670
Telemetry [baseline] (8.955 ms) : 0, 8955
Telemetry [candidate] (8.856 ms) : 0, 8856
ProfilingAgent [baseline] (95.879 ms) : 0, 95879
ProfilingAgent [candidate] (96.164 ms) : 0, 96164
Profiling [baseline] (95.903 ms) : 0, 95903
Profiling [candidate] (96.188 ms) : 0, 96188
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 14 metrics, 16 unstable metrics. Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.48.0-SNAPSHOT~700b1c341a, baseline=1.48.0-SNAPSHOT~6055d50b80
dateFormat X
axisFormat %s
section baseline
no_agent (382.102 µs) : 362, 402
. : milestone, 382,
iast (516.934 µs) : 495, 539
. : milestone, 517,
iast_FULL (733.47 µs) : 711, 756
. : milestone, 733,
iast_GLOBAL (557.08 µs) : 535, 579
. : milestone, 557,
iast_HARDCODED_SECRET_DISABLED (521.222 µs) : 499, 544
. : milestone, 521,
iast_INACTIVE (473.384 µs) : 451, 496
. : milestone, 473,
iast_TELEMETRY_OFF (510.493 µs) : 487, 534
. : milestone, 510,
tracing (465.289 µs) : 444, 486
. : milestone, 465,
section candidate
no_agent (385.448 µs) : 365, 406
. : milestone, 385,
iast (518.424 µs) : 497, 540
. : milestone, 518,
iast_FULL (740.665 µs) : 719, 763
. : milestone, 741,
iast_GLOBAL (565.355 µs) : 543, 588
. : milestone, 565,
iast_HARDCODED_SECRET_DISABLED (525.582 µs) : 503, 548
. : milestone, 526,
iast_INACTIVE (473.14 µs) : 452, 495
. : milestone, 473,
iast_TELEMETRY_OFF (514.538 µs) : 491, 538
. : milestone, 515,
tracing (460.98 µs) : 440, 482
. : milestone, 461,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.48.0-SNAPSHOT~700b1c341a, baseline=1.48.0-SNAPSHOT~6055d50b80
dateFormat X
axisFormat %s
section baseline
no_agent (1.378 ms) : 1359, 1398
. : milestone, 1378,
appsec (1.739 ms) : 1715, 1763
. : milestone, 1739,
appsec_no_iast (1.729 ms) : 1704, 1754
. : milestone, 1729,
code_origins (1.674 ms) : 1641, 1706
. : milestone, 1674,
iast (1.526 ms) : 1502, 1550
. : milestone, 1526,
profiling (1.504 ms) : 1481, 1528
. : milestone, 1504,
tracing (1.494 ms) : 1469, 1519
. : milestone, 1494,
section candidate
no_agent (1.37 ms) : 1350, 1390
. : milestone, 1370,
appsec (1.738 ms) : 1713, 1762
. : milestone, 1738,
appsec_no_iast (1.741 ms) : 1716, 1765
. : milestone, 1741,
code_origins (1.696 ms) : 1662, 1730
. : milestone, 1696,
iast (1.502 ms) : 1478, 1527
. : milestone, 1502,
profiling (1.53 ms) : 1506, 1553
. : milestone, 1530,
tracing (1.479 ms) : 1454, 1505
. : milestone, 1479,
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.48.0-SNAPSHOT~700b1c341a, baseline=1.48.0-SNAPSHOT~6055d50b80
dateFormat X
axisFormat %s
section baseline
no_agent (14.925 s) : 14925000, 14925000
. : milestone, 14925000,
appsec (15.312 s) : 15312000, 15312000
. : milestone, 15312000,
iast (18.554 s) : 18554000, 18554000
. : milestone, 18554000,
iast_GLOBAL (18.276 s) : 18276000, 18276000
. : milestone, 18276000,
profiling (14.973 s) : 14973000, 14973000
. : milestone, 14973000,
tracing (14.984 s) : 14984000, 14984000
. : milestone, 14984000,
section candidate
no_agent (15.493 s) : 15493000, 15493000
. : milestone, 15493000,
appsec (14.896 s) : 14896000, 14896000
. : milestone, 14896000,
iast (18.873 s) : 18873000, 18873000
. : milestone, 18873000,
iast_GLOBAL (17.756 s) : 17756000, 17756000
. : milestone, 17756000,
profiling (15.01 s) : 15010000, 15010000
. : milestone, 15010000,
tracing (14.928 s) : 14928000, 14928000
. : milestone, 14928000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.48.0-SNAPSHOT~700b1c341a, baseline=1.48.0-SNAPSHOT~6055d50b80
dateFormat X
axisFormat %s
section baseline
no_agent (1.467 ms) : 1455, 1478
. : milestone, 1467,
appsec (2.333 ms) : 2290, 2376
. : milestone, 2333,
iast (2.108 ms) : 2054, 2163
. : milestone, 2108,
iast_GLOBAL (2.158 ms) : 2103, 2214
. : milestone, 2158,
profiling (1.985 ms) : 1940, 2029
. : milestone, 1985,
tracing (1.945 ms) : 1903, 1987
. : milestone, 1945,
section candidate
no_agent (1.468 ms) : 1457, 1479
. : milestone, 1468,
appsec (2.335 ms) : 2292, 2379
. : milestone, 2335,
iast (2.111 ms) : 2056, 2167
. : milestone, 2111,
iast_GLOBAL (2.159 ms) : 2104, 2215
. : milestone, 2159,
profiling (1.957 ms) : 1913, 2000
. : milestone, 1957,
tracing (1.943 ms) : 1901, 1985
. : milestone, 1943,
|
b017c7b
to
52d9691
Compare
dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/asserts/LinksAssert.groovy
Outdated
Show resolved
Hide resolved
dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/asserts/LinksAssert.groovy
Show resolved
Hide resolved
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 are a lot of changes in this PR 😅
I will have a closer look the public and internal API later this week.
542304a
to
ab80d28
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.
Reviewed the API part and left some comments :)
Let me know if you need help with the OTel part.
private final Set<AgentSpanLink> assertedLinks = [] | ||
|
||
private LinksAssert(DDSpan span) { | ||
this.links = span.links // this is class protected but for the moment groovy can access it |
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.
Can it be left private
? Can’t groovy access them when private too?
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.
let me check it.
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.
Now I remember why. It does not work: (see that CI run)
It fails for
Caused by: groovy.lang.MissingPropertyException: No such property: links for class: datadog.trace.core.DDSpan$SpockMock$863262640
because that span it's got spied and then cannot be accessed if private. Any advice for it?
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.
Maybe just leave it as a comment with this reason.
@@ -107,7 +107,7 @@ static DDSpan create( | |||
*/ | |||
private volatile int longRunningVersion = 0; | |||
|
|||
private final List<AgentSpanLink> links; | |||
protected final List<AgentSpanLink> links; |
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.
Can it stay private
? -- see related comment in SpanLinkTest
internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/SpanLink.java
Outdated
Show resolved
Hide resolved
@@ -311,6 +311,7 @@ class OpenTelemetry14Test extends AgentTestRunner { | |||
assertTraces(1) { | |||
trace(1) { | |||
span { | |||
ignoreSpanLinks() // check is done on the content of the tag below |
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.
Do you need some help porting those checks?
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.
Thanks for proposing I don't refuse it :) I did this way mostly because here we wanted to check the serialized form so I just decided to skip them. Would you like to add the links
part on this test?
dd-java-agent/instrumentation/aws-java-s3-2.0/src/test/groovy/S3ClientTest.groovy
Show resolved
Hide resolved
dd-java-agent/instrumentation/aws-java-s3-2.0/src/test/groovy/S3ClientTest.groovy
Show resolved
Hide resolved
...n/jetty-9/src/main/java_jetty10/datadog/trace/instrumentation/jetty10/OnCompletedAdvice.java
Outdated
Show resolved
Hide resolved
assert span.tags.containsKey(DDTags.SPAN_LINKS) | ||
assert span.tags[DDTags.SPAN_LINKS] != null | ||
links({ | ||
link(DDTraceId.from((long)12052652441736835200), (long)-6394091631972716416) |
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.
Magic numbers?
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.
I don't know where they come from 🤷 That trace ID is hardcoded somwhere so I had to hardcode it as well
...6.0/src/test/groovy/datadog/trace/instrumentation/springweb6/boot/SpringBootBasedTest.groovy
Outdated
Show resolved
Hide resolved
...trap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/WebsocketDecorator.java
Show resolved
Hide resolved
...trap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/WebsocketDecorator.java
Show resolved
Hide resolved
...ootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/websocket/HandlerContext.java
Show resolved
Hide resolved
...ootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/websocket/HandlerContext.java
Show resolved
Hide resolved
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.
Congratulations on putting it all together! That's a big one! Great to see a lot of tests as well. Overall looks solid. I left a few notes for clarification.
cbd26e7
to
99e400b
Compare
22ce86b
to
a947aef
Compare
a947aef
to
700b1c3
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.
Looks good to me!
What Does This Do
Instrumenter module for
javax.websocket
andjakarta.websocket
APIs. Supports both client and server API.Provides spans for:
websocket.send
)websocket.receive
)websocket.close
)Tested with
Limitations
Endpoint
class but direct calls annotated methods viaMethodHandler
. An additional work is still needed to support themMotivation
Additional Notes
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: AIDM-535