/** * This is equivalent to {@link #contextAwareTimer(String)}. */ @Override public ContextAwareTimer timer(String name) { return contextAwareTimer(name); }
public GobblinHelixJobTaskMetrics(MetricContext metricContext, int windowSizeInMin) { timeBetweenJobSubmissionAndExecution = metricContext.contextAwareTimer(TIME_BETWEEN_JOB_SUBMISSION_AND_EXECUTION, windowSizeInMin, TimeUnit.MINUTES); this.contextAwareMetrics.add(timeBetweenJobSubmissionAndExecution); }
public GobblinHelixMetrics(String metricsName, final MetricContext metricContext, int windowSizeInMin) { this.metricsName = metricsName; this.timeForHelixWait = metricContext.contextAwareTimer(TIMER_FOR_HELIX_WAIT, windowSizeInMin, TimeUnit.MINUTES); this.timeForHelixSubmit = metricContext.contextAwareTimer(TIMER_FOR_HELIX_SUBMIT, windowSizeInMin, TimeUnit.MINUTES); this.submitMeter = metricContext.contextAwareMeter(METER_FOR_HELIX_SUBMIT); this.contextAwareMetrics.add(timeForHelixWait); this.contextAwareMetrics.add(timeForHelixSubmit); this.contextAwareMetrics.add(submitMeter); }
public MutableStandardMetrics(JobCatalog catalog, Optional<Config> sysConfig) { super(catalog, sysConfig); timeForJobCatalogPut = catalog.getMetricContext().contextAwareTimer(TIME_FOR_JOB_CATALOG_PUT, timeWindowSizeInMinutes, TimeUnit.MINUTES); timeForJobCatalogRemove = catalog.getMetricContext().contextAwareTimer(TIME_FOR_JOB_CATALOG_REMOVE, this.timeWindowSizeInMinutes, TimeUnit.MINUTES); this.contextAwareMetrics.add(timeForJobCatalogPut); this.contextAwareMetrics.add(timeForJobCatalogRemove); }
InnerTimer(MetricContext context, String name, ContextAwareTimer contextAwareTimer) { this.name = name; Optional<MetricContext> parentContext = context.getParent(); if (parentContext.isPresent()) { this.parentTimer = Optional.fromNullable(parentContext.get().contextAwareTimer(name)); } else { this.parentTimer = Optional.absent(); } this.timer = new WeakReference<>(contextAwareTimer); }
public MutableStandardMetrics(SpecCatalog catalog, Optional<Config> sysConfig) { super(catalog, sysConfig); timeForSpecCatalogPut = catalog.getMetricContext().contextAwareTimer(TIME_FOR_SPEC_CATALOG_PUT, this.timeWindowSizeInMinutes, TimeUnit.MINUTES); timeForSpecCatalogRemove = catalog.getMetricContext().contextAwareTimer(TIME_FOR_SPEC_CATALOG_REMOVE, this.timeWindowSizeInMinutes, TimeUnit.MINUTES); this.contextAwareMetrics.add(timeForSpecCatalogPut); this.contextAwareMetrics.add(timeForSpecCatalogRemove); }
public GobblinHelixPlanningJobLauncherMetrics(String metricsName, final MetricContext metricContext, int windowSizeInMin, HelixJobsMapping jobsMapping) { this.metricsName = metricsName; this.jobsMapping = jobsMapping; this.timeForCompletedPlanningJobs = metricContext.contextAwareTimer(TIMER_FOR_COMPLETED_PLANNING_JOBS, windowSizeInMin, TimeUnit.MINUTES); this.timeForFailedPlanningJobs = metricContext.contextAwareTimer(TIMER_FOR_FAILED_PLANNING_JOBS, windowSizeInMin, TimeUnit.MINUTES); this.numActivePlanningJobs = metricContext.newContextAwareGauge(NUM_ACTIVE_PLANNING_JOBS, ()->getNumOfMappings()); this.contextAwareMetrics.add(timeForCompletedPlanningJobs); this.contextAwareMetrics.add(timeForFailedPlanningJobs); this.contextAwareMetrics.add(numActivePlanningJobs); }
InnerTimer(MetricContext context, String name, ContextAwareTimer contextAwareTimer, long windowSize, TimeUnit unit) { super(new SlidingTimeWindowReservoir(windowSize, unit)); this.name = name; Optional<MetricContext> parentContext = context.getParent(); if (parentContext.isPresent()) { this.parentTimer = Optional.fromNullable(parentContext.get().contextAwareTimer(name, windowSize, unit)); } else { this.parentTimer = Optional.absent(); } this.timer = new WeakReference<>(contextAwareTimer); }
public GobblinHelixJobLauncherMetrics(String metricsName, final MetricContext metricContext, int windowSizeInMin) { this.metricsName = metricsName; // All historical counters this.totalJobsLaunched = new AtomicLong(0); this.totalJobsCompleted = new AtomicLong(0); this.totalJobsCommitted = new AtomicLong(0); this.totalJobsFailed = new AtomicLong(0); this.totalJobsCancelled = new AtomicLong(0); this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.NUM_JOBS_LAUNCHED, ()->this.totalJobsLaunched.get())); this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.NUM_JOBS_COMPLETED, ()->this.totalJobsCompleted.get())); this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.NUM_JOBS_COMMITTED, ()->this.totalJobsCommitted.get())); this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.NUM_JOBS_FAILED, ()->this.totalJobsFailed.get())); this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.NUM_JOBS_CANCELLED, ()->this.totalJobsCancelled.get())); this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.NUM_JOBS_RUNNING, ()->(int)(GobblinHelixJobLauncherMetrics.this.totalJobsLaunched.get() - GobblinHelixJobLauncherMetrics.this.totalJobsCompleted.get()))); this.timeForCompletedJobs = metricContext.contextAwareTimer(JobExecutionLauncher.StandardMetrics.TIMER_FOR_COMPLETED_JOBS, windowSizeInMin, TimeUnit.MINUTES); this.timeForFailedJobs = metricContext.contextAwareTimer(JobExecutionLauncher.StandardMetrics.TIMER_FOR_FAILED_JOBS, windowSizeInMin, TimeUnit.MINUTES); this.timeForCommittedJobs = metricContext.contextAwareTimer(JobExecutionLauncher.StandardMetrics.TIMER_FOR_COMMITTED_JOBS, windowSizeInMin, TimeUnit.MINUTES); this.contextAwareMetrics.add(timeForCommittedJobs); this.contextAwareMetrics.add(timeForCompletedJobs); this.contextAwareMetrics.add(timeForFailedJobs); }
public GobblinHelixJobSchedulerMetrics (final ExecutorService jobExecutor, final MetricContext metricContext, int windowSizeInMin) { this.timeBeforeJobScheduling = metricContext.contextAwareTimer(TIMER_BEFORE_JOB_SCHEDULING, windowSizeInMin, TimeUnit.MINUTES); this.timeBeforeJobLaunching = metricContext.contextAwareTimer(TIMER_BEFORE_JOB_LAUNCHING, windowSizeInMin, TimeUnit.MINUTES); this.timeBetwenJobSchedulingAndLaunching = metricContext.contextAwareTimer(TIMER_BETWEEN_JOB_SCHEDULING_AND_LAUNCHING, windowSizeInMin, TimeUnit.MINUTES); this.numCancellationStart = new AtomicLong(0); this.numCancellationComplete = new AtomicLong(0); this.contextAwareMetrics.add(metricContext.newContextAwareGauge(SCHEDULE_CANCELLATION_START, ()->this.numCancellationStart.get())); this.contextAwareMetrics.add(metricContext.newContextAwareGauge(SCHEDULE_CANCELLATION_END, ()->this.numCancellationComplete.get())); this.contextAwareMetrics.add(timeBeforeJobScheduling); this.contextAwareMetrics.add(timeBeforeJobLaunching); this.contextAwareMetrics.add(timeBetwenJobSchedulingAndLaunching); this.threadPoolExecutor = (ThreadPoolExecutor) jobExecutor; // executor metrics this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.EXECUTOR_ACTIVE_COUNT, ()->this.threadPoolExecutor.getActiveCount())); this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.EXECUTOR_MAX_POOL_SIZE, ()->this.threadPoolExecutor.getMaximumPoolSize())); this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.EXECUTOR_POOL_SIZE, ()->this.threadPoolExecutor.getPoolSize())); this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.EXECUTOR_CORE_POOL_SIZE, ()->this.threadPoolExecutor.getCorePoolSize())); this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.EXECUTOR_QUEUE_SIZE, ()->this.threadPoolExecutor.getQueue().size())); }
public StandardMetrics(final JobCatalog jobCatalog, Optional<Config> sysConfig) { // timer window size this.timeWindowSizeInMinutes = sysConfig.isPresent()? ConfigUtils.getInt(sysConfig.get(), ConfigurationKeys.METRIC_TIMER_WINDOW_SIZE_IN_MINUTES, ConfigurationKeys.DEFAULT_METRIC_TIMER_WINDOW_SIZE_IN_MINUTES) : ConfigurationKeys.DEFAULT_METRIC_TIMER_WINDOW_SIZE_IN_MINUTES; this.metricsContext = jobCatalog.getMetricContext(); this.totalAddedJobs = new AtomicLong(0); this.totalDeletedJobs = new AtomicLong(0); this.totalUpdatedJobs = new AtomicLong(0); this.timeForJobCatalogGet = metricsContext.contextAwareTimer(TIME_FOR_JOB_CATALOG_GET, timeWindowSizeInMinutes, TimeUnit.MINUTES); this.totalAddCalls = metricsContext.newContextAwareGauge(TOTAL_ADD_CALLS, ()->this.totalAddedJobs.get()); this.totalUpdateCalls = metricsContext.newContextAwareGauge(TOTAL_UPDATE_CALLS, ()->this.totalUpdatedJobs.get()); this.totalDeleteCalls = metricsContext.newContextAwareGauge(TOTAL_DELETE_CALLS, ()->this.totalDeletedJobs.get()); this.numActiveJobs = metricsContext.newContextAwareGauge(NUM_ACTIVE_JOBS_NAME, ()->(int)(totalAddedJobs.get() - totalDeletedJobs.get())); this.contextAwareMetrics.add(timeForJobCatalogGet); this.contextAwareMetrics.add(totalAddCalls); this.contextAwareMetrics.add(totalDeleteCalls); this.contextAwareMetrics.add(totalUpdateCalls); this.contextAwareMetrics.add(numActiveJobs); }
public StandardMetrics(final SpecCatalog specCatalog, Optional<Config> sysConfig) { this.timeWindowSizeInMinutes = sysConfig.isPresent()? ConfigUtils.getInt(sysConfig.get(), ConfigurationKeys.METRIC_TIMER_WINDOW_SIZE_IN_MINUTES, ConfigurationKeys.DEFAULT_METRIC_TIMER_WINDOW_SIZE_IN_MINUTES) : ConfigurationKeys.DEFAULT_METRIC_TIMER_WINDOW_SIZE_IN_MINUTES; this.metricsContext = specCatalog.getMetricContext(); this.timeForSpecCatalogGet = metricsContext.contextAwareTimer(TIME_FOR_SPEC_CATALOG_GET, timeWindowSizeInMinutes, TimeUnit.MINUTES); this.totalAddedSpecs = new AtomicLong(0); this.totalDeletedSpecs = new AtomicLong(0); this.totalUpdatedSpecs = new AtomicLong(0); this.numActiveSpecs = metricsContext.newContextAwareGauge(NUM_ACTIVE_SPECS_NAME, ()->{ long startTime = System.currentTimeMillis(); int size = specCatalog.getSpecs().size(); updateGetSpecTime(startTime); return size; }); this.totalAddCalls = metricsContext.newContextAwareGauge(TOTAL_ADD_CALLS, ()->this.totalAddedSpecs.get()); this.totalUpdateCalls = metricsContext.newContextAwareGauge(TOTAL_UPDATE_CALLS, ()->this.totalUpdatedSpecs.get()); this.totalDeleteCalls = metricsContext.newContextAwareGauge(TOTAL_DELETE_CALLS, ()->this.totalDeletedSpecs.get()); this.contextAwareMetrics.add(numActiveSpecs); this.contextAwareMetrics.add(totalAddCalls); this.contextAwareMetrics.add(totalUpdateCalls); this.contextAwareMetrics.add(totalDeleteCalls); this.contextAwareMetrics.add(timeForSpecCatalogGet); }
Counter totalRecordsCounter = this.context.contextAwareCounter(TOTAL_RECORDS); Meter recordProcessRateMeter = this.context.contextAwareMeter(RECORD_PROCESS_RATE); Timer recordProcessTimeTimer = this.context.contextAwareTimer(RECORD_PROCESS_TIME); Histogram recordSizesHistogram = this.context.contextAwareHistogram(RECORD_SIZES);
@Test public void testContextAwareTimer() { ContextAwareTimer jobTotalDuration = this.context.contextAwareTimer(TOTAL_DURATION); Assert.assertEquals(this.context.getTimers().get(jobTotalDuration.getName()), jobTotalDuration.getInnerMetric()); Assert.assertEquals(jobTotalDuration.getContext(), this.context); Assert.assertEquals(jobTotalDuration.getName(), TOTAL_DURATION); jobTotalDuration.update(50, TimeUnit.SECONDS); jobTotalDuration.update(100, TimeUnit.SECONDS); jobTotalDuration.update(150, TimeUnit.SECONDS); Assert.assertEquals(jobTotalDuration.getCount(), 3l); Assert.assertEquals(jobTotalDuration.getSnapshot().getMin(), TimeUnit.SECONDS.toNanos(50l)); Assert.assertEquals(jobTotalDuration.getSnapshot().getMax(), TimeUnit.SECONDS.toNanos(150l)); Assert.assertTrue(jobTotalDuration.time().stop() >= 0l); }
ContextAwareHistogram histogram = metricContext.contextAwareHistogram("testHistogram"); WeakReference<ContextAwareHistogram> histogramWeakReference = new WeakReference<ContextAwareHistogram>(histogram); ContextAwareTimer timer = metricContext.contextAwareTimer("testTimer"); WeakReference<ContextAwareTimer> timerWeakReference = new WeakReference<ContextAwareTimer>(timer);
/** * This is equivalent to {@link #contextAwareTimer(String)}. */ @Override public ContextAwareTimer timer(String name) { return contextAwareTimer(name); }
InnerTimer(MetricContext context, String name, ContextAwareTimer contextAwareTimer) { this.name = name; Optional<MetricContext> parentContext = context.getParent(); if (parentContext.isPresent()) { this.parentTimer = Optional.fromNullable(parentContext.get().contextAwareTimer(name)); } else { this.parentTimer = Optional.absent(); } this.timer = new WeakReference<>(contextAwareTimer); }
public MutableStandardMetrics(SpecCatalog catalog, Optional<Config> sysConfig) { super(catalog, sysConfig); timeForSpecCatalogPut = catalog.getMetricContext().contextAwareTimer(TIME_FOR_SPEC_CATALOG_PUT, this.timeWindowSizeInMinutes, TimeUnit.MINUTES); timeForSpecCatalogRemove = catalog.getMetricContext().contextAwareTimer(TIME_FOR_SPEC_CATALOG_REMOVE, this.timeWindowSizeInMinutes, TimeUnit.MINUTES); this.contextAwareMetrics.add(timeForSpecCatalogPut); this.contextAwareMetrics.add(timeForSpecCatalogRemove); }
public MutableStandardMetrics(JobCatalog catalog, Optional<Config> sysConfig) { super(catalog, sysConfig); timeForJobCatalogPut = catalog.getMetricContext().contextAwareTimer(TIME_FOR_JOB_CATALOG_PUT, timeWindowSizeInMinutes, TimeUnit.MINUTES); timeForJobCatalogRemove = catalog.getMetricContext().contextAwareTimer(TIME_FOR_JOB_CATALOG_REMOVE, this.timeWindowSizeInMinutes, TimeUnit.MINUTES); this.contextAwareMetrics.add(timeForJobCatalogPut); this.contextAwareMetrics.add(timeForJobCatalogRemove); }
InnerTimer(MetricContext context, String name, ContextAwareTimer contextAwareTimer, long windowSize, TimeUnit unit) { super(new SlidingTimeWindowReservoir(windowSize, unit)); this.name = name; Optional<MetricContext> parentContext = context.getParent(); if (parentContext.isPresent()) { this.parentTimer = Optional.fromNullable(parentContext.get().contextAwareTimer(name, windowSize, unit)); } else { this.parentTimer = Optional.absent(); } this.timer = new WeakReference<>(contextAwareTimer); }