/** * * Return an existing timer if * (a) A timer already exist with the same metric name. * Otherwise, creates a new timer and registers * * @param registry MetricsRegistry * @param name metric name * @param durationUnit TimeUnit for duration * @param rateUnit TimeUnit for rate determination * @return Timer */ public static Timer newTimer(MetricsRegistry registry, MetricName name, TimeUnit durationUnit, TimeUnit rateUnit) { if (registry != null) { return registry.newTimer(name, durationUnit, rateUnit); } else { return Metrics.newTimer(name, durationUnit, rateUnit); } }
Timer timer = Metrics.newTimer( BcryptCommandTest.class, "hashtimer" );
SHTimerMetric(TimeUnit durationUnit, TimeUnit rateUnit) { t = Metrics.newTimer(this.getClass(),"Timer",durationUnit, rateUnit); }
/** * Constructor. * * @param clazz * class for calculating metrics */ public BasicMetrics(Class<?> clazz) { sinkRequests = Metrics.newMeter(clazz, "sinkRequests", "sinkRequests", TimeUnit.SECONDS); sinkTimer = Metrics.newTimer(clazz, "responses", TimeUnit.MILLISECONDS, TimeUnit.SECONDS); requestsTimer = Metrics.newTimer(clazz, "requests", TimeUnit.MILLISECONDS, TimeUnit.SECONDS); }
public HttpSender(final String collectorHost, final int collectorPort, final EventType eventType, final long httpMaxWaitTimeInMillis, final long httpMaxKeepAliveInMillis, final int httpWorkersPoolSize) { this(new ThreadSafeAsyncHttpClient(collectorHost, collectorPort, eventType, httpMaxKeepAliveInMillis), httpMaxWaitTimeInMillis, Metrics.newTimer(HttpSender.class, collectorHost.replace(":", "_"), TimeUnit.MILLISECONDS, TimeUnit.SECONDS), httpWorkersPoolSize); }
public AMQSession(final AMQPublisherConfig config, final AMQConnection connection, final String topic, final AtomicBoolean useBytesMessage) { this.config = config; this.connection = connection; this.topic = topic; this.useBytesMessage = useBytesMessage; timer = Metrics.newTimer(AMQSession.class, topic, TimeUnit.MILLISECONDS, TimeUnit.SECONDS); reinit(); }
public RowBasedIndexer(String indexerName, IndexerConf conf, String tableName, ResultToSolrMapper mapper, Connection tablePool, Sharder sharder, SolrInputDocumentWriter solrWriter) { super(indexerName, conf, tableName, mapper, sharder, solrWriter); this.tablePool = tablePool; rowReadTimer = Metrics.newTimer(metricName(getClass(), "Row read timer", indexerName), TimeUnit.MILLISECONDS, TimeUnit.SECONDS); }
public ActivityPrimitivesStorage(String fieldName, String indexDir) { this.fieldName = fieldName; this.indexDir = indexDir; timer = Metrics.newTimer(new MetricName(MetricsConstants.Domain, "timer", "initIntActivities-time-" + fieldName.replaceAll(":", "-"), "initIntActivities"), TimeUnit.MILLISECONDS, TimeUnit.SECONDS); }
public CompositeActivityStorage(String indexDir) { this.indexDir = indexDir; timer = Metrics.newTimer(new MetricName(MetricsConstants.Domain, "timer", "initCompositeActivities-time", "CompositeActivityStorage"), TimeUnit.MILLISECONDS, TimeUnit.SECONDS); }
/** * Constructor. * * @param clazz * class for calculating metrics */ public BasicMetrics(Class<?> clazz) { requests = Metrics.newMeter(clazz, "requests", "requests", TimeUnit.SECONDS); timer = Metrics.newTimer(clazz, "responses", TimeUnit.MILLISECONDS, TimeUnit.SECONDS); }
private TimerContext startTimer(String name) { if (enableTimers) { final com.yammer.metrics.core.Timer timer = Metrics.newTimer(getClass(), name, TimeUnit.MILLISECONDS, TimeUnit.SECONDS); TimerContext context = timer.time(); return context; } else { return null; } }
public RowBasedIndexer(String indexerName, IndexerConf conf, String tableName, ResultToSolrMapper mapper, Connection tablePool, Sharder sharder, SolrInputDocumentWriter solrWriter) { super(indexerName, conf, tableName, mapper, sharder, solrWriter); this.tablePool = tablePool; rowReadTimer = Metrics.newTimer(metricName(getClass(), "Row read timer", indexerName), TimeUnit.MILLISECONDS, TimeUnit.SECONDS); }
private Timer buildTimer(int partition) { MetricName partitionSearchMetricName = new MetricName(MetricsConstants.Domain, "timer", "partition-time-" + partition, "partition"); return Metrics.newTimer(partitionSearchMetricName, TimeUnit.MILLISECONDS, TimeUnit.SECONDS); }
private TimerContext startTimer(String name) { if (enableTimers) { final com.yammer.metrics.core.Timer timer = Metrics.newTimer( getClass(), name, TimeUnit.MILLISECONDS, TimeUnit.SECONDS ); TimerContext context = timer.time(); return context; } else { return null; } }
Indexer(String indexerName, IndexerConf conf, String tableName, ResultToSolrMapper mapper, Sharder sharder, SolrInputDocumentWriter solrWriter) { this.indexerName = indexerName; this.conf = conf; this.tableName = tableName; this.mapper = mapper; try { this.uniqueKeyFormatter = conf.getUniqueKeyFormatterClass().newInstance(); } catch (Exception e) { throw new RuntimeException("Problem instantiating the UniqueKeyFormatter.", e); } ConfigureUtil.configure(uniqueKeyFormatter, conf.getGlobalParams()); this.sharder = sharder; this.solrWriter = solrWriter; this.indexingTimer = Metrics.newTimer(metricName(getClass(), "Index update calculation timer", indexerName), TimeUnit.MILLISECONDS, TimeUnit.SECONDS); }
Indexer(String indexerName, IndexerConf conf, String tableName, ResultToSolrMapper mapper, Sharder sharder, SolrInputDocumentWriter solrWriter) { this.indexerName = indexerName; this.conf = conf; this.tableName = tableName; this.mapper = mapper; try { this.uniqueKeyFormatter = conf.getUniqueKeyFormatterClass().newInstance(); } catch (Exception e) { throw new RuntimeException("Problem instantiating the UniqueKeyFormatter.", e); } ConfigureUtil.configure(uniqueKeyFormatter, conf.getGlobalParams()); this.sharder = sharder; this.solrWriter = solrWriter; this.indexingTimer = Metrics.newTimer(metricName(getClass(), "Index update calculation timer", indexerName), TimeUnit.MILLISECONDS, TimeUnit.SECONDS); }
/** * Create LatencyMetrics with given group, type, prefix to append to each metric name, and scope. * * @param factory MetricName factory to use * @param namePrefix Prefix to append to each metric name */ public LatencyMetrics(MetricNameFactory factory, String namePrefix) { this.factory = factory; this.namePrefix = namePrefix; latency = Metrics.newTimer(factory.createMetricName(namePrefix + "Latency"), TimeUnit.MICROSECONDS, TimeUnit.SECONDS); totalLatency = Metrics.newCounter(factory.createMetricName(namePrefix + "TotalLatency")); }
/** * Create new instance * * @param proxyAPI handles interaction with Wavefront servers as well as queueing. * @param handle handle (usually port number), that serves as an identifier for the metrics pipeline. * @param threadId thread number. * @param rateLimiter rate limiter to control outbound point rate. * @param pushFlushInterval interval between flushes. * @param itemsPerBatch max points per flush. * @param memoryBufferLimit max points in task's memory buffer before queueing. * */ ReportSourceTagSenderTask(ForceQueueEnabledAgentAPI proxyAPI, String handle, int threadId, AtomicInteger pushFlushInterval, @Nullable RecyclableRateLimiter rateLimiter, @Nullable AtomicInteger itemsPerBatch, @Nullable AtomicInteger memoryBufferLimit) { super("sourceTags", handle, threadId, itemsPerBatch, memoryBufferLimit); this.proxyAPI = proxyAPI; this.batchSendTime = Metrics.newTimer(new MetricName("api.sourceTags." + handle, "", "duration"), TimeUnit.MILLISECONDS, TimeUnit.MINUTES); this.pushFlushInterval = pushFlushInterval; this.rateLimiter = rateLimiter; this.permitsGranted = Metrics.newCounter(new MetricName("limiter", "", "permits-granted")); this.permitsDenied = Metrics.newCounter(new MetricName("limiter", "", "permits-denied")); this.permitsRetried = Metrics.newCounter(new MetricName("limiter", "", "permits-retried")); this.scheduler.schedule(this, this.pushFlushInterval.get(), TimeUnit.MILLISECONDS); }
/** * Constructor * * @param name String name * @param printPeriod how often to print */ public MetricsObserver(String name, int printPeriod) { TimeUnit durationUnit = TimeUnit.MICROSECONDS; TimeUnit rateUnit = TimeUnit.MILLISECONDS; this.printPeriod = printPeriod; readTimer = Metrics.newTimer(new MetricName(name, "", "reads"), durationUnit, rateUnit); readSuccessRatio = new CounterRatioGauge(Metrics.newCounter(new MetricName(name, "", "successes")), Metrics.newCounter(new MetricName(name, "", "-reads"))); parseTimer = Metrics.newTimer(new MetricName(name, "", "parses"), durationUnit, rateUnit); }
public CommitLogMetrics(final AbstractCommitLogService service, final CommitLogSegmentManager allocator) { completedTasks = Metrics.newGauge(factory.createMetricName("CompletedTasks"), new Gauge<Long>() { public Long value() { return service.getCompletedTasks(); } }); pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Long>() { public Long value() { return service.getPendingTasks(); } }); totalCommitLogSize = Metrics.newGauge(factory.createMetricName("TotalCommitLogSize"), new Gauge<Long>() { public Long value() { return allocator.bytesUsed(); } }); waitingOnSegmentAllocation = Metrics.newTimer(factory.createMetricName("WaitingOnSegmentAllocation"), TimeUnit.MICROSECONDS, TimeUnit.SECONDS); waitingOnCommit = Metrics.newTimer(factory.createMetricName("WaitingOnCommit"), TimeUnit.MICROSECONDS, TimeUnit.SECONDS); } }