/** * Register gauges to pull native metrics for the column family. * @param columnFamilyName group name for the new gauges * @param handle native handle to the column family */ void registerColumnFamily(String columnFamilyName, ColumnFamilyHandle handle) { MetricGroup group = metricGroup.addGroup(columnFamilyName); for (String property : options.getProperties()) { RocksDBNativeMetricView gauge = new RocksDBNativeMetricView(handle, property); group.gauge(property, gauge); } }
try { Counter completedSplitsCounter = getRuntimeContext().getMetricGroup().counter("numSplitsProcessed"); if (isRunning && format instanceof RichInputFormat) { ((RichInputFormat) format).openInputFormat();
private String getHostFromMetricGroup(MetricGroup metricGroup) { return metricGroup.getAllVariables().get(HOST_VARIABLE); }
public void reportLatency(LatencyMarker marker) { final String uniqueName = granularity.createUniqueHistogramName(marker, operatorId, subtaskIndex); DescriptiveStatisticsHistogram latencyHistogram = this.latencyStats.get(uniqueName); if (latencyHistogram == null) { latencyHistogram = new DescriptiveStatisticsHistogram(this.historySize); this.latencyStats.put(uniqueName, latencyHistogram); granularity.createSourceMetricGroups(metricGroup, marker, operatorId, subtaskIndex) .addGroup("operator_id", String.valueOf(operatorId)) .addGroup("operator_subtask_index", String.valueOf(subtaskIndex)) .histogram("latency", latencyHistogram); } long now = System.currentTimeMillis(); latencyHistogram.update(now - marker.getMarkedTime()); }
this.successfulCommits = this.getRuntimeContext().getMetricGroup().counter(COMMITS_SUCCEEDED_METRICS_COUNTER); this.failedCommits = this.getRuntimeContext().getMetricGroup().counter(COMMITS_FAILED_METRICS_COUNTER); (StreamingRuntimeContext) getRuntimeContext(), offsetCommitMode, getRuntimeContext().getMetricGroup().addGroup(KAFKA_CONSUMER_METRICS_GROUP), useMetrics);
public SumAndCount(String name, MetricGroup metricGroup) { MetricGroup group = metricGroup.addGroup(name); count = group.counter("count"); group.gauge("sum", new Gauge<Double>() { @Override public Double getValue() { return sum; } }); histogram = group.histogram("histogram", new SimpleHistogram()); }
headOperator.setup(containingTask, configuration, output); headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_OUTPUT_WATERMARK, output.getWatermarkGauge());
@Override MetricGroup createSourceMetricGroups( MetricGroup base, LatencyMarker marker, OperatorID operatorId, int operatorSubtaskIndex) { return base .addGroup("source_id", String.valueOf(marker.getOperatorId())); } },
@Override public void setRuntimeContext(RuntimeContext t) { this.runtimeContext = t; eventDelayGauge = new EventDelayGauge(); t.getMetricGroup().getAllVariables().put("<source_tag>", fromSourceTag); t.getMetricGroup().gauge(MetricConstant.DT_EVENT_DELAY_GAUGE, eventDelayGauge); }
public TableServiceMetrics(MetricGroup metricGroup) { this.metricGroup = metricGroup; writeTotalBytesMetrics = metricGroup.counter(WRITE_TOTAL_BYTES_METRIC, new SimpleCounter()); writeBpsMetrics = metricGroup.meter(WRITE_BPS_METRIC, new MeterView(writeTotalBytesMetrics, 10)); readTotalBytesMetrics = metricGroup.counter(READ_TOTAL_BYTES_METRIC, new SimpleCounter()); readBpsMetrics = metricGroup.meter(READ_BPS_METRIC, new MeterView(readTotalBytesMetrics, 10)); }
@Override public void notifyOfAddedMetric(Metric metric, String metricName, MetricGroup group) { final String name = group.getMetricIdentifier(metricName, this); synchronized (this) { if (metric instanceof Counter) { counters.put((Counter) metric, name); } else if (metric instanceof Gauge) { gauges.put((Gauge<?>) metric, name); } else if (metric instanceof Histogram) { histograms.put((Histogram) metric, name); } else if (metric instanceof Meter) { meters.put((Meter) metric, name); } else { log.warn("Cannot add unknown metric type {}. This indicates that the reporter " + "does not support this metric type.", metric.getClass().getName()); } } }
@Override public <M extends Meter> M meter(String name, M meter) { return parentMetricGroup.meter(name, meter); }
@Override public final <H extends Histogram> H histogram(int name, H histogram) { return parentMetricGroup.histogram(name, histogram); }
public void initMetric(){ dirtyDataCounter = runtimeContext.getMetricGroup().counter(MetricConstant.DT_DIRTY_DATA_COUNTER); numInRecord = runtimeContext.getMetricGroup().counter(MetricConstant.DT_NUM_RECORDS_IN_COUNTER); numInRate = runtimeContext.getMetricGroup().meter( MetricConstant.DT_NUM_RECORDS_IN_RATE, new MeterView(numInRecord, 20)); numInBytes = runtimeContext.getMetricGroup().counter(MetricConstant.DT_NUM_BYTES_IN_COUNTER); numInBytesRate = runtimeContext.getMetricGroup().meter(MetricConstant.DT_NUM_BYTES_IN_RATE , new MeterView(numInBytes, 20)); numInResolveRecord = runtimeContext.getMetricGroup().counter(MetricConstant.DT_NUM_RECORDS_RESOVED_IN_COUNTER); numInResolveRate = runtimeContext.getMetricGroup().meter(MetricConstant.DT_NUM_RECORDS_RESOVED_IN_RATE, new MeterView(numInResolveRecord, 20)); } }
public void reportLatency(LatencyMarker marker) { final String uniqueName = granularity.createUniqueHistogramName(marker, operatorId, subtaskIndex); DescriptiveStatisticsHistogram latencyHistogram = this.latencyStats.get(uniqueName); if (latencyHistogram == null) { latencyHistogram = new DescriptiveStatisticsHistogram(this.historySize); this.latencyStats.put(uniqueName, latencyHistogram); granularity.createSourceMetricGroups(metricGroup, marker, operatorId, subtaskIndex) .addGroup("operator_id", String.valueOf(operatorId)) .addGroup("operator_subtask_index", String.valueOf(subtaskIndex)) .histogram("latency", latencyHistogram); } long now = System.currentTimeMillis(); latencyHistogram.update(now - marker.getMarkedTime()); }
@Override public void notifyOfAddedMetric(Metric metric, String metricName, MetricGroup group) { final String name = group.getMetricIdentifier(metricName); List<String> tags = new ArrayList<>(configTags); tags.addAll(getTagsFromMetricGroup(group)); String host = getHostFromMetricGroup(group); if (metric instanceof Counter) { Counter c = (Counter) metric; counters.put(c, new DCounter(c, name, host, tags)); } else if (metric instanceof Gauge) { Gauge g = (Gauge) metric; gauges.put(g, new DGauge(g, name, host, tags)); } else if (metric instanceof Meter) { Meter m = (Meter) metric; // Only consider rate meters.put(m, new DMeter(m, name, host, tags)); } else if (metric instanceof Histogram) { LOGGER.warn("Cannot add {} because Datadog HTTP API doesn't support Histogram", metricName); } else { LOGGER.warn("Cannot add unknown metric type {}. This indicates that the reporter " + "does not support this metric type.", metric.getClass().getName()); } }