@Override public String toString() { return super.toString(); } }
private void reportStatus(final boolean successful) { final long statusValue = successful ? DataFeedMetricNames.RESULT_SUCCESS : DataFeedMetricNames.RESULT_FAILURE; final LongMetric successMetric = new LongMetric( DataFeedMetricNames.RESULT, statusValue); successMetric.addTags(this.dataFeedMetrics.getBaseTags()); this.reporters.report(successMetric); } }
public TimerMetric createJobTimerMetric(@NonNull final JobMetricType metricType, @NonNull final Map<String, String> additionalTags) { final TimerMetric metric = new TimerMetric(getMetricName(metricType)); metric.addTags(getBaseTags()); metric.addTags(additionalTags); metricSet.add(metric); return metric; }
@Test public void testCreateTopicTimerMetric() { Metric topicMetric1 = dataFeedMetrics.createTimerMetric(DataFeedMetricNames.RUNTIME); assertEquals("runtime", topicMetric1.getMetricName()); assertTrue(topicMetric1 instanceof TimerMetric); assertTrue(topicMetric1.getTags().containsKey("job")); assertEquals(topicMetric1.getTags().get("job"), "test-job"); assertTrue(topicMetric1.getTags().containsKey("datafeed")); assertEquals(topicMetric1.getTags().get("datafeed"), "test-topic"); assertFalse(topicMetric1.getTags().containsKey("hello")); topicMetric1.addTag("hello", "world"); assertTrue(topicMetric1.getTags().containsKey("hello")); assertTrue(dataFeedMetrics.getMetricSet().contains(topicMetric1)); }
public TimerMetric createTimerMetric(@NonNull final String metricName) { final TimerMetric metric = new TimerMetric(metricName); metric.addTags(getBaseTags()); metricSet.add(metric); return metric; }
public LongMetric createJobLongMetric(@NonNull final JobMetricType metricType, final long metricValue, @NonNull final Map<String, String> additionalTags) { final LongMetric metric = new LongMetric(getMetricName(metricType), metricValue); metric.addTags(getBaseTags()); metric.addTags(additionalTags); this.metricSet.add(metric); return metric; }
public TestParentSubDag(@NonNull final AtomicInteger stepCounter) { super("parent"); this.stepCounter = stepCounter; addSubDag(0, new TestSubDag(true, stepCounter)); addSubDag(1, new TestSubDag(false, stepCounter)); final String jobName = "testJob"; setJobMetrics(new JobMetrics(jobName)); setDataFeedMetrics(new DataFeedMetrics(jobName, new HashMap<>())); }
public TimerMetric(@NotEmpty final String metricName) { super(metricName); this.addTag("metric-type", "timer"); this.startTime = Instant.now(); }
@Override public boolean execute(final boolean success) { if (success) { this.reporters.getReporters().forEach(reporter -> { this.jobMetrics.gaugeAll(reporter); this.dataFeedMetrics.gaugeAll(reporter); }); } else { log.warn("No metrics produced or actions being executed on reporter because errors were encountered"); } return success; }
@Before public void setupTestClass() { this.timerMetric = new TimerMetric("timer-big-function"); }
@Test(expected=JobRuntimeException.class) public void testGetMetricValueFail() { timerMetric.getMetricValue(); }
public void stop() { if (!this.stopped) { this.endTime = Instant.now(); calculateElapsed(); this.stopped = true; } }
@Override public java.lang.String toString() { return java.lang.String.format("%s:startTime[%s]:endTime[%s]", super.toString(), this.startTime, this.endTime); }
public DoubleMetric(@NotEmpty final String metricName, final double metricValue) { super(metricName, metricValue); this.addTag("metric-type", "double"); }
public LongMetric(@NotEmpty final String metricName, final long metricValue) { super(metricName, metricValue); this.addTag("metric-type", "long"); }
private static String getMetricName(@NonNull final JobMetricType metricType) { return METRIC_PREFIX + metricType.toString().toLowerCase(); }
public TimerMetric createTimerMetric(@NonNull final String metricName, @NonNull final Map<String, String> additionalTags, @NonNull final Optional<Instant> startTime) { final TimerMetric metric = startTime.isPresent() ? new TimerMetric(metricName, additionalTags, startTime.get()) : new TimerMetric(metricName); metric.addTags(getBaseTags()); metric.addTags(additionalTags); metricSet.add(metric); return metric; }
public LongMetric createLongMetric(@NonNull final String metricName, final long metricValue, @NonNull final Map<String, String> additionalTags) { final LongMetric metric = new LongMetric(metricName, metricValue); metric.addTags(getBaseTags()); metric.addTags(additionalTags); this.metricSet.add(metric); return metric; }
@Override public String toString() { return super.toString(); } }