/** * * Return an existing counter if * (a) A counter already exist with the same metric name. * Otherwise, creates a new meter and registers * * @param registry MetricsRegistry * @param name metric name * @return Counter */ public static Counter newCounter(MetricsRegistry registry, MetricName name) { if (registry != null) { return registry.newCounter(name); } else { return Metrics.newCounter(name); } }
/** * Create metrics for given ThreadPoolExecutor. * * @param executor Thread pool * @param path Type of thread pool * @param poolName Name of thread pool to identify metrics */ public ThreadPoolMetrics(final ThreadPoolExecutor executor, String path, String poolName) { this.factory = new ThreadPoolMetricNameFactory("ThreadPools", path, poolName); activeTasks = Metrics.newGauge(factory.createMetricName("ActiveTasks"), new Gauge<Integer>() { public Integer value() { return executor.getActiveCount(); } }); totalBlocked = Metrics.newCounter(factory.createMetricName("TotalBlockedTasks")); currentBlocked = Metrics.newCounter(factory.createMetricName("CurrentlyBlockedTasks")); completedTasks = Metrics.newGauge(factory.createMetricName("CompletedTasks"), new Gauge<Long>() { public Long value() { return executor.getCompletedTaskCount(); } }); pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Long>() { public Long value() { return executor.getTaskCount() - executor.getCompletedTaskCount(); } }); }
public CountingHealthCheck(int maxFailures, String meterName, boolean resetOnSuccess) { super(maxFailures); this.failedCheckCounter = Metrics.newCounter(CountingHealthCheck.class, meterName, null); this.resetOnSuccess = resetOnSuccess; }
public Counter load(InetAddress address) { return Metrics.newCounter(factory.createMetricName("Hints_created-" + address.getHostAddress().replace(':', '.'))); } });
public HistogramLineIngester(Collection<ChannelHandler> handlers, int port) { this.handlers = new ArrayList<>(handlers); this.port = port; this.connectionsAccepted = Metrics.newCounter(new TaggedMetricName("listeners", "connections.accepted", "port", String.valueOf(port))); this.connectionsIdleClosed = Metrics.newCounter(new TaggedMetricName("listeners", "connections.idle.closed", "port", String.valueOf(port))); }
private void initMetrics(int port) { this.connectionsAccepted = Metrics.newCounter(new TaggedMetricName("listeners", "connections.accepted", "port", String.valueOf(port))); this.connectionsIdleClosed = Metrics.newCounter(new TaggedMetricName("listeners", "connections.idle.closed", "port", String.valueOf(port))); }
public RawLogsIngester(LogsIngester logsIngester, int port, Supplier<Long> now) { this.logsIngester = logsIngester; this.port = port; this.now = now; this.received = Metrics.newCounter(new MetricName("logsharvesting", "", "raw-received")); this.connectionsAccepted = Metrics.newCounter(new TaggedMetricName("listeners", "connections.accepted", "port", String.valueOf(port))); this.connectionsIdleClosed = Metrics.newCounter(new TaggedMetricName("listeners", "connections.idle.closed", "port", String.valueOf(port))); }
public ReportPointTimestampInRangeFilter(final int hoursInPastAllowed, final int hoursInFutureAllowed) { this.hoursInPastAllowed = hoursInPastAllowed; this.hoursInFutureAllowed = hoursInFutureAllowed; this.outOfRangePointTimes = Metrics.newCounter(new MetricName("point", "", "badtime")); }
private void incrementCounterForFeed(String feedName) { if (!counterMap.containsKey(feedName)) { synchronized (counterMap) { if (!counterMap.containsKey(feedName)) { Counter counter = Metrics.newCounter(MongodbFeedPublisher.class, "entries-created-for-" + feedName); counterMap.put(feedName, counter); } } } counterMap.get(feedName).inc(); } }
private void incrementCounterForFeed(String feedName) { if (!counterMap.containsKey(feedName)) { synchronized (counterMap) { if (!counterMap.containsKey(feedName)) { Counter counter = Metrics.newCounter( JdbcFeedPublisher.class, "entries-created-for-" + feedName ); counterMap.put(feedName, counter); } } } counterMap.get(feedName).inc(); }
private void incrementCounterForFeed(String feedName) { if (!counterMap.containsKey(feedName)) { synchronized (counterMap) { if (!counterMap.containsKey(feedName)) { Counter counter = Metrics.newCounter(PostgresFeedPublisher.class, "entries-created-for-" + feedName); counterMap.put(feedName, counter); } } } counterMap.get(feedName).inc(); } }
private void incrementCounterForFeed(String feedName) { if (!counterMap.containsKey(feedName)) { synchronized (counterMap) { if (!counterMap.containsKey(feedName)) { Counter counter = Metrics.newCounter(HibernateFeedPublisher.class, "entries-created-for-" + feedName); counterMap.put(feedName, counter); } } } counterMap.get(feedName).inc(); } }
public ReportPointTimestampInRangeFilter(final int hoursInPastAllowed, final int hoursInFutureAllowed) { this.hoursInPastAllowed = hoursInPastAllowed; this.hoursInFutureAllowed = hoursInFutureAllowed; this.outOfRangePointTimes = Metrics.newCounter(new MetricName("point", "", "badtime")); }
public StreamingMetrics(final InetAddress peer) { MetricNameFactory factory = new DefaultNameFactory("Streaming", peer.getHostAddress().replace(':', '.')); incomingBytes = Metrics.newCounter(factory.createMetricName("IncomingBytes")); outgoingBytes= Metrics.newCounter(factory.createMetricName("OutgoingBytes")); } }
public ReportSourceTagHandlerImpl(final String handle, final int blockedItemsPerBatch, final Collection<SenderTask> senderTasks) { super(ReportableEntityType.SOURCE_TAG, handle, blockedItemsPerBatch, new ReportSourceTagSerializer(), senderTasks); this.attemptedCounter = Metrics.newCounter(new MetricName("sourceTags." + handle, "", "sent")); this.queuedCounter = Metrics.newCounter(new MetricName("sourceTags." + handle, "", "queued")); statisticOutputExecutor.scheduleAtFixedRate(this::printStats, 10, 10, TimeUnit.SECONDS); statisticOutputExecutor.scheduleAtFixedRate(this::printTotal, 1, 1, TimeUnit.MINUTES); }
public ReportSourceTagHandlerImpl(final String handle, final int blockedItemsPerBatch, final Collection<SenderTask> senderTasks) { super(ReportableEntityType.SOURCE_TAG, handle, blockedItemsPerBatch, new ReportSourceTagSerializer(), senderTasks); this.attemptedCounter = Metrics.newCounter(new MetricName("sourceTags." + handle, "", "sent")); this.queuedCounter = Metrics.newCounter(new MetricName("sourceTags." + handle, "", "queued")); statisticOutputExecutor.scheduleAtFixedRate(this::printStats, 10, 10, TimeUnit.SECONDS); statisticOutputExecutor.scheduleAtFixedRate(this::printTotal, 1, 1, TimeUnit.MINUTES); }
private void initCounters() { for (int currentPartition : _core.getPartitions()) { partitionCalls.put( currentPartition, Metrics.newCounter(AbstractSenseiCoreService.class, "partitionCallsForPartition" + currentPartition + "andNode" + _core.getNodeId())); } } }
public FilebeatIngester(LogsIngester logsIngester, Supplier<Long> currentMillis) { this.logsIngester = logsIngester; this.received = Metrics.newCounter(new MetricName("logsharvesting", "", "filebeat-received")); this.malformed = Metrics.newCounter(new MetricName("logsharvesting", "", "filebeat-malformed")); this.drift = Metrics.newHistogram(new MetricName("logsharvesting", "", "filebeat-drift")); this.currentMillis = currentMillis; }
public FilebeatIngester(LogsIngester logsIngester, Supplier<Long> currentMillis) { this.logsIngester = logsIngester; this.received = Metrics.newCounter(new MetricName("logsharvesting", "", "filebeat-received")); this.malformed = Metrics.newCounter(new MetricName("logsharvesting", "", "filebeat-malformed")); this.drift = Metrics.newHistogram(new MetricName("logsharvesting", "", "filebeat-drift")); this.currentMillis = currentMillis; }
public CASClientRequestMetrics(String scope) { super(scope); contention = Metrics.newHistogram(factory.createMetricName("ContentionHistogram"), true); conditionNotMet = Metrics.newCounter(factory.createMetricName("ConditionNotMet")); unfinishedCommit = Metrics.newCounter(factory.createMetricName("UnfinishedCommit")); }