Repository: aurora
Updated Branches:
  refs/heads/master a6197316c -> 96d5b648e


Add @Timed annotations to cron stores.

Both cron stores don't have @Timed annoations. This adds them so operators can
look at the throughput of storage.

Bugs closed: AURORA-1665

Reviewed at https://reviews.apache.org/r/46346/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/96d5b648
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/96d5b648
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/96d5b648

Branch: refs/heads/master
Commit: 96d5b648ea250c1bf91c9149a3f5a156df1f1805
Parents: a619731
Author: Zameer Manji <zma...@apache.org>
Authored: Mon Apr 18 14:52:30 2016 -0700
Committer: Zameer Manji <zma...@apache.org>
Committed: Mon Apr 18 14:52:30 2016 -0700

----------------------------------------------------------------------
 .../org/apache/aurora/scheduler/storage/db/DbCronJobStore.java | 6 ++++++
 .../apache/aurora/scheduler/storage/mem/MemCronJobStore.java   | 6 ++++++
 2 files changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/96d5b648/src/main/java/org/apache/aurora/scheduler/storage/db/DbCronJobStore.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/aurora/scheduler/storage/db/DbCronJobStore.java 
b/src/main/java/org/apache/aurora/scheduler/storage/db/DbCronJobStore.java
index 6a9c73e..e48a982 100644
--- a/src/main/java/org/apache/aurora/scheduler/storage/db/DbCronJobStore.java
+++ b/src/main/java/org/apache/aurora/scheduler/storage/db/DbCronJobStore.java
@@ -18,6 +18,7 @@ import javax.inject.Inject;
 import com.google.common.base.Optional;
 import com.google.common.collect.FluentIterable;
 
+import org.apache.aurora.common.inject.TimedInterceptor.Timed;
 import org.apache.aurora.scheduler.storage.CronJobStore;
 import org.apache.aurora.scheduler.storage.db.views.DbJobConfiguration;
 import org.apache.aurora.scheduler.storage.entities.IJobConfiguration;
@@ -44,6 +45,7 @@ class DbCronJobStore implements CronJobStore.Mutable {
     this.taskConfigManager = requireNonNull(taskConfigManager);
   }
 
+  @Timed("db_storage_cron_save_accepted_job")
   @Override
   public void saveAcceptedJob(IJobConfiguration jobConfig) {
     requireNonNull(jobConfig);
@@ -51,17 +53,20 @@ class DbCronJobStore implements CronJobStore.Mutable {
     cronJobMapper.merge(jobConfig, 
taskConfigManager.insert(jobConfig.getTaskConfig()));
   }
 
+  @Timed("db_storage_cron_remove_job")
   @Override
   public void removeJob(IJobKey jobKey) {
     requireNonNull(jobKey);
     cronJobMapper.delete(jobKey);
   }
 
+  @Timed("db_storage_cron_delete_jobs")
   @Override
   public void deleteJobs() {
     cronJobMapper.truncate();
   }
 
+  @Timed("db_storage_cron_fetch_jobs")
   @Override
   public Iterable<IJobConfiguration> fetchJobs() {
     return FluentIterable.from(cronJobMapper.selectAll())
@@ -69,6 +74,7 @@ class DbCronJobStore implements CronJobStore.Mutable {
         .toList();
   }
 
+  @Timed("db_storage_cron_fetch_job")
   @Override
   public Optional<IJobConfiguration> fetchJob(IJobKey jobKey) {
     requireNonNull(jobKey);

http://git-wip-us.apache.org/repos/asf/aurora/blob/96d5b648/src/main/java/org/apache/aurora/scheduler/storage/mem/MemCronJobStore.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/aurora/scheduler/storage/mem/MemCronJobStore.java 
b/src/main/java/org/apache/aurora/scheduler/storage/mem/MemCronJobStore.java
index 365494c..50cfb35 100644
--- a/src/main/java/org/apache/aurora/scheduler/storage/mem/MemCronJobStore.java
+++ b/src/main/java/org/apache/aurora/scheduler/storage/mem/MemCronJobStore.java
@@ -19,6 +19,7 @@ import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Maps;
 
+import org.apache.aurora.common.inject.TimedInterceptor.Timed;
 import org.apache.aurora.scheduler.base.JobKeys;
 import org.apache.aurora.scheduler.storage.CronJobStore;
 import org.apache.aurora.scheduler.storage.entities.IJobConfiguration;
@@ -30,27 +31,32 @@ import org.apache.aurora.scheduler.storage.entities.IJobKey;
 class MemCronJobStore implements CronJobStore.Mutable {
   private final Map<IJobKey, IJobConfiguration> jobs = Maps.newConcurrentMap();
 
+  @Timed("mem_storage_cron_save_accepted_job")
   @Override
   public void saveAcceptedJob(IJobConfiguration jobConfig) {
     IJobKey key = JobKeys.assertValid(jobConfig.getKey());
     jobs.put(key, jobConfig);
   }
 
+  @Timed("mem_storage_cron_remove_job")
   @Override
   public void removeJob(IJobKey jobKey) {
     jobs.remove(jobKey);
   }
 
+  @Timed("mem_storage_cron_delete_jobs")
   @Override
   public void deleteJobs() {
     jobs.clear();
   }
 
+  @Timed("mem_storage_cron_fetch_jobs")
   @Override
   public Iterable<IJobConfiguration> fetchJobs() {
     return ImmutableSet.copyOf(jobs.values());
   }
 
+  @Timed("mem_storage_cron_fetch_job")
   @Override
   public Optional<IJobConfiguration> fetchJob(IJobKey jobKey) {
     return Optional.fromNullable(jobs.get(jobKey));

Reply via email to