public void registerDefaultRateLimitSpansPercentChangeListener(ConfigurationOption.ChangeListener<Double> changeListener) { defaultRateLimitSpansPercent.addChangeListener(changeListener); }
public void registerDebugClientSpanScriptOptionChangedListener(ConfigurationOption.ChangeListener<Boolean> listener) { debugClientSpanScript.addChangeListener(listener); }
private void handleRuntimeConfigChanges(TracingPlugin tracingPlugin) { tracingPlugin.getDefaultRateLimitSpansPercentOption().addChangeListener(new ConfigurationOption.ChangeListener<Double>() { @Override public void onChange(ConfigurationOption<?> configurationOption, Double oldValue, Double newValue) { defaultSampleDecisions = getBitSet(newValue); } }); tracingPlugin.getRateLimitSpansPerMinutePercentPerTypeOption().addChangeListener(new ConfigurationOption.ChangeListener<Map<String, Double>>() { @Override public void onChange(ConfigurationOption<?> configurationOption, Map<String, Double> oldValue, Map<String, Double> newValue) { setBitSetMap(newValue); } }); }
public CallTreeSpanEventListener(Metric2Registry metricRegistry, TracingPlugin tracingPlugin) { this.tracingPlugin = tracingPlugin; this.metricRegistry = metricRegistry; rateLimiter = RateLimitingPreExecutionInterceptor.getRateLimiter(tracingPlugin.getProfilerRateLimitPerMinute()); tracingPlugin.getProfilerRateLimitPerMinuteOption().addChangeListener(new ConfigurationOption.ChangeListener<Double>() { @Override public void onChange(ConfigurationOption<?> configurationOption, Double oldValue, Double newValue) { rateLimiter = RateLimitingPreExecutionInterceptor.getRateLimiter(newValue); } }); }
@Override public void init(ConfigurationRegistry configuration) { tracingPlugin = configuration.getConfig(TracingPlugin.class); rateLimiter = getRateLimiter(tracingPlugin.getDefaultRateLimitSpansPerMinute()); tracingPlugin.getDefaultRateLimitSpansPerMinuteOption().addChangeListener(new ConfigurationOption.ChangeListener<Double>() { @Override public void onChange(ConfigurationOption<?> configurationOption, Double oldValue, Double newValue) { rateLimiter = getRateLimiter(newValue); } }); }
@Test public void testChangeListener() throws Exception { AtomicBoolean changeListenerInvoked = new AtomicBoolean(false); exampleConfiguration.getOptionalExample() .addChangeListener((configurationOption, oldValue, newValue) -> changeListenerInvoked.set(true)); // saves a value into a specific configuration source exampleConfiguration.getOptionalExample().update(Optional.of("foo"), SimpleSource.NAME); assertThat(changeListenerInvoked).isTrue(); }
coreConfiguration.getSampleRate().addChangeListener(new ConfigurationOption.ChangeListener<Double>() { @Override public void onChange(ConfigurationOption<?> configurationOption, Double oldValue, Double newValue) {