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 TimerMetric createTimerMetric(@NonNull final String metricName) { final TimerMetric metric = new TimerMetric(metricName); metric.addTags(getBaseTags()); metricSet.add(metric); return metric; }
private boolean lockDag(@NotEmpty final String jobName, @NotEmpty final String dagName) { final String key = LockManager.getLockKey(DAG_LOCK_KEY, dagName); final TimerMetric timerMetric = new TimerMetric(JobMetricNames.JOB_DAG_LOCK_TIME_MS, ImmutableMap.of( JOB_FREQUENCY_TAG, jobFrequency, JOB_NAME_TAG, jobName, DATA_FEED_TAG, dagName)); final boolean success = lockManager.lock(key, String.format("JobDag %s AppId %s", dagName, appId)); timerMetric.stop(); dagTimerMetricMap.put(dagName, timerMetric); return success; }
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; }
private JobLockManager(@NonNull final Configuration conf, @NotEmpty final String frequency, final boolean shouldLockFrequency) { this.lockManager = new LockManager(conf); this.jobFrequency = frequency; final String key = LockManager.getLockKey(MANAGER_LOCK_KEY, jobFrequency); this.managerTimerMetric = new TimerMetric(JobMetricNames.JOB_MANAGER_LOCK_TIME_MS, ImmutableMap.of(JOB_FREQUENCY_TAG, jobFrequency, JOB_NAME_TAG, appName)); if (shouldLockFrequency) { final boolean success = lockManager.lock(key, String.format("JobManager %s AppId %s", jobFrequency, appId)); this.managerTimerMetric.stop(); if (!success) { lockManager.close(); throw new IllegalStateException("Failed to obtain lock for JobManager " + jobFrequency); } } else { managerTimerMetric.stop(); log.info("Frequency lock disabled"); } this.dagTimerMetricMap = new HashMap<>(); }
@Before public void setupTestClass() { this.timerMetric = new TimerMetric("timer-big-function"); }