Refactor metrics to upgrade to v. 3.0.0 #83

Open
wants to merge 1 commit into
from

Projects

None yet

3 participants

@divchenko
Contributor

Refactor metrics to upgrade to v. 3.0.0 to use configurable alpha smoothing factor

@khayashi

looks good for me.

@santip santip commented on the diff Jun 18, 2013
...seidb/indexing/activity/PurgeUnusedActivitiesJob.java
public class PurgeUnusedActivitiesJob implements Runnable, PurgeUnusedActivitiesJobMBean {
private final static Logger logger = Logger.getLogger(PurgeUnusedActivitiesJob.class);
private final CompositeActivityValues compositeActivityValues;
private final Set<IndexReaderFactory<ZoieIndexReader<BoboIndexReader>>> zoieSystems;
- private static Timer timer = Metrics.newTimer(new MetricName(PurgeUnusedActivitiesJob.class, "purgeUnusedActivityIndexes"), TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
- private static Counter foundActivitiesToPurge = Metrics.newCounter(new MetricName(PurgeUnusedActivitiesJob.class, "foundActivitiesToPurge"));
- private static Counter recentUidsSavedFromPurge = Metrics.newCounter(new MetricName(PurgeUnusedActivitiesJob.class, "recentUidsSavedFromPurge"));
+ private static Timer timer = MetricFactory.newTimer(new MetricName(PurgeUnusedActivitiesJob.class, "purgeUnusedActivityIndexes"));
@santip
santip Jun 18, 2013 Contributor

is seconds a default unit here? why did you remove it?

@divchenko
divchenko Jun 18, 2013 Contributor

yeah, you can't even pass it to new metrics any more

@santip santip commented on the diff Jun 18, 2013
...src/main/java/com/senseidb/metrics/MetricFactory.java
}
}
- /**
- * @see MetricsRegistry#newTimer(com.yammer.metrics.core.MetricName, java.util.concurrent.TimeUnit, java.util.concurrent.TimeUnit)
- */
- public static Timer newTimer(MetricName metricName,
- TimeUnit durationUnit,
- TimeUnit rateUnit) {
- return getRegistry().newTimer(metricName, durationUnit, rateUnit);
+ public static Timer newTimer(MetricName metricName) {
+ Timer timer = new Timer(new ExponentiallyDecayingReservoir(DEFAULT_SIZE, DEFAULT_ALPHA));
@santip
santip Jun 18, 2013 Contributor

any chance we can make these configurable? why 1028 for size?

@divchenko
divchenko Jun 18, 2013 Contributor

1028 is the default value in metrics. It's not going to be a problem. alpha on another hand can be. The best we can do is to mark it as volatile and allow setting from SenseiServer just before everything else is started (unfortunately metrics are used via singleton)

@santip
Contributor
santip commented Jun 18, 2013

in general looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment