use of com.microsoft.applicationinsights.alerting.config.AlertMetricType in project ApplicationInsights-Java by microsoft.
the class AlertingServiceFactory method addObserver.
private static void addObserver(AlertingSubsystem alertingSubsystem, TelemetryObservers telemetryObservers) {
telemetryObservers.addObserver(telemetry -> {
MonitorDomain data = telemetry.getData().getBaseData();
if (!(data instanceof MetricsData)) {
return;
}
MetricDataPoint point = ((MetricsData) data).getMetrics().get(0);
AlertMetricType alertMetricType = null;
if (point.getName().equals(TOTAL_CPU_PC_METRIC_NAME)) {
alertMetricType = AlertMetricType.CPU;
}
if (alertMetricType != null) {
alertingSubsystem.track(alertMetricType, point.getValue());
}
});
}
Aggregations