/** * * Return an existing histogram if * (a) A histogram already exist with the same metric name. * Otherwise, creates a new meter and registers * * @param registry MetricsRegistry * @param name metric name * @param biased (true if uniform distribution, otherwise exponential weighted) * @return histogram */ public static Histogram newHistogram(MetricsRegistry registry, MetricName name, boolean biased) { if (registry != null) { return registry.newHistogram(name, biased); } else { return Metrics.newHistogram(name, biased); } }
/** * Creates a new non-biased {@link com.yammer.metrics.core.Histogram} and registers it under the * given metric name. * * @param metricName the name of the metric * @return a new {@link com.yammer.metrics.core.Histogram} */ public static Histogram newHistogram(MetricName metricName) { return newHistogram(metricName, false); }
public MetricsForkJoinPoolMonitor(String name, ForkJoinPool fjPool, Map<?, Integer> highContentionObjects) { super(name, fjPool, highContentionObjects); this.runsPerTask = Metrics.newHistogram(MetricsForkJoinPoolMonitor.class, "runsPerTask", name, true); }
public PointHandlerImpl(final String handle, final String validationLevel, final int blockedPointsPerBatch, @Nullable final String prefix, final PostPushDataTimedTask[] sendDataTasks) { this.validationLevel = validationLevel; this.handle = handle; this.blockedPointsPerBatch = blockedPointsPerBatch; this.prefix = prefix; String logPointsProperty = System.getProperty("wavefront.proxy.logpoints"); this.logPointsFlag = logPointsProperty != null && logPointsProperty.equalsIgnoreCase("true"); String logPointsSampleRateProperty = System.getProperty("wavefront.proxy.logpoints.sample-rate"); this.logPointsSampleRate = logPointsSampleRateProperty != null && NumberUtils.isNumber(logPointsSampleRateProperty) ? Double.parseDouble(logPointsSampleRateProperty) : 1.0d; this.receivedPointLag = Metrics.newHistogram(new MetricName("points." + handle + ".received", "", "lag")); this.sendDataTasks = sendDataTasks; }
public PointHandlerImpl(final String handle, final String validationLevel, final int blockedPointsPerBatch, @Nullable final String prefix, final PostPushDataTimedTask[] sendDataTasks) { this.validationLevel = validationLevel; this.handle = handle; this.blockedPointsPerBatch = blockedPointsPerBatch; this.prefix = prefix; String logPointsProperty = System.getProperty("wavefront.proxy.logpoints"); this.logPointsFlag = logPointsProperty != null && logPointsProperty.equalsIgnoreCase("true"); String logPointsSampleRateProperty = System.getProperty("wavefront.proxy.logpoints.sample-rate"); this.logPointsSampleRate = logPointsSampleRateProperty != null && NumberUtils.isNumber(logPointsSampleRateProperty) ? Double.parseDouble(logPointsSampleRateProperty) : 1.0d; this.receivedPointLag = Metrics.newHistogram(new MetricName("points." + handle + ".received", "", "lag")); this.sendDataTasks = sendDataTasks; }
/** * Create a histogram-like interface that will register both a CF, keyspace and global level * histogram and forward any updates to both */ protected ColumnFamilyHistogram createColumnFamilyHistogram(String name, Histogram keyspaceHistogram) { Histogram cfHistogram = Metrics.newHistogram(factory.createMetricName(name), true); register(name, cfHistogram); return new ColumnFamilyHistogram(cfHistogram, keyspaceHistogram, Metrics.newHistogram(globalNameFactory.createMetricName(name), true)); }
@Override public void execute(Object callback) { parsePostingResponse(service.postPushData(currentAgentId, workUnitId, currentMillis, format, pushData)); if (timeSpentInQueue == null) { timeSpentInQueue = Metrics.newHistogram(new MetricName("buffer", "", "queue-time")); } // timestamps on PostPushDataResultTask are local system clock, not drift-corrected clock timeSpentInQueue.update(System.currentTimeMillis() - currentMillis); }
@VisibleForTesting PointHandlerDispatcher(AccumulationCache digests, PointHandler output, TimeProvider clock, @Nullable Integer dispatchLimit, @Nullable Utils.Granularity granularity) { this.digests = digests; this.output = output; this.clock = clock; this.dispatchLimit = dispatchLimit; String metricNamespace = "histogram.accumulator." + Utils.Granularity.granularityToString(granularity); this.dispatchCounter = Metrics.newCounter(new MetricName(metricNamespace, "", "dispatched")); this.dispatchErrorCounter = Metrics.newCounter(new MetricName(metricNamespace, "", "dispatch_errors")); this.accumulatorSize = Metrics.newHistogram(new MetricName(metricNamespace, "", "size")); this.dispatchProcessTime = Metrics.newHistogram(new MetricName(metricNamespace, "", "dispatch_process_nanos")); this.dispatchLagMillis = Metrics.newHistogram(new MetricName(metricNamespace, "", "dispatch_lag_millis")); }
@Override public void execute(Object callback) { parsePostingResponse(service.postPushData(currentAgentId, workUnitId, currentMillis, format, pushData)); if (timeSpentInQueue == null) { timeSpentInQueue = Metrics.newHistogram(new MetricName("buffer", "", "queue-time")); } // timestamps on PostPushDataResultTask are local system clock, not drift-corrected clock timeSpentInQueue.update(System.currentTimeMillis() - currentMillis); }
@VisibleForTesting PointHandlerDispatcher(AccumulationCache digests, PointHandler output, TimeProvider clock, @Nullable Integer dispatchLimit, @Nullable Utils.Granularity granularity) { this.digests = digests; this.output = output; this.clock = clock; this.dispatchLimit = dispatchLimit; String metricNamespace = "histogram.accumulator." + Utils.Granularity.granularityToString(granularity); this.dispatchCounter = Metrics.newCounter(new MetricName(metricNamespace, "", "dispatched")); this.dispatchErrorCounter = Metrics.newCounter(new MetricName(metricNamespace, "", "dispatch_errors")); this.accumulatorSize = Metrics.newHistogram(new MetricName(metricNamespace, "", "size")); this.dispatchProcessTime = Metrics.newHistogram(new MetricName(metricNamespace, "", "dispatch_process_nanos")); this.dispatchLagMillis = Metrics.newHistogram(new MetricName(metricNamespace, "", "dispatch_lag_millis")); }
/** * Create new instance. * * @param handle handle/port number * @param blockedItemsPerBatch controls sample rate of how many blocked points are written into the main log file. * @param senderTasks sender tasks */ ReportPointHandlerImpl(final String handle, final int blockedItemsPerBatch, final Collection<SenderTask> senderTasks) { super(ReportableEntityType.POINT, handle, blockedItemsPerBatch, new ReportPointSerializer(), senderTasks); String logPointsProperty = System.getProperty("wavefront.proxy.logpoints"); this.logPointsFlag = logPointsProperty != null && logPointsProperty.equalsIgnoreCase("true"); String logPointsSampleRateProperty = System.getProperty("wavefront.proxy.logpoints.sample-rate"); this.logSampleRate = NumberUtils.isNumber(logPointsSampleRateProperty) ? Double.parseDouble(logPointsSampleRateProperty) : 1.0d; this.receivedPointLag = Metrics.newHistogram(new MetricName("points." + handle + ".received", "", "lag")); this.attemptedCounter = Metrics.newCounter(new MetricName("points." + handle, "", "sent")); this.queuedCounter = Metrics.newCounter(new MetricName("points." + handle, "", "queued")); this.statisticOutputExecutor.scheduleAtFixedRate(this::printStats, 10, 10, TimeUnit.SECONDS); this.statisticOutputExecutor.scheduleAtFixedRate(this::printTotal, 1, 1, TimeUnit.MINUTES); }
@VisibleForTesting protected DataDogPortUnificationHandler(final String handle, final ReportableEntityHandler<ReportPoint> pointHandler, final boolean processSystemMetrics, final boolean processServiceChecks, @Nullable final HttpClient requestRelayClient, @Nullable final String requestRelayTarget, @Nullable final ReportableEntityPreprocessor preprocessor) { super(TokenAuthenticatorBuilder.create().setTokenValidationMethod(TokenValidationMethod.NONE).build(), handle, false, true); this.pointHandler = pointHandler; this.processSystemMetrics = processSystemMetrics; this.processServiceChecks = processServiceChecks; this.requestRelayClient = requestRelayClient; this.requestRelayTarget = requestRelayTarget; this.preprocessor = preprocessor; this.jsonParser = new ObjectMapper(); this.httpRequestSize = Metrics.newHistogram(new TaggedMetricName("listeners", "http-requests.payload-points", "port", handle)); Metrics.newGauge(new TaggedMetricName("listeners", "tags-cache-size", "port", handle), new Gauge<Long>() { @Override public Long value() { return tagsCache.estimatedSize(); } }); }
/** * Create new instance. * * @param handle handle/port number * @param blockedItemsPerBatch controls sample rate of how many blocked points are written into the main log file. * @param senderTasks sender tasks */ ReportPointHandlerImpl(final String handle, final int blockedItemsPerBatch, final Collection<SenderTask> senderTasks) { super(ReportableEntityType.POINT, handle, blockedItemsPerBatch, new ReportPointSerializer(), senderTasks); String logPointsProperty = System.getProperty("wavefront.proxy.logpoints"); this.logPointsFlag = logPointsProperty != null && logPointsProperty.equalsIgnoreCase("true"); String logPointsSampleRateProperty = System.getProperty("wavefront.proxy.logpoints.sample-rate"); this.logSampleRate = NumberUtils.isNumber(logPointsSampleRateProperty) ? Double.parseDouble(logPointsSampleRateProperty) : 1.0d; this.receivedPointLag = Metrics.newHistogram(new MetricName("points." + handle + ".received", "", "lag")); this.attemptedCounter = Metrics.newCounter(new MetricName("points." + handle, "", "sent")); this.queuedCounter = Metrics.newCounter(new MetricName("points." + handle, "", "queued")); this.statisticOutputExecutor.scheduleAtFixedRate(this::printStats, 10, 10, TimeUnit.SECONDS); this.statisticOutputExecutor.scheduleAtFixedRate(this::printTotal, 1, 1, TimeUnit.MINUTES); }
public AccumulationTask(ObjectQueue<List<String>> input, AccumulationCache digests, Decoder<String> decoder, PointHandler blockedPointsHandler, Validation.Level validationLevel, long ttlMillis, @Nullable Utils.Granularity granularity, short compression) { this.input = input; this.digests = digests; this.decoder = decoder; this.blockedPointsHandler = blockedPointsHandler; this.validationLevel = validationLevel; this.ttlMillis = ttlMillis; this.granularity = granularity == null ? Utils.Granularity.DAY : granularity; this.compression = compression; String metricNamespace = "histogram.accumulator." + Utils.Granularity.granularityToString(granularity); eventCounter = Metrics.newCounter(new MetricName(metricNamespace, "", "sample_added")); histogramCounter = Metrics.newCounter(new MetricName(metricNamespace, "", "histogram_added")); ignoredCounter = Metrics.newCounter(new MetricName(metricNamespace, "", "ignored")); batchProcessTime = Metrics.newHistogram(new MetricName(metricNamespace, "", "batch_process_nanos")); histogramBinCount = Metrics.newHistogram(new MetricName(metricNamespace, "", "histogram_bins")); histogramSampleCount = Metrics.newHistogram(new MetricName(metricNamespace, "", "histogram_samples")); }
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; }
IndexingMetrics(int partition) { MetricName docsIndexedName = new MetricName(MetricsConstants.Domain, "meter", "docs-indexed", "indexer"); docsIndexedMetric = Metrics.newMeter(docsIndexedName, "indexing", TimeUnit.SECONDS); MetricName docsLeftoverName = new MetricName(MetricsConstants.Domain, "meter", "docs-leftover", "indexer"); docsLeftoverMetric = Metrics.newMeter(docsLeftoverName, "indexing", TimeUnit.SECONDS); MetricName flushTimeName = new MetricName(MetricsConstants.Domain, "histogram", "flush-time", "indexer"); flushTimeHistogram = Metrics.newHistogram(flushTimeName, false); } }
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")); }
/** * Create new instance. * * @param tokenAuthenticator tokenAuthenticator for incoming requests. * @param handle handle/port number. */ public PortUnificationHandler(@Nonnull TokenAuthenticator tokenAuthenticator, @Nullable final String handle, boolean plaintextEnabled, boolean httpEnabled) { this.tokenAuthenticator = tokenAuthenticator; this.handle = firstNonNull(handle, "unknown"); this.plaintextEnabled = plaintextEnabled; this.httpEnabled = httpEnabled; this.httpRequestHandleDuration = lazySupplier(() -> Metrics.newHistogram(new TaggedMetricName("listeners", "http-requests.duration-nanos", "port", this.handle))); this.requestsDiscarded = lazySupplier(() -> Metrics.newCounter(new TaggedMetricName("listeners", "http-requests.discarded", "port", this.handle))); this.pointsDiscarded = lazySupplier(() -> Metrics.newCounter(new TaggedMetricName("listeners", "items-discarded", "port", this.handle))); }
/** * Create new instance. * * @param tokenAuthenticator tokenAuthenticator for incoming requests. * @param handle handle/port number. */ public PortUnificationHandler(@Nonnull TokenAuthenticator tokenAuthenticator, @Nullable final String handle, boolean plaintextEnabled, boolean httpEnabled) { this.tokenAuthenticator = tokenAuthenticator; this.handle = firstNonNull(handle, "unknown"); this.plaintextEnabled = plaintextEnabled; this.httpEnabled = httpEnabled; this.httpRequestHandleDuration = lazySupplier(() -> Metrics.newHistogram(new TaggedMetricName("listeners", "http-requests.duration-nanos", "port", this.handle))); this.requestsDiscarded = lazySupplier(() -> Metrics.newCounter(new TaggedMetricName("listeners", "http-requests.discarded", "port", this.handle))); this.pointsDiscarded = lazySupplier(() -> Metrics.newCounter(new TaggedMetricName("listeners", "items-discarded", "port", this.handle))); }