test_class.declarator: measurementSession = new MeasurementSession("testApp", "testHost", "testInstance")
test_class.modifier: private final
test_class.original_string: private final MeasurementSession measurementSession = new MeasurementSession("testApp", "testHost", "testInstance");
test_class.type: MeasurementSession
test_class.var_name: measurementSession
test_class.declarator: thresholdMonitoringReporter
test_class.modifier: private
test_class.original_string: private ThresholdMonitoringReporter thresholdMonitoringReporter;
test_class.type: ThresholdMonitoringReporter
test_class.var_name: thresholdMonitoringReporter
test_class.declarator: alerter
test_class.modifier: private
test_class.original_string: private Alerter alerter;
test_class.type: Alerter
test_class.var_name: alerter
test_class.declarator: incidentRepository
test_class.modifier: private
test_class.original_string: private IncidentRepository incidentRepository;
test_class.type: IncidentRepository
test_class.var_name: incidentRepository
test_class.declarator: alertingPlugin
test_class.modifier: private
test_class.original_string: private AlertingPlugin alertingPlugin;
test_class.type: AlertingPlugin
test_class.var_name: alertingPlugin
test_class.file: stagemonitor-alerting/src/test/java/org/stagemonitor/alerting/ThresholdMonitoringReporterTest.java
test_class.identifier: ThresholdMonitoringReporterTest
test_case.body: @Test
  	public void testNoAlertWhenFailureRecovers() throws Exception {
  		Check check = createCheckCheckingMean(2, 6);
  		when(alertingPlugin.getChecks()).thenReturn(Collections.singletonMap(check.getId(), check));
  
  		// violation
  		checkMetrics(7, 0, 0);
  		verify(alerter, times(0)).alert(any(Alerter.AlertArguments.class));
  		final Incident incident = incidentRepository.getIncidentByCheckId(check.getId());
  		assertNotNull(incident);
  		assertEquals(CheckResult.Status.OK, incident.getOldStatus());
  		assertEquals(CheckResult.Status.WARN, incident.getNewStatus());
  		assertNotNull(incident.getFirstFailureAt());
  		assertNull(incident.getResolvedAt());
  		assertEquals(1, incident.getConsecutiveFailures());
  		System.out.println(incident);
  
  		// back to ok
  		checkMetrics(1, 0, 0);
  		verify(alerter, times(0)).alert(any(Alerter.AlertArguments.class));
  		assertNull(incidentRepository.getIncidentByCheckId(check.getId()));
  	}
test_case.class_method_signature: ThresholdMonitoringReporterTest.testNoAlertWhenFailureRecovers()
test_case.full_signature: @Test public void testNoAlertWhenFailureRecovers()
test_case.identifier: testNoAlertWhenFailureRecovers
test_case.invocations: createCheckCheckingMean thenReturn when getChecks singletonMap getId checkMetrics alert verify times any getIncidentByCheckId getId assertNotNull assertEquals getOldStatus assertEquals getNewStatus assertNotNull getFirstFailureAt assertNull getResolvedAt assertEquals getConsecutiveFailures println checkMetrics alert verify times any assertNull getIncidentByCheckId getId
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testNoAlertWhenFailureRecovers()
focal_class.declarator: OPTIMISTIC_CONCURRENCY_CONTROL_RETRIES = 10
focal_class.modifier: private static final
focal_class.original_string: private static final int OPTIMISTIC_CONCURRENCY_CONTROL_RETRIES = 10;
focal_class.type: int
focal_class.var_name: OPTIMISTIC_CONCURRENCY_CONTROL_RETRIES
focal_class.declarator: logger = LoggerFactory.getLogger(getClass())
focal_class.modifier: private final
focal_class.original_string: private final Logger logger = LoggerFactory.getLogger(getClass());
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: alertSender
focal_class.modifier: private final
focal_class.original_string: private final AlertSender alertSender;
focal_class.type: AlertSender
focal_class.var_name: alertSender
focal_class.declarator: incidentRepository
focal_class.modifier: private final
focal_class.original_string: private final IncidentRepository incidentRepository;
focal_class.type: IncidentRepository
focal_class.var_name: incidentRepository
focal_class.declarator: measurementSession
focal_class.modifier: private final
focal_class.original_string: private final MeasurementSession measurementSession;
focal_class.type: MeasurementSession
focal_class.var_name: measurementSession
focal_class.declarator: alertingPlugin
focal_class.modifier: private final
focal_class.original_string: private final AlertingPlugin alertingPlugin;
focal_class.type: AlertingPlugin
focal_class.var_name: alertingPlugin
focal_class.file: stagemonitor-alerting/src/main/java/org/stagemonitor/alerting/ThresholdMonitoringReporter.java
focal_class.identifier: ThresholdMonitoringReporter
focal_class.class_method_signature: ThresholdMonitoringReporter.forRegistry(Metric2Registry registry)
focal_class.full_signature: public static ThresholdMonitoringReporterBuilder forRegistry(Metric2Registry registry)
focal_class.identifier: forRegistry
focal_class.modifiers: public static
focal_class.parameters: (Metric2Registry registry)
focal_class.return: ThresholdMonitoringReporterBuilder
focal_class.signature: ThresholdMonitoringReporterBuilder forRegistry(Metric2Registry registry)
focal_class.class_method_signature: ThresholdMonitoringReporter.ThresholdMonitoringReporter(ThresholdMonitoringReporterBuilder builder)
focal_class.full_signature: public  ThresholdMonitoringReporter(ThresholdMonitoringReporterBuilder builder)
focal_class.identifier: ThresholdMonitoringReporter
focal_class.modifiers: public
focal_class.parameters: (ThresholdMonitoringReporterBuilder builder)
focal_class.signature:  ThresholdMonitoringReporter(ThresholdMonitoringReporterBuilder builder)
focal_class.class_method_signature: ThresholdMonitoringReporter.reportMetrics(Map<MetricName, Gauge> gauges, Map<MetricName, Counter> counters, Map<MetricName, Histogram> histograms, Map<MetricName, Meter> meters, Map<MetricName, Timer> timers)
focal_class.full_signature: @Override public void reportMetrics(Map<MetricName, Gauge> gauges, Map<MetricName, Counter> counters, Map<MetricName, Histogram> histograms, Map<MetricName, Meter> meters, Map<MetricName, Timer> timers)
focal_class.identifier: reportMetrics
focal_class.modifiers: @Override public
focal_class.parameters: (Map<MetricName, Gauge> gauges, Map<MetricName, Counter> counters, Map<MetricName, Histogram> histograms, Map<MetricName, Meter> meters, Map<MetricName, Timer> timers)
focal_class.return: void
focal_class.signature: void reportMetrics(Map<MetricName, Gauge> gauges, Map<MetricName, Counter> counters, Map<MetricName, Histogram> histograms, Map<MetricName, Meter> meters, Map<MetricName, Timer> timers)
focal_class.class_method_signature: ThresholdMonitoringReporter.addMetrics(Map<String, Map<MetricName, Metric>> metricsGroupedByName, Map<MetricName, T > metrics)
focal_class.full_signature: private void addMetrics(Map<String, Map<MetricName, Metric>> metricsGroupedByName, Map<MetricName, T > metrics)
focal_class.identifier: addMetrics
focal_class.modifiers: private
focal_class.parameters: (Map<String, Map<MetricName, Metric>> metricsGroupedByName, Map<MetricName, T > metrics)
focal_class.return: void
focal_class.signature: void addMetrics(Map<String, Map<MetricName, Metric>> metricsGroupedByName, Map<MetricName, T > metrics)
focal_class.class_method_signature: ThresholdMonitoringReporter.checkMetrics(Map<String, Map<MetricName, Metric>> metricsGroupedByName, Check check)
focal_class.full_signature: private void checkMetrics(Map<String, Map<MetricName, Metric>> metricsGroupedByName, Check check)
focal_class.identifier: checkMetrics
focal_class.modifiers: private
focal_class.parameters: (Map<String, Map<MetricName, Metric>> metricsGroupedByName, Check check)
focal_class.return: void
focal_class.signature: void checkMetrics(Map<String, Map<MetricName, Metric>> metricsGroupedByName, Check check)
focal_class.class_method_signature: ThresholdMonitoringReporter.asMap(Metric metric)
focal_class.full_signature: private Map<String, Number> asMap(Metric metric)
focal_class.identifier: asMap
focal_class.modifiers: private
focal_class.parameters: (Metric metric)
focal_class.return: Map<String, Number>
focal_class.signature: Map<String, Number> asMap(Metric metric)
focal_class.class_method_signature: ThresholdMonitoringReporter.addIncident(Check check, List<CheckResult> results)
focal_class.full_signature: private void addIncident(Check check, List<CheckResult> results)
focal_class.identifier: addIncident
focal_class.modifiers: private
focal_class.parameters: (Check check, List<CheckResult> results)
focal_class.return: void
focal_class.signature: void addIncident(Check check, List<CheckResult> results)
focal_class.class_method_signature: ThresholdMonitoringReporter.getAndPersistIncident(Check check, List<CheckResult> results)
focal_class.full_signature: private Incident getAndPersistIncident(Check check, List<CheckResult> results)
focal_class.identifier: getAndPersistIncident
focal_class.modifiers: private
focal_class.parameters: (Check check, List<CheckResult> results)
focal_class.return: Incident
focal_class.signature: Incident getAndPersistIncident(Check check, List<CheckResult> results)
focal_class.class_method_signature: ThresholdMonitoringReporter.getOrCreateIncident(Check check, List<CheckResult> results)
focal_class.full_signature: private Incident getOrCreateIncident(Check check, List<CheckResult> results)
focal_class.identifier: getOrCreateIncident
focal_class.modifiers: private
focal_class.parameters: (Check check, List<CheckResult> results)
focal_class.return: Incident
focal_class.signature: Incident getOrCreateIncident(Check check, List<CheckResult> results)
focal_class.class_method_signature: ThresholdMonitoringReporter.trySaveOrDeleteIncident(Check check, Incident incident)
focal_class.full_signature: private boolean trySaveOrDeleteIncident(Check check, Incident incident)
focal_class.identifier: trySaveOrDeleteIncident
focal_class.modifiers: private
focal_class.parameters: (Check check, Incident incident)
focal_class.return: boolean
focal_class.signature: boolean trySaveOrDeleteIncident(Check check, Incident incident)
focal_class.superclass: extends ScheduledMetrics2Reporter
focal_method.body: private void checkMetrics(Map<String, Map<MetricName, Metric>> metricsGroupedByName, Check check) {
  		List<CheckResult> checkResults = new LinkedList<CheckResult>();
  
  		Map<MetricName, Metric> metricsOfName = metricsGroupedByName.get(check.getTarget().getName());
  		if (metricsOfName == null) {
  			metricsOfName = Collections.emptyMap();
  		}
  		for (Map.Entry<MetricName, Metric> entry : metricsOfName.entrySet()) {
  			if (entry.getKey().matches(check.getTarget())) {
  				try {
  					checkResults.addAll(check.check(entry.getKey(), asMap(entry.getValue())));
  				} catch (RuntimeException e) {
  					logger.warn(e.getMessage(), e);
  				}
  			}
  		}
  		try {
  			addIncident(check, checkResults);
  		} catch (RuntimeException e) {
  			logger.warn(e.getMessage(), e);
  		}
  	}
focal_method.class_method_signature: ThresholdMonitoringReporter.checkMetrics(Map<String, Map<MetricName, Metric>> metricsGroupedByName, Check check)
focal_method.full_signature: private void checkMetrics(Map<String, Map<MetricName, Metric>> metricsGroupedByName, Check check)
focal_method.identifier: checkMetrics
focal_method.invocations: get getName getTarget emptyMap entrySet matches getKey getTarget addAll check getKey asMap getValue warn getMessage addIncident warn getMessage
focal_method.modifiers: private
focal_method.parameters: (Map<String, Map<MetricName, Metric>> metricsGroupedByName, Check check)
focal_method.return: void
focal_method.signature: void checkMetrics(Map<String, Map<MetricName, Metric>> metricsGroupedByName, Check check)