use of com.microsoft.applicationinsights.alerting.config.AlertingConfiguration.AlertConfiguration in project ApplicationInsights-Java by microsoft.
the class AlertConfigParser method parseFromMemory.
public static AlertConfiguration parseFromMemory(String memoryConfig) {
if (memoryConfig == null) {
return new AlertConfiguration(AlertMetricType.MEMORY, false, 0f, 0, 0);
}
String[] tokens = memoryConfig.split(" ");
Map<String, ParseConfigValue<AlertConfigurationBuilder>> parsers = new HashMap<>();
parsers.put("memory-threshold", new ParseConfigValue<>(true, (config, arg) -> config.setThreshold(Float.parseFloat(arg))));
parsers.put("memory-trigger-cooldown", new ParseConfigValue<>(true, (config, arg) -> config.setCooldown(Long.parseLong(arg))));
parsers.put("memory-trigger-profilingDuration", new ParseConfigValue<>(true, (config, arg) -> config.setProfileDuration(Long.parseLong(arg))));
parsers.put("memory-trigger-enabled", new ParseConfigValue<>(true, (config, arg) -> config.setEnabled(Boolean.parseBoolean(arg))));
return parseConfig(new AlertConfigurationBuilder(), tokens, parsers).setType(AlertMetricType.MEMORY).createAlertConfiguration();
}
Aggregations