-
Notifications
You must be signed in to change notification settings - Fork 312
ConfigProvider iterates over all sources and reports all non-null values to telemetry #9404
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
base: master
Are you sure you want to change the base?
Conversation
🎯 Code Coverage 🔗 Commit SHA: 7508fc7 | Docs | Was this helpful? Give us feedback! |
BenchmarksStartupParameters
See matching parameters
SummaryFound 1 performance improvements and 11 performance regressions! Performance is the same for 37 metrics, 10 unstable metrics.
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.53.0-SNAPSHOT~7508fc78b6, baseline=1.54.0-SNAPSHOT~cbe8eb4cf4
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.025 s) : 0, 1025234
Total [baseline] (8.688 s) : 0, 8688070
Agent [candidate] (1.065 s) : 0, 1064596
Total [candidate] (8.615 s) : 0, 8615385
section iast
Agent [baseline] (1.157 s) : 0, 1156847
Total [baseline] (9.352 s) : 0, 9351874
Agent [candidate] (1.195 s) : 0, 1194717
Total [candidate] (9.29 s) : 0, 9290445
gantt
title insecure-bank - break down per module: candidate=1.53.0-SNAPSHOT~7508fc78b6, baseline=1.54.0-SNAPSHOT~cbe8eb4cf4
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.47 ms) : 0, 1470
crashtracking [candidate] (1.456 ms) : 0, 1456
BytebuddyAgent [baseline] (690.74 ms) : 0, 690740
BytebuddyAgent [candidate] (734.637 ms) : 0, 734637
GlobalTracer [baseline] (259.556 ms) : 0, 259556
GlobalTracer [candidate] (253.534 ms) : 0, 253534
AppSec [baseline] (31.968 ms) : 0, 31968
AppSec [candidate] (30.563 ms) : 0, 30563
Debugger [baseline] (6.377 ms) : 0, 6377
Debugger [candidate] (6.346 ms) : 0, 6346
Remote Config [baseline] (683.903 µs) : 0, 684
Remote Config [candidate] (677.32 µs) : 0, 677
Telemetry [baseline] (13.383 ms) : 0, 13383
Telemetry [candidate] (16.368 ms) : 0, 16368
section iast
crashtracking [baseline] (1.468 ms) : 0, 1468
crashtracking [candidate] (1.445 ms) : 0, 1445
BytebuddyAgent [baseline] (810.752 ms) : 0, 810752
BytebuddyAgent [candidate] (855.683 ms) : 0, 855683
GlobalTracer [baseline] (249.879 ms) : 0, 249879
GlobalTracer [candidate] (244.87 ms) : 0, 244870
AppSec [baseline] (27.923 ms) : 0, 27923
AppSec [candidate] (27.25 ms) : 0, 27250
Debugger [baseline] (6.124 ms) : 0, 6124
Debugger [candidate] (6.026 ms) : 0, 6026
Remote Config [baseline] (598.176 µs) : 0, 598
Remote Config [candidate] (608.659 µs) : 0, 609
Telemetry [baseline] (8.176 ms) : 0, 8176
Telemetry [candidate] (8.292 ms) : 0, 8292
IAST [baseline] (30.902 ms) : 0, 30902
IAST [candidate] (29.665 ms) : 0, 29665
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.53.0-SNAPSHOT~7508fc78b6, baseline=1.54.0-SNAPSHOT~cbe8eb4cf4
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.028 s) : 0, 1028051
Total [baseline] (10.703 s) : 0, 10703000
Agent [candidate] (1.076 s) : 0, 1076037
Total [candidate] (10.796 s) : 0, 10795600
section appsec
Agent [baseline] (1.2 s) : 0, 1200320
Total [baseline] (11.082 s) : 0, 11082365
Agent [candidate] (1.238 s) : 0, 1238467
Total [candidate] (11.085 s) : 0, 11085279
section iast
Agent [baseline] (1.156 s) : 0, 1156457
Total [baseline] (11.085 s) : 0, 11085460
Agent [candidate] (1.197 s) : 0, 1197420
Total [candidate] (11.019 s) : 0, 11018710
section profiling
Agent [baseline] (1.184 s) : 0, 1184451
Total [baseline] (11.146 s) : 0, 11145695
Agent [candidate] (1.211 s) : 0, 1210679
Total [candidate] (10.933 s) : 0, 10933023
gantt
title petclinic - break down per module: candidate=1.53.0-SNAPSHOT~7508fc78b6, baseline=1.54.0-SNAPSHOT~cbe8eb4cf4
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.466 ms) : 0, 1466
crashtracking [candidate] (1.457 ms) : 0, 1457
BytebuddyAgent [baseline] (692.622 ms) : 0, 692622
BytebuddyAgent [candidate] (743.786 ms) : 0, 743786
GlobalTracer [baseline] (260.9 ms) : 0, 260900
GlobalTracer [candidate] (255.184 ms) : 0, 255184
AppSec [baseline] (32.024 ms) : 0, 32024
AppSec [candidate] (30.851 ms) : 0, 30851
Debugger [baseline] (6.399 ms) : 0, 6399
Debugger [candidate] (6.402 ms) : 0, 6402
Remote Config [baseline] (690.275 µs) : 0, 690
Remote Config [candidate] (684.171 µs) : 0, 684
Telemetry [baseline] (12.822 ms) : 0, 12822
Telemetry [candidate] (16.449 ms) : 0, 16449
section appsec
crashtracking [baseline] (1.459 ms) : 0, 1459
crashtracking [candidate] (1.45 ms) : 0, 1450
BytebuddyAgent [baseline] (712.887 ms) : 0, 712887
BytebuddyAgent [candidate] (758.016 ms) : 0, 758016
GlobalTracer [baseline] (251.835 ms) : 0, 251835
GlobalTracer [candidate] (246.133 ms) : 0, 246133
AppSec [baseline] (171.343 ms) : 0, 171343
AppSec [candidate] (172.431 ms) : 0, 172431
Debugger [baseline] (6.066 ms) : 0, 6066
Debugger [candidate] (6.004 ms) : 0, 6004
Remote Config [baseline] (628.618 µs) : 0, 629
Remote Config [candidate] (636.995 µs) : 0, 637
Telemetry [baseline] (9.961 ms) : 0, 9961
Telemetry [candidate] (8.568 ms) : 0, 8568
IAST [baseline] (25.025 ms) : 0, 25025
IAST [candidate] (24.099 ms) : 0, 24099
section iast
crashtracking [baseline] (1.47 ms) : 0, 1470
crashtracking [candidate] (1.477 ms) : 0, 1477
BytebuddyAgent [baseline] (809.757 ms) : 0, 809757
BytebuddyAgent [candidate] (859.504 ms) : 0, 859504
GlobalTracer [baseline] (250.02 ms) : 0, 250020
GlobalTracer [candidate] (244.786 ms) : 0, 244786
AppSec [baseline] (29.365 ms) : 0, 29365
AppSec [candidate] (26.236 ms) : 0, 26236
Debugger [baseline] (6.106 ms) : 0, 6106
Debugger [candidate] (6.029 ms) : 0, 6029
Remote Config [baseline] (603.613 µs) : 0, 604
Remote Config [candidate] (618.877 µs) : 0, 619
Telemetry [baseline] (8.043 ms) : 0, 8043
Telemetry [candidate] (8.277 ms) : 0, 8277
IAST [baseline] (29.988 ms) : 0, 29988
IAST [candidate] (29.453 ms) : 0, 29453
section profiling
crashtracking [baseline] (1.458 ms) : 0, 1458
crashtracking [candidate] (1.442 ms) : 0, 1442
BytebuddyAgent [baseline] (731.485 ms) : 0, 731485
BytebuddyAgent [candidate] (762.454 ms) : 0, 762454
GlobalTracer [baseline] (240.141 ms) : 0, 240141
GlobalTracer [candidate] (233.04 ms) : 0, 233040
AppSec [baseline] (31.647 ms) : 0, 31647
AppSec [candidate] (30.422 ms) : 0, 30422
Debugger [baseline] (6.59 ms) : 0, 6590
Debugger [candidate] (11.937 ms) : 0, 11937
Remote Config [baseline] (716.198 µs) : 0, 716
Remote Config [candidate] (717.558 µs) : 0, 718
Telemetry [baseline] (16.95 ms) : 0, 16950
Telemetry [candidate] (11.08 ms) : 0, 11080
ProfilingAgent [baseline] (103.74 ms) : 0, 103740
ProfilingAgent [candidate] (107.313 ms) : 0, 107313
Profiling [baseline] (104.355 ms) : 0, 104355
Profiling [candidate] (107.949 ms) : 0, 107949
LoadParameters
See matching parameters
SummaryFound 2 performance improvements and 3 performance regressions! Performance is the same for 7 metrics, 12 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.53.0-SNAPSHOT~7508fc78b6, baseline=1.54.0-SNAPSHOT~cbe8eb4cf4
dateFormat X
axisFormat %s
section baseline
no_agent (37.419 ms) : 37118, 37721
. : milestone, 37419,
appsec (52.263 ms) : 51789, 52737
. : milestone, 52263,
code_origins (44.731 ms) : 44358, 45105
. : milestone, 44731,
iast (44.043 ms) : 43665, 44421
. : milestone, 44043,
profiling (48.071 ms) : 47622, 48520
. : milestone, 48071,
tracing (43.075 ms) : 42715, 43434
. : milestone, 43075,
section candidate
no_agent (38.309 ms) : 37997, 38621
. : milestone, 38309,
appsec (46.947 ms) : 46542, 47352
. : milestone, 46947,
code_origins (45.12 ms) : 44733, 45507
. : milestone, 45120,
iast (45.65 ms) : 45243, 46057
. : milestone, 45650,
profiling (51.68 ms) : 51217, 52143
. : milestone, 51680,
tracing (43.071 ms) : 42715, 43428
. : milestone, 43071,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.53.0-SNAPSHOT~7508fc78b6, baseline=1.54.0-SNAPSHOT~cbe8eb4cf4
dateFormat X
axisFormat %s
section baseline
no_agent (4.198 ms) : 4141, 4254
. : milestone, 4198,
iast (9.664 ms) : 9501, 9828
. : milestone, 9664,
iast_FULL (15.055 ms) : 14756, 15354
. : milestone, 15055,
iast_GLOBAL (10.435 ms) : 10252, 10617
. : milestone, 10435,
profiling (8.846 ms) : 8700, 8993
. : milestone, 8846,
tracing (7.808 ms) : 7696, 7921
. : milestone, 7808,
section candidate
no_agent (4.521 ms) : 4470, 4573
. : milestone, 4521,
iast (9.731 ms) : 9569, 9894
. : milestone, 9731,
iast_FULL (14.061 ms) : 13786, 14336
. : milestone, 14061,
iast_GLOBAL (10.12 ms) : 9941, 10299
. : milestone, 10120,
profiling (8.871 ms) : 8729, 9013
. : milestone, 8871,
tracing (7.69 ms) : 7572, 7808
. : milestone, 7690,
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.53.0-SNAPSHOT~7508fc78b6, baseline=1.54.0-SNAPSHOT~cbe8eb4cf4
dateFormat X
axisFormat %s
section baseline
no_agent (15.307 s) : 15307000, 15307000
. : milestone, 15307000,
appsec (15.243 s) : 15243000, 15243000
. : milestone, 15243000,
iast (18.656 s) : 18656000, 18656000
. : milestone, 18656000,
iast_GLOBAL (18.097 s) : 18097000, 18097000
. : milestone, 18097000,
profiling (16.006 s) : 16006000, 16006000
. : milestone, 16006000,
tracing (14.999 s) : 14999000, 14999000
. : milestone, 14999000,
section candidate
no_agent (14.738 s) : 14738000, 14738000
. : milestone, 14738000,
appsec (14.735 s) : 14735000, 14735000
. : milestone, 14735000,
iast (18.402 s) : 18402000, 18402000
. : milestone, 18402000,
iast_GLOBAL (18.224 s) : 18224000, 18224000
. : milestone, 18224000,
profiling (15.415 s) : 15415000, 15415000
. : milestone, 15415000,
tracing (15.021 s) : 15021000, 15021000
. : milestone, 15021000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.53.0-SNAPSHOT~7508fc78b6, baseline=1.54.0-SNAPSHOT~cbe8eb4cf4
dateFormat X
axisFormat %s
section baseline
no_agent (1.488 ms) : 1477, 1500
. : milestone, 1488,
appsec (3.703 ms) : 3488, 3917
. : milestone, 3703,
iast (2.218 ms) : 2155, 2281
. : milestone, 2218,
iast_GLOBAL (2.262 ms) : 2199, 2325
. : milestone, 2262,
profiling (2.06 ms) : 2009, 2110
. : milestone, 2060,
tracing (2.041 ms) : 1991, 2090
. : milestone, 2041,
section candidate
no_agent (1.482 ms) : 1471, 1494
. : milestone, 1482,
appsec (3.717 ms) : 3498, 3935
. : milestone, 3717,
iast (2.207 ms) : 2144, 2270
. : milestone, 2207,
iast_GLOBAL (2.268 ms) : 2205, 2332
. : milestone, 2268,
profiling (2.072 ms) : 2020, 2124
. : milestone, 2072,
tracing (2.052 ms) : 2002, 2102
. : milestone, 2052,
|
…x configId test to accommodate new ConfigCollector data structure
67d3e75
to
8becbc5
Compare
…edConfigSetting static function that takes in a map
369b020
to
d097300
Compare
535c685
to
1b81e8a
Compare
} | ||
|
||
/** Helper class to store resolved configuration values with their metadata */ | ||
static class ConfigValueResolver<T> { |
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 class is not private
in order to expose it for a unit test that is needed to complete code coverage. The unit test verifies that reReportToCollector
is not invoked when origin == null
, which should never happen since the method to create a ConfigValueResolver
should only occur when no re-reporting is expected. This check is only here as a safety check against poor usage of the function.
telemetry/src/test/groovy/datadog/telemetry/TelemetryServiceSpecification.groovy
Show resolved
Hide resolved
// No usages of this function | ||
public static ConfigSetting of(String key, Object value, ConfigOrigin origin, String configId) { |
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.
should we mark as deprecated?
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.
If this method is not used anymore then I would remove it (this is internal code, so not covered by breaking changes)
newState = asm.enabled; | ||
// Report AppSec activation change via telemetry when modified via remote config | ||
ConfigCollector.get().put(APPSEC_ENABLED, asm.enabled, ConfigOrigin.REMOTE); | ||
ConfigCollector.get().put(APPSEC_ENABLED, asm.enabled, ConfigOrigin.REMOTE, ABSENT_SEQ_ID); |
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.
What do you think about adding an update
method to ConfigCollector
? or maybe remotePut
?
The new method would just take a key and new value - the origin would always be ConfigOrigin.REMOTE
and the sequence id would be absent.
This simplifies remote-config calls to ConfigCollector
and also provides a clear code path for such calls...
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.
great idea
ConfigSetting configSetting = ConfigCollector.get().collect().get(LOGS_INJECTION_ENABLED); | ||
ConfigSetting configSetting = | ||
ConfigCollector.getAppliedConfigSetting( | ||
LOGS_INJECTION_ENABLED, ConfigCollector.get().collect()); |
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'm looking into ways to remove this call, as smoke tests shouldn't be relying on internal-api
if (value != null) { | ||
ConfigCollector.get().put(name, value, ConfigOrigin.ENV); | ||
// Report non-default sequence id for consistency | ||
ConfigCollector.get().put(name, value, ConfigOrigin.ENV, DEFAULT_SEQ_ID + 1); |
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.
Suggestion: add a constant NON_DEFAULT_SEQ_ID
which equals DEFAULT_SEQ_ID + 1
if (value != null) { | ||
ConfigCollector.get().put(name, value, ConfigOrigin.JVM_PROP); | ||
// Report non-default sequence id for consistency | ||
ConfigCollector.get().put(name, value, ConfigOrigin.JVM_PROP, DEFAULT_SEQ_ID + 1); |
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.
Replace with NON_DEFAULT_SEQ_ID
? (see suggestion above)
|
||
public final int seqId; | ||
public static final int DEFAULT_SEQ_ID = 1; | ||
public static final int ABSENT_SEQ_ID = 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.
Minor: I usually put constants at the top of the class, then fields, then methods
} | ||
|
||
// NOTE: Only used to preserve legacy behavior for with smoke tests | ||
public static ConfigSetting getAppliedConfigSetting( |
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'm looking into ways to remove this :)
…igin; migrate AppSecConfigServiceImpl to use this API
… calls to 'DEFAULT_SEQ_ID + 1' to use new constant; move constants to top of ConfigSetting class
internal-api/src/test/groovy/datadog/trace/api/ConfigCollectorTest.groovy
Outdated
Show resolved
Hide resolved
def "non-default config settings get collected"() { | ||
setup: | ||
injectEnvConfig(ConfigStrings.toEnvVar(configKey), configValue) | ||
def origin = ConfigOrigin.ENV |
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 would just inline the use of this below (afaict it's only used on one line)
* ordering. | ||
*/ | ||
@Deprecated | ||
public void put(String key, Object value, ConfigOrigin origin) { |
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 we migrate any remaining use onto the future-proof method and then remove this deprecated method? (since this is all internal api)
public void put(String key, Object value, ConfigOrigin origin, int seqId, String configId) { | ||
ConfigSetting setting = ConfigSetting.of(key, value, origin, seqId, configId); | ||
Map<String, ConfigSetting> configMap = | ||
collected.computeIfAbsent(origin, k -> new ConcurrentHashMap<>()); |
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.
Consider storing this as a static field, i.e.
private static final Function< ConfigOrigin, Map<String, ConfigSetting>> NEW_SUB_MAP = k -> new ConcurrentHashMap<>();
which you can then re-use here and in putDefault
below.
* @param configMap map of configuration key-value pairs to add | ||
* @param origin the configuration origin for all entries | ||
*/ | ||
public void putAll(Map<String, Object> configMap, ConfigOrigin origin) { |
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 only used by DynamicConfig
to report remote config updates - so I would change this to be
public void putAll(Map<String, Object> configMap, ConfigOrigin origin) { | |
public void putRemote(Map<String, Object> configMap) { |
and use ConfigOrigin.REMOTE
to get the right sub-map to update.
*/ | ||
public void putAll(Map<String, Object> configMap, ConfigOrigin origin) { | ||
for (Map.Entry<String, Object> entry : configMap.entrySet()) { | ||
put(entry.getKey(), entry.getValue(), origin, ABSENT_SEQ_ID, null); |
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 breaks the atomicity of the previous implementation - i.e. with the new code if a remote config update happens at the same time the config is collected for telemetry then half of the remote config update could land in the outgoing batch and the rest would land in the subsequent batch. This could result in inconsistent data being shown in the UI.
I'll add an update to show how the atomicity can be kept with the new sub-map approach.
…Test.groovy Co-authored-by: Stuart McCulloch <[email protected]>
…gCollector, used by putDefault and put
…java into mtoff/4-config-sources
What Does This Do
Previously, telemetry was only being reported for the
ConfigSource
that set the final value of the configuration. This PR introduces reporting telemetry for allConfigSources
that have non-null values set, regardless of whether it sets the final configuration value or not.Summary of Changes:
ConfigCollector
Map<ConfigOrigin, Map<String (configName), ConfigSetting>>
put
method in favor of a newput
method withseq_id
fieldputDefault
method is created to ensure originally reported defaults are not overwritten. Use cases:getEnum
,getIntegerRange
,getSet
andgetList
invokegetString
, which erroneously reports defaults as null under the hoodisExplicitlyDisabled
is called and invokesgetBoolean
without the proper default value, which previously would override theDEFAULT
telemetry payload withnull
.ConfigSetting
seqId
and newof
function that takes it in as a parameterConfigProvider
ConfigSources
start from lowest priority to highest priority. A localseqId
is used to track priority ofConfigSources
that are set. In the case of parsing errors, there may be re-reporting of the last validConfigSource
to ensure the highest priority and valid ConfigSource is reported with the highestseqId
ConfigValueResolver
key
,value
,seqId
, andConfigOrigin
.ConfigProvider
methods now store the final return value throughConfigValueResolver
ConfigMergeResolver
Motivation
RFC
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: [PROJ-IDENT]