@Override public void onAddJob(JobSpec addedJob) { this.totalAddedJobs.incrementAndGet(); submitTrackingEvent(addedJob, JOB_ADDED_OPERATION_TYPE); }
private Collection<JobSpec> getJobsWithTimeUpdate() { long startTime = System.currentTimeMillis(); Collection<JobSpec> jobSpecs = getJobs(); this.metrics.updateGetJobTime(startTime); return jobSpecs; }
private void submitTrackingEvent(JobSpec job, String operType) { submitTrackingEvent(job.getUri(), job.getVersion(), operType); }
protected StandardMetrics createStandardMetrics(Optional<Config> sysConfig) { return new StandardMetrics(this, sysConfig); }
@Override public void onAddJob(JobSpec addedJob) { this.totalAddedJobs.incrementAndGet(); submitTrackingEvent(addedJob, JOB_ADDED_OPERATION_TYPE); }
private Collection<JobSpec> getJobsWithTimeUpdate() { long startTime = System.currentTimeMillis(); Collection<JobSpec> jobSpecs = getJobs(); this.metrics.updateGetJobTime(startTime); return jobSpecs; }
@Override public void onDeleteJob(URI deletedJobURI, String deletedJobVersion) { this.totalDeletedJobs.incrementAndGet(); submitTrackingEvent(deletedJobURI, deletedJobVersion, JOB_DELETED_OPERATION_TYPE); }
@Override public void onUpdateJob(JobSpec updatedJob) { this.totalUpdatedJobs.incrementAndGet(); submitTrackingEvent(updatedJob, JOB_UPDATED_OPERATION_TYPE); } }
Assert.assertEquals(cat.getMetrics().getNumActiveJobs().getValue().intValue(), 1); Assert.assertEquals(cat.getMetrics().getTotalAddCalls().getValue().longValue(), 1); Assert.assertEquals(cat.getMetrics().getTotalUpdateCalls().getValue().longValue(), 0); Assert.assertEquals(cat.getMetrics().getTotalDeleteCalls().getValue().longValue(), 0); ma.assertEvent(Predicates.and( MetricsAssert.eqEventNamespace(JobCatalog.class.getName()), Assert.assertEquals(cat.getMetrics().getNumActiveJobs().getValue().intValue(), 1); Assert.assertEquals(cat.getMetrics().getTotalAddCalls().getValue().longValue(), 1); Assert.assertEquals(cat.getMetrics().getTotalUpdateCalls().getValue().longValue(), 1); Assert.assertEquals(cat.getMetrics().getTotalDeleteCalls().getValue().longValue(), 0); ma.assertEvent(Predicates.and( MetricsAssert.eqEventNamespace(JobCatalog.class.getName()), Assert.assertEquals(cat.getMetrics().getNumActiveJobs().getValue().intValue(), 2); Assert.assertEquals(cat.getMetrics().getTotalAddCalls().getValue().longValue(), 2); Assert.assertEquals(cat.getMetrics().getTotalUpdateCalls().getValue().longValue(), 1); Assert.assertEquals(cat.getMetrics().getTotalDeleteCalls().getValue().longValue(), 0); ma.assertEvent(Predicates.and( MetricsAssert.eqEventNamespace(JobCatalog.class.getName()), Assert.assertEquals(cat.getMetrics().getNumActiveJobs().getValue().intValue(), 2); Assert.assertEquals(cat.getMetrics().getTotalAddCalls().getValue().longValue(), 2); Assert.assertEquals(cat.getMetrics().getTotalUpdateCalls().getValue().longValue(), 2); Assert.assertEquals(cat.getMetrics().getTotalDeleteCalls().getValue().longValue(), 0); ma.assertEvent(Predicates.and( MetricsAssert.eqEventNamespace(JobCatalog.class.getName()), Assert.assertEquals(cat.getMetrics().getNumActiveJobs().getValue().intValue(), 1);
private void submitTrackingEvent(JobSpec job, String operType) { submitTrackingEvent(job.getUri(), job.getVersion(), operType); }
protected StandardMetrics createStandardMetrics(Optional<Config> sysConfig) { return new StandardMetrics(this, sysConfig); }
@Override public void onDeleteJob(URI deletedJobURI, String deletedJobVersion) { this.totalDeletedJobs.incrementAndGet(); submitTrackingEvent(deletedJobURI, deletedJobVersion, JOB_DELETED_OPERATION_TYPE); }
@Override public void onUpdateJob(JobSpec updatedJob) { this.totalUpdatedJobs.incrementAndGet(); submitTrackingEvent(updatedJob, JOB_UPDATED_OPERATION_TYPE); } }