-
Notifications
You must be signed in to change notification settings - Fork 318
Adding sampling provenance/mechanism to SamplingRules #6989
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
Conversation
Changed RULE -> LOCAL_USER_RULE Added REMOTE_USER_RULE and REMOTE_ADAPTIVE_RULE
Adding mechanism to SamplingRule Relaying mechanism from rule to the span
| rule.getTags(), | ||
| new DeterministicSampler.TraceSampler(rule.getSampleRate())); | ||
| new DeterministicSampler.TraceSampler(rule.getSampleRate()), | ||
| SamplingMechanism.LOCAL_USER_RULE); |
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.
While there's a SamplingMechanism field on SamplingRule, I didn't modify the operation & service rules to require it. We might want to revisit that when we marry this changeset with the remote config code.
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.
Right now the old operation and service rules use the deprecated constructor which defaults to LOCAL provenance - I'm ok with that, because we don't expect those rules to be supplied by remote-config.
| if (defaultRate != null) { | ||
| final SamplingRule samplingRule = | ||
| new AlwaysMatchesSamplingRule(new DeterministicSampler.TraceSampler(defaultRate)); | ||
| new AlwaysMatchesSamplingRule( |
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 went ahead and made LOCAL_USER_RULE explicit here.
I think it was an oversight in the spec that we don't mark this as REMOTE_USER_RULE when the default global rate comes from remote config. We may want to update this in the future.
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.
Makes sense - we can update it once we have agreement in the updated spec.
| public static final byte REMOTE_AUTO_RATE = 2; | ||
| /** Sampling rule or sampling rate based on tracer config */ | ||
| public static final byte RULE = 3; | ||
| public static final byte LOCAL_USER_RULE = 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.
Renamed to make distinction clear
| /** Data Jobs */ | ||
| public static final byte DATA_JOBS = 10; | ||
|
|
||
| public static final byte REMOTE_USER_RULE = 11; |
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.
New values to be used by remote configuration
Not used yet, but did check that they flow through properly
| // Matching neither passes through to rate based sampler | ||
| "xx:1" | null | null | null | null | 1.0 | SAMPLER_KEEP | ||
| null | "xx:1" | null | null | null | 1.0 | SAMPLER_KEEP | ||
| "xx:1" | null | null | AGENT_RATE | SAMPLER_KEEP | null | null | 1.0 |
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.
Added checking of decision maker to all the rule tests
Adding comments explaining the metainfo logic Since I found the logic less than intuitive, I wanted to make it easier on the next person
mcculls
left a comment
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.
+1 verified TestDynamicConfigSamplingRules passes with these changes
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 50 metrics, 13 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.34.0-SNAPSHOT~402504505c, baseline=1.34.0-SNAPSHOT~7b141beb4e
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.078 s) : 0, 1077633
Total [baseline] (8.577 s) : 0, 8577178
Agent [candidate] (1.077 s) : 0, 1076878
Total [candidate] (8.55 s) : 0, 8550072
section iast
Agent [baseline] (1.203 s) : 0, 1203323
Total [baseline] (9.008 s) : 0, 9008000
Agent [candidate] (1.202 s) : 0, 1201730
Total [candidate] (9.002 s) : 0, 9002028
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.204 s) : 0, 1203543
Total [baseline] (9.012 s) : 0, 9012301
Agent [candidate] (1.204 s) : 0, 1203604
Total [candidate] (8.985 s) : 0, 8984700
section iast_TELEMETRY_OFF
Agent [baseline] (1.202 s) : 0, 1202307
Total [baseline] (9.011 s) : 0, 9010585
Agent [candidate] (1.209 s) : 0, 1208775
Total [candidate] (8.994 s) : 0, 8993850
gantt
title insecure-bank - break down per module: candidate=1.34.0-SNAPSHOT~402504505c, baseline=1.34.0-SNAPSHOT~7b141beb4e
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (675.199 ms) : 0, 675199
BytebuddyAgent [candidate] (674.369 ms) : 0, 674369
GlobalTracer [baseline] (310.516 ms) : 0, 310516
GlobalTracer [candidate] (310.332 ms) : 0, 310332
AppSec [baseline] (49.347 ms) : 0, 49347
AppSec [candidate] (49.546 ms) : 0, 49546
Remote Config [baseline] (661.627 µs) : 0, 662
Remote Config [candidate] (658.997 µs) : 0, 659
Telemetry [baseline] (7.536 ms) : 0, 7536
Telemetry [candidate] (7.603 ms) : 0, 7603
section iast
BytebuddyAgent [baseline] (796.588 ms) : 0, 796588
BytebuddyAgent [candidate] (795.152 ms) : 0, 795152
GlobalTracer [baseline] (290.255 ms) : 0, 290255
GlobalTracer [candidate] (290.205 ms) : 0, 290205
AppSec [baseline] (50.297 ms) : 0, 50297
AppSec [candidate] (51.449 ms) : 0, 51449
Remote Config [baseline] (560.565 µs) : 0, 561
Remote Config [candidate] (583.629 µs) : 0, 584
Telemetry [baseline] (6.533 ms) : 0, 6533
Telemetry [candidate] (7.438 ms) : 0, 7438
IAST [baseline] (24.637 ms) : 0, 24637
IAST [candidate] (22.451 ms) : 0, 22451
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (796.265 ms) : 0, 796265
BytebuddyAgent [candidate] (796.294 ms) : 0, 796294
GlobalTracer [baseline] (290.213 ms) : 0, 290213
GlobalTracer [candidate] (291.033 ms) : 0, 291033
AppSec [baseline] (49.5 ms) : 0, 49500
AppSec [candidate] (48.866 ms) : 0, 48866
Remote Config [baseline] (580.993 µs) : 0, 581
Remote Config [candidate] (571.523 µs) : 0, 572
Telemetry [baseline] (7.374 ms) : 0, 7374
Telemetry [candidate] (6.585 ms) : 0, 6585
IAST [baseline] (25.139 ms) : 0, 25139
IAST [candidate] (25.82 ms) : 0, 25820
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (794.415 ms) : 0, 794415
BytebuddyAgent [candidate] (799.702 ms) : 0, 799702
GlobalTracer [baseline] (290.936 ms) : 0, 290936
GlobalTracer [candidate] (292.342 ms) : 0, 292342
AppSec [baseline] (53.731 ms) : 0, 53731
AppSec [candidate] (51.979 ms) : 0, 51979
Remote Config [baseline] (590.032 µs) : 0, 590
Remote Config [candidate] (628.753 µs) : 0, 629
Telemetry [baseline] (6.625 ms) : 0, 6625
Telemetry [candidate] (6.621 ms) : 0, 6621
IAST [baseline] (21.576 ms) : 0, 21576
IAST [candidate] (22.936 ms) : 0, 22936
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.34.0-SNAPSHOT~402504505c, baseline=1.34.0-SNAPSHOT~7b141beb4e
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.079 s) : 0, 1079155
Total [baseline] (10.478 s) : 0, 10478357
Agent [candidate] (1.084 s) : 0, 1084000
Total [candidate] (10.433 s) : 0, 10433317
section appsec
Agent [baseline] (1.194 s) : 0, 1194113
Total [baseline] (10.54 s) : 0, 10539944
Agent [candidate] (1.192 s) : 0, 1191841
Total [candidate] (10.472 s) : 0, 10472350
section iast
Agent [baseline] (1.203 s) : 0, 1203160
Total [baseline] (10.734 s) : 0, 10733875
Agent [candidate] (1.214 s) : 0, 1213580
Total [candidate] (10.753 s) : 0, 10752952
section profiling
Agent [baseline] (1.279 s) : 0, 1279092
Total [baseline] (10.71 s) : 0, 10709952
Agent [candidate] (1.274 s) : 0, 1273737
Total [candidate] (10.669 s) : 0, 10668813
gantt
title petclinic - break down per module: candidate=1.34.0-SNAPSHOT~402504505c, baseline=1.34.0-SNAPSHOT~7b141beb4e
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (676.102 ms) : 0, 676102
BytebuddyAgent [candidate] (678.628 ms) : 0, 678628
GlobalTracer [baseline] (310.876 ms) : 0, 310876
GlobalTracer [candidate] (312.533 ms) : 0, 312533
AppSec [baseline] (49.446 ms) : 0, 49446
AppSec [candidate] (49.927 ms) : 0, 49927
Remote Config [baseline] (665.178 µs) : 0, 665
Remote Config [candidate] (665.426 µs) : 0, 665
Telemetry [baseline] (7.601 ms) : 0, 7601
Telemetry [candidate] (7.65 ms) : 0, 7650
section appsec
BytebuddyAgent [baseline] (698.737 ms) : 0, 698737
BytebuddyAgent [candidate] (696.354 ms) : 0, 696354
GlobalTracer [baseline] (293.236 ms) : 0, 293236
GlobalTracer [candidate] (293.027 ms) : 0, 293027
AppSec [baseline] (148.913 ms) : 0, 148913
AppSec [candidate] (149.026 ms) : 0, 149026
Remote Config [baseline] (618.192 µs) : 0, 618
Remote Config [candidate] (618.107 µs) : 0, 618
Telemetry [baseline] (8.502 ms) : 0, 8502
Telemetry [candidate] (8.768 ms) : 0, 8768
IAST [baseline] (19.25 ms) : 0, 19250
IAST [candidate] (19.276 ms) : 0, 19276
section iast
BytebuddyAgent [baseline] (796.295 ms) : 0, 796295
BytebuddyAgent [candidate] (803.042 ms) : 0, 803042
GlobalTracer [baseline] (290.419 ms) : 0, 290419
GlobalTracer [candidate] (292.945 ms) : 0, 292945
AppSec [baseline] (51.641 ms) : 0, 51641
AppSec [candidate] (51.938 ms) : 0, 51938
Remote Config [baseline] (579.557 µs) : 0, 580
Remote Config [candidate] (571.633 µs) : 0, 572
Telemetry [baseline] (6.595 ms) : 0, 6595
Telemetry [candidate] (6.682 ms) : 0, 6682
IAST [baseline] (23.277 ms) : 0, 23277
IAST [candidate] (23.65 ms) : 0, 23650
section profiling
BytebuddyAgent [baseline] (683.811 ms) : 0, 683811
BytebuddyAgent [candidate] (679.092 ms) : 0, 679092
GlobalTracer [baseline] (383.713 ms) : 0, 383713
GlobalTracer [candidate] (383.14 ms) : 0, 383140
AppSec [baseline] (50.49 ms) : 0, 50490
AppSec [candidate] (50.325 ms) : 0, 50325
Remote Config [baseline] (709.535 µs) : 0, 710
Remote Config [candidate] (714.261 µs) : 0, 714
Telemetry [baseline] (7.457 ms) : 0, 7457
Telemetry [candidate] (7.532 ms) : 0, 7532
ProfilingAgent [baseline] (96.056 ms) : 0, 96056
ProfilingAgent [candidate] (96.408 ms) : 0, 96408
Profiling [baseline] (96.08 ms) : 0, 96080
Profiling [candidate] (96.432 ms) : 0, 96432
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 16 unstable metrics. Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.34.0-SNAPSHOT~402504505c, baseline=1.34.0-SNAPSHOT~7b141beb4e
dateFormat X
axisFormat %s
section baseline
no_agent (371.552 µs) : 351, 392
. : milestone, 372,
iast (471.992 µs) : 451, 492
. : milestone, 472,
iast_FULL (536.204 µs) : 516, 557
. : milestone, 536,
iast_GLOBAL (493.693 µs) : 473, 514
. : milestone, 494,
iast_HARDCODED_SECRET_DISABLED (471.702 µs) : 451, 492
. : milestone, 472,
iast_INACTIVE (446.08 µs) : 425, 467
. : milestone, 446,
iast_TELEMETRY_OFF (466.987 µs) : 446, 488
. : milestone, 467,
tracing (446.637 µs) : 424, 469
. : milestone, 447,
section candidate
no_agent (370.757 µs) : 351, 390
. : milestone, 371,
iast (472.211 µs) : 452, 493
. : milestone, 472,
iast_FULL (537.712 µs) : 517, 559
. : milestone, 538,
iast_GLOBAL (491.803 µs) : 471, 513
. : milestone, 492,
iast_HARDCODED_SECRET_DISABLED (470.835 µs) : 450, 491
. : milestone, 471,
iast_INACTIVE (440.371 µs) : 420, 461
. : milestone, 440,
iast_TELEMETRY_OFF (467.663 µs) : 446, 489
. : milestone, 468,
tracing (445.4 µs) : 425, 466
. : milestone, 445,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.34.0-SNAPSHOT~402504505c, baseline=1.34.0-SNAPSHOT~7b141beb4e
dateFormat X
axisFormat %s
section baseline
no_agent (1.352 ms) : 1332, 1372
. : milestone, 1352,
appsec (1.734 ms) : 1711, 1757
. : milestone, 1734,
appsec_no_iast (1.706 ms) : 1682, 1730
. : milestone, 1706,
iast (1.474 ms) : 1452, 1496
. : milestone, 1474,
profiling (1.5 ms) : 1475, 1524
. : milestone, 1500,
tracing (1.502 ms) : 1477, 1527
. : milestone, 1502,
section candidate
no_agent (1.355 ms) : 1337, 1374
. : milestone, 1355,
appsec (1.729 ms) : 1705, 1752
. : milestone, 1729,
appsec_no_iast (1.713 ms) : 1689, 1738
. : milestone, 1713,
iast (1.489 ms) : 1466, 1512
. : milestone, 1489,
profiling (1.546 ms) : 1520, 1571
. : milestone, 1546,
tracing (1.476 ms) : 1452, 1501
. : milestone, 1476,
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 tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.34.0-SNAPSHOT~402504505c, baseline=1.34.0-SNAPSHOT~7b141beb4e
dateFormat X
axisFormat %s
section baseline
no_agent (1.458 ms) : 1447, 1470
. : milestone, 1458,
appsec (2.193 ms) : 2160, 2227
. : milestone, 2193,
iast (1.872 ms) : 1837, 1907
. : milestone, 1872,
iast_GLOBAL (1.905 ms) : 1869, 1940
. : milestone, 1905,
profiling (2.305 ms) : 2125, 2485
. : milestone, 2305,
tracing (1.818 ms) : 1787, 1850
. : milestone, 1818,
section candidate
no_agent (1.458 ms) : 1446, 1469
. : milestone, 1458,
appsec (2.184 ms) : 2150, 2218
. : milestone, 2184,
iast (1.866 ms) : 1831, 1901
. : milestone, 1866,
iast_GLOBAL (1.912 ms) : 1877, 1948
. : milestone, 1912,
profiling (1.839 ms) : 1806, 1872
. : milestone, 1839,
tracing (1.814 ms) : 1782, 1846
. : milestone, 1814,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.34.0-SNAPSHOT~402504505c, baseline=1.34.0-SNAPSHOT~7b141beb4e
dateFormat X
axisFormat %s
section baseline
no_agent (15.048 s) : 15048000, 15048000
. : milestone, 15048000,
appsec (14.805 s) : 14805000, 14805000
. : milestone, 14805000,
iast (18.992 s) : 18992000, 18992000
. : milestone, 18992000,
iast_GLOBAL (17.856 s) : 17856000, 17856000
. : milestone, 17856000,
profiling (15.113 s) : 15113000, 15113000
. : milestone, 15113000,
tracing (15.031 s) : 15031000, 15031000
. : milestone, 15031000,
section candidate
no_agent (15.521 s) : 15521000, 15521000
. : milestone, 15521000,
appsec (15.032 s) : 15032000, 15032000
. : milestone, 15032000,
iast (18.88 s) : 18880000, 18880000
. : milestone, 18880000,
iast_GLOBAL (17.963 s) : 17963000, 17963000
. : milestone, 17963000,
profiling (15.292 s) : 15292000, 15292000
. : milestone, 15292000,
tracing (14.989 s) : 14989000, 14989000
. : milestone, 14989000,
|
What Does This Do
Adds samplingMechanism information to TraceSamplingRule objects
Motivation
Forthcoming changes will allow rules to be set via remote configuration.
Once rules can be either locally or remotely, we want the decision maker to reflect the source of the rule.
Additional Notes
Change makes extensive changes to the sampling rule tests - previously these tests weren't checking the decision maker tag
Jira ticket: AIT-9975