public static final <C extends InsightConfig> C fromProperties (C config, NamedPropertySource props) {
config.setExcludeTraceByPath(getExcludeTracePaths(props));
config.setMaxTracesReceivedPerMinute(PropertiesUtil.getIntProperty(props, MAX_TRACES_RECEIVED_KEY, DEFAULT_MAX_TRACES_RECEIEVED_PER_MINUTE));
if (props.getProperty(TRACE_EXPIRY_MINUTES_KEY) != null) {
config.setDataExpiryMS(TimeUtil.minutesToMillis(PropertiesUtil.getIntProperty(props, TRACE_EXPIRY_MINUTES_KEY, DEFAULT_TRACE_EXPIRY_MINUTES)));
} else {
config.setDataExpiryMS(TimeUtil.daysToMillis(PropertiesUtil.getIntProperty(props, TRACE_EXPIRY_DAYS_KEY, DEFAULT_TRACE_EXPIRY_DAYS)));
}
config.setDataPurgeTraceBatchSize(PropertiesUtil.getIntProperty(props, TRACE_EXPIRY_BATCH_SIZE_KEY, DEFAULT_TRACE_EXPIRY_BATCH_SIZE));
config.setMaxTraceMemory(1024L * 1024L * PropertiesUtil.getLongProperty(props, TRACE_MAX_MEMORY_MB, DEFAULT_TRACE_MAX_MEMORY_MB));
config.setDataPurgeResourceBatchSize(PropertiesUtil.getIntProperty(props, RESOURCE_EXPIRY_BATCH_SIZE_KEY, DEFAULT_RESOURCE_EXPIRY_BATCH_SIZE));
if (props.getProperty(DATA_PURGE_INTERVAL_SECONDS_KEY) != null) {
config.setDataPurgeInterval(TimeUtil.secondsToMillis(PropertiesUtil.getIntProperty(props, DATA_PURGE_INTERVAL_SECONDS_KEY, DEFAULT_DATA_PURGE_INTERVAL_SEC)));
} else {
config.setDataPurgeInterval(TimeUtil.minutesToMillis(PropertiesUtil.getIntProperty(props, DATA_PURGE_INTERVAL_MINUTES_KEY, DEFAULT_DATA_PURGE_INTERVAL_MIN)));
}
config.setMetricMaxGranularity(Granularity.inSeconds(PropertiesUtil.getIntProperty(props, METRIC_MAX_GRANULARITY_SEC_KEY, DEFAULT_METRIC_MAX_GRANULARITY_SEC)));
return config;
}