public void configChanged(InsightAgentRuntimeState agentConfig) { synchronized(scheduler) { /* * NOTE: ignore update if not running or not our internal state. * The latter can happen if we are running on the same JVM as the * analyzer or the dashboard which auto-detect this as a Spring * bean and invoke it with their own state - which we want to * keep separate than our own (even though for the analyzer it * is most likely identical in content...) */ if ((helper != null) && isRunning() && (agentConfig == runtimeState)) { helper.configChanged(agentConfig); } } }
public synchronized void handleData(CollectionDataTransport transport, Serializable data) { // check if need to propagate some settings if (data instanceof SyncAgentConfigCollectionData) { SyncAgentConfigCollectionData message=(SyncAgentConfigCollectionData) data; Map<CollectionSettingName,? extends Serializable> globals=message.getGlobalSettingsMap(); ServerName serverName=getServerName(); Map<CollectionSettingName,? extends Serializable> locals=message.getAgentSettingsMap(serverName); boolean globalModified = updateCollectionSettings(globals); boolean localModified = updateCollectionSettings(locals); if (globalModified || localModified) { File file=persistCollectionSettings(); logger.info("handleData(localModified=" + localModified + "/globalModified=" + globalModified + ") updated " + file); } } }
helper = new DispatchAgentHeartbeatHelper(config, context, registry); runtimeState = helper.getRuntimeState();
public static final InsightAgentRuntimeState createInitialRuntimeState () { DispatchConfiguration configInstance=DispatchConfiguration.getInstance(); return createInitialRuntimeState(configInstance.getInsightAgentConfig(), DispatcherContext.getInstance(), CollectionSettingsRegistry.getInstance()); }
helper.beat(this); } catch(Exception e) { logger.warning("Unexpected heartbeat exception (" + e.getClass().getSimpleName() + "): " + e.getMessage());
public static final InsightAgentRuntimeState createInitialRuntimeState ( InsightAgentConfig config, DispatcherContext context, CollectionSettingsRegistry registry) { return new InsightAgentRuntimeState() .withMaxTracesSentPerMinute(config.getMaxTracesSentPerMinute()) .withHeartbeatInterval(config.getHeartbeat()) .withSyncPropsBeat(config.getSyncPropsBeat()) .withBuildInfo(context.getBuildInfo()) .withPluginSet(toPluginSet(context.getPluginSet())) .withCollectionSettings(registry.getCollectionSettings()) ; }
public DispatchAgentHeartbeatHelper (InsightAgentConfig config, DispatcherContext context, CollectionSettingsRegistry registry) { super(context.getServerName(), context.getServerLabel(), createInitialRuntimeState(config, context, registry), context.getBuildInfo(), context.getDispatcherResourceProperties(), SensitiveResourcePropertiesFilter.getInstance()); if ((settingsRegistry=registry) == null) { throw new IllegalStateException("No settings registry provided"); } this.props = new LayoutPreservingProperties(ConfigUtils.getInstance().getLocalPropsFile()); }