-
Notifications
You must be signed in to change notification settings - Fork 279
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
Fix Protobuf schema sampling logic #7197
Conversation
@@ -36,7 +36,7 @@ public String hierarchyMarkerType() { | |||
public ElementMatcher<TypeDescription> hierarchyMatcher() { | |||
return declaresMethod(named("writeTo")) | |||
.and(extendsClass(named(hierarchyMarkerType()))) | |||
.and(not(nameStartsWith("com.google.protobuf"))); | |||
.and(not(nameStartsWith("com.google.protobuf")).or(named("com.google.protobuf.DynamicMessage"))); |
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.
This is another change, also related to schema tracking, to track dynamic message writes. I can remove it from this PR if needed.
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.
This is fine to me. You can add it to the additional notes
section for later, if someone wonders why it was added.
9d5f3a9
to
f1747e1
Compare
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 52 metrics, 11 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.36.0-SNAPSHOT~2cd7c6b057, baseline=1.36.0-SNAPSHOT~9bf5bbd556
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.069 s) : 0, 1068741
Total [baseline] (8.551 s) : 0, 8550612
Agent [candidate] (1.073 s) : 0, 1072506
Total [candidate] (8.61 s) : 0, 8609999
section iast
Agent [baseline] (1.176 s) : 0, 1175723
Total [baseline] (9.009 s) : 0, 9009469
Agent [candidate] (1.176 s) : 0, 1175916
Total [candidate] (8.991 s) : 0, 8990780
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.169 s) : 0, 1169192
Total [baseline] (8.994 s) : 0, 8993834
Agent [candidate] (1.171 s) : 0, 1170975
Total [candidate] (8.978 s) : 0, 8978384
section iast_TELEMETRY_OFF
Agent [baseline] (1.164 s) : 0, 1163626
Total [baseline] (8.997 s) : 0, 8997220
Agent [candidate] (1.166 s) : 0, 1166375
Total [candidate] (8.982 s) : 0, 8981944
gantt
title insecure-bank - break down per module: candidate=1.36.0-SNAPSHOT~2cd7c6b057, baseline=1.36.0-SNAPSHOT~9bf5bbd556
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (670.321 ms) : 0, 670321
BytebuddyAgent [candidate] (672.083 ms) : 0, 672083
GlobalTracer [baseline] (305.224 ms) : 0, 305224
GlobalTracer [candidate] (306.799 ms) : 0, 306799
AppSec [baseline] (50.26 ms) : 0, 50260
AppSec [candidate] (50.581 ms) : 0, 50581
Remote Config [baseline] (686.372 µs) : 0, 686
Remote Config [candidate] (696.438 µs) : 0, 696
Telemetry [baseline] (7.585 ms) : 0, 7585
Telemetry [candidate] (7.662 ms) : 0, 7662
section iast
BytebuddyAgent [baseline] (784.629 ms) : 0, 784629
BytebuddyAgent [candidate] (785.172 ms) : 0, 785172
GlobalTracer [baseline] (294.439 ms) : 0, 294439
GlobalTracer [candidate] (293.602 ms) : 0, 293602
AppSec [baseline] (47.148 ms) : 0, 47148
AppSec [candidate] (47.16 ms) : 0, 47160
IAST [baseline] (28.54 ms) : 0, 28540
IAST [candidate] (28.968 ms) : 0, 28968
Remote Config [baseline] (620.041 µs) : 0, 620
Remote Config [candidate] (672.151 µs) : 0, 672
Telemetry [baseline] (6.984 ms) : 0, 6984
Telemetry [candidate] (6.94 ms) : 0, 6940
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (779.155 ms) : 0, 779155
BytebuddyAgent [candidate] (780.49 ms) : 0, 780490
GlobalTracer [baseline] (293.342 ms) : 0, 293342
GlobalTracer [candidate] (294.346 ms) : 0, 294346
AppSec [baseline] (47.275 ms) : 0, 47275
AppSec [candidate] (47.058 ms) : 0, 47058
IAST [baseline] (28.53 ms) : 0, 28530
IAST [candidate] (28.266 ms) : 0, 28266
Remote Config [baseline] (621.565 µs) : 0, 622
Remote Config [candidate] (582.312 µs) : 0, 582
Telemetry [baseline] (6.948 ms) : 0, 6948
Telemetry [candidate] (6.872 ms) : 0, 6872
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (775.686 ms) : 0, 775686
BytebuddyAgent [candidate] (777.03 ms) : 0, 777030
GlobalTracer [baseline] (292.924 ms) : 0, 292924
GlobalTracer [candidate] (293.435 ms) : 0, 293435
AppSec [baseline] (47.12 ms) : 0, 47120
AppSec [candidate] (47.252 ms) : 0, 47252
IAST [baseline] (24.728 ms) : 0, 24728
IAST [candidate] (27.839 ms) : 0, 27839
Remote Config [baseline] (606.097 µs) : 0, 606
Remote Config [candidate] (587.767 µs) : 0, 588
Telemetry [baseline] (9.227 ms) : 0, 9227
Telemetry [candidate] (6.892 ms) : 0, 6892
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.36.0-SNAPSHOT~2cd7c6b057, baseline=1.36.0-SNAPSHOT~9bf5bbd556
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.063 s) : 0, 1062835
Total [baseline] (10.331 s) : 0, 10331181
Agent [candidate] (1.065 s) : 0, 1064993
Total [candidate] (10.304 s) : 0, 10304067
section appsec
Agent [baseline] (1.183 s) : 0, 1183246
Total [baseline] (10.499 s) : 0, 10499364
Agent [candidate] (1.181 s) : 0, 1181240
Total [candidate] (10.521 s) : 0, 10521356
section iast
Agent [baseline] (1.18 s) : 0, 1179931
Total [baseline] (10.911 s) : 0, 10910787
Agent [candidate] (1.169 s) : 0, 1169022
Total [candidate] (10.754 s) : 0, 10753865
section profiling
Agent [baseline] (1.26 s) : 0, 1260311
Total [baseline] (10.601 s) : 0, 10601467
Agent [candidate] (1.263 s) : 0, 1263348
Total [candidate] (10.595 s) : 0, 10594991
gantt
title petclinic - break down per module: candidate=1.36.0-SNAPSHOT~2cd7c6b057, baseline=1.36.0-SNAPSHOT~9bf5bbd556
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (665.618 ms) : 0, 665618
BytebuddyAgent [candidate] (667.327 ms) : 0, 667327
GlobalTracer [baseline] (304.156 ms) : 0, 304156
GlobalTracer [candidate] (304.461 ms) : 0, 304461
AppSec [baseline] (50.308 ms) : 0, 50308
AppSec [candidate] (50.437 ms) : 0, 50437
Remote Config [baseline] (687.582 µs) : 0, 688
Remote Config [candidate] (680.729 µs) : 0, 681
Telemetry [baseline] (7.568 ms) : 0, 7568
Telemetry [candidate] (7.52 ms) : 0, 7520
section appsec
BytebuddyAgent [baseline] (676.677 ms) : 0, 676677
BytebuddyAgent [candidate] (675.938 ms) : 0, 675938
GlobalTracer [baseline] (297.747 ms) : 0, 297747
GlobalTracer [candidate] (297.454 ms) : 0, 297454
AppSec [baseline] (153.599 ms) : 0, 153599
AppSec [candidate] (153.705 ms) : 0, 153705
IAST [baseline] (22.174 ms) : 0, 22174
IAST [candidate] (21.107 ms) : 0, 21107
Remote Config [baseline] (640.798 µs) : 0, 641
Remote Config [candidate] (634.547 µs) : 0, 635
Telemetry [baseline] (9.056 ms) : 0, 9056
Telemetry [candidate] (8.495 ms) : 0, 8495
section iast
BytebuddyAgent [baseline] (782.665 ms) : 0, 782665
BytebuddyAgent [candidate] (778.929 ms) : 0, 778929
GlobalTracer [baseline] (298.513 ms) : 0, 298513
GlobalTracer [candidate] (293.512 ms) : 0, 293512
AppSec [baseline] (48.19 ms) : 0, 48190
AppSec [candidate] (47.226 ms) : 0, 47226
IAST [baseline] (28.75 ms) : 0, 28750
IAST [candidate] (28.316 ms) : 0, 28316
Remote Config [baseline] (654.255 µs) : 0, 654
Remote Config [candidate] (769.233 µs) : 0, 769
Telemetry [baseline] (7.834 ms) : 0, 7834
Telemetry [candidate] (6.98 ms) : 0, 6980
section profiling
BytebuddyAgent [baseline] (661.606 ms) : 0, 661606
BytebuddyAgent [candidate] (663.499 ms) : 0, 663499
GlobalTracer [baseline] (385.043 ms) : 0, 385043
GlobalTracer [candidate] (386.763 ms) : 0, 386763
AppSec [baseline] (51.707 ms) : 0, 51707
AppSec [candidate] (51.689 ms) : 0, 51689
Remote Config [baseline] (728.046 µs) : 0, 728
Remote Config [candidate] (737.417 µs) : 0, 737
Telemetry [baseline] (7.351 ms) : 0, 7351
Telemetry [candidate] (7.436 ms) : 0, 7436
ProfilingAgent [baseline] (97.019 ms) : 0, 97019
ProfilingAgent [candidate] (96.189 ms) : 0, 96189
Profiling [baseline] (97.045 ms) : 0, 97045
Profiling [candidate] (96.214 ms) : 0, 96214
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 petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.36.0-SNAPSHOT~2cd7c6b057, baseline=1.36.0-SNAPSHOT~9bf5bbd556
dateFormat X
axisFormat %s
section baseline
no_agent (1.351 ms) : 1332, 1371
. : milestone, 1351,
appsec (1.722 ms) : 1698, 1746
. : milestone, 1722,
appsec_no_iast (1.741 ms) : 1717, 1765
. : milestone, 1741,
iast (1.501 ms) : 1479, 1523
. : milestone, 1501,
profiling (1.479 ms) : 1454, 1503
. : milestone, 1479,
tracing (1.461 ms) : 1437, 1486
. : milestone, 1461,
section candidate
no_agent (1.351 ms) : 1332, 1370
. : milestone, 1351,
appsec (1.716 ms) : 1691, 1741
. : milestone, 1716,
appsec_no_iast (1.707 ms) : 1682, 1732
. : milestone, 1707,
iast (1.482 ms) : 1460, 1505
. : milestone, 1482,
profiling (1.485 ms) : 1460, 1509
. : milestone, 1485,
tracing (1.482 ms) : 1458, 1506
. : milestone, 1482,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.36.0-SNAPSHOT~2cd7c6b057, baseline=1.36.0-SNAPSHOT~9bf5bbd556
dateFormat X
axisFormat %s
section baseline
no_agent (364.482 µs) : 344, 385
. : milestone, 364,
iast (486.278 µs) : 465, 508
. : milestone, 486,
iast_FULL (556.843 µs) : 536, 578
. : milestone, 557,
iast_GLOBAL (509.407 µs) : 488, 531
. : milestone, 509,
iast_HARDCODED_SECRET_DISABLED (485.634 µs) : 464, 507
. : milestone, 486,
iast_INACTIVE (458.3 µs) : 437, 480
. : milestone, 458,
iast_TELEMETRY_OFF (473.113 µs) : 452, 495
. : milestone, 473,
tracing (447.078 µs) : 425, 469
. : milestone, 447,
section candidate
no_agent (363.759 µs) : 344, 383
. : milestone, 364,
iast (483.794 µs) : 463, 505
. : milestone, 484,
iast_FULL (549.832 µs) : 529, 571
. : milestone, 550,
iast_GLOBAL (523.189 µs) : 500, 546
. : milestone, 523,
iast_HARDCODED_SECRET_DISABLED (494.246 µs) : 473, 515
. : milestone, 494,
iast_INACTIVE (457.538 µs) : 436, 479
. : milestone, 458,
iast_TELEMETRY_OFF (478.663 µs) : 457, 500
. : milestone, 479,
tracing (447.027 µs) : 426, 468
. : milestone, 447,
Dacapo |
bd0b276
to
15ae32f
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.
LTGM
...rc/main/java/datadog/trace/instrumentation/protobuf_java/AbstractMessageInstrumentation.java
Show resolved
Hide resolved
dataStreams.canSampleSchema("schema1") | ||
dataStreams.trySampleSchema("schema1") == 1 | ||
dataStreams.canSampleSchema("schema2") | ||
dataStreams.trySampleSchema("schema2") == 1 | ||
dataStreams.trySampleSchema("schema1") == 0 | ||
dataStreams.trySampleSchema("schema1") == 0 | ||
!dataStreams.canSampleSchema("schema1") | ||
!dataStreams.canSampleSchema("schema1") | ||
timeSource.advance(30*1e9 as long) | ||
dataStreams.canSampleSchema("schema1") | ||
dataStreams.trySampleSchema("schema1") == 3 |
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 think a future maintainer would be grateful if there was one or two comments explaining why we expect those results
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.
lessgo
What Does This Do
When
canSample
returns false,trySample
was not called, so the weight was not incremented.This leads to wrong weights being calculated.
This PR updates the code to increment the weight in
canSample
, that should be called exactly once.Motivation
Additional Notes
Jira ticket: [PROJ-IDENT]