Java Code Examples for com.spotify.metrics.core.MetricId#tagged()

The following examples show how to use com.spotify.metrics.core.MetricId#tagged() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SemanticSuggestBackendReporter.java    From heroic with Apache License 2.0 6 votes vote down vote up
public SemanticSuggestBackendReporter(SemanticMetricRegistry registry) {
    final MetricId base = MetricId.build().tagged("component", COMPONENT);

    tagValuesSuggest = new SemanticFutureReporter(registry,
        base.tagged("what", "tag-values-suggest", "unit", Units.QUERY));
    tagKeyCount = new SemanticFutureReporter(registry,
        base.tagged("what", "tag-key-count", "unit", Units.QUERY));
    tagSuggest = new SemanticFutureReporter(registry,
        base.tagged("what", "tag-suggest", "unit", Units.QUERY));
    keySuggest = new SemanticFutureReporter(registry,
        base.tagged("what", "key-suggest", "unit", Units.QUERY));
    tagValueSuggest = new SemanticFutureReporter(registry,
        base.tagged("what", "tag-value-suggest", "unit", Units.QUERY));
    write =
        new SemanticFutureReporter(registry, base.tagged("what", "write", "unit", Units.WRITE));
    backendWrite = new SemanticFutureReporter(registry,
        base.tagged("what", "backend-write", "unit", Units.WRITE));

    writesDroppedByCacheHit = registry.counter(
        base.tagged("what", "writes-dropped-by-cache-hit", "unit", Units.COUNT));
    writesDroppedByDuplicate = registry.counter(
        base.tagged("what", "writes-dropped-by-duplicate", "unit", Units.COUNT));
}
 
Example 2
Source File: SemanticPredictorMetrics.java    From zoltar with Apache License 2.0 5 votes vote down vote up
static Metrics create(final SemanticMetricRegistry registry, final MetricId metricId) {
  final MetricId predictDurationId = metricId.tagged("what", PREDICT_DURATION.tag());
  final MetricId predictRateId = metricId.tagged("what", PREDICT_RATE.tag());
  final MetricId extractDuration = metricId.tagged("what", FEATURE_EXTRACT_DURATION.tag());
  final MetricId extractRate = metricId.tagged("what", FEATURE_EXTRACT_RATE.tag());

  final Timer predictTimer = registry.timer(predictDurationId);
  final Meter predictMeter = registry.meter(predictRateId);
  final Timer extractTimer = registry.timer(extractDuration);
  final Meter extractMeter = registry.meter(extractRate);

  return new AutoValue_SemanticPredictorMetrics_Metrics(
      predictTimer, predictMeter, extractTimer, extractMeter);
}
 
Example 3
Source File: CustomMetricsExample.java    From zoltar with Apache License 2.0 5 votes vote down vote up
static CustomMetrics create(final SemanticMetricRegistry registry, final MetricId metricId) {
  final MetricId predictCountId = metricId.tagged("what", "negativePredictCount");
  final MetricId extractCountId = metricId.tagged("what", "negativeExtractCount");
  final Counter negativePredictCount = registry.counter(predictCountId);
  final Counter negativeExtractCount = registry.counter(extractCountId);

  return new AutoValue_CustomMetricsExample_CustomMetrics(
      negativePredictCount, negativeExtractCount);
}
 
Example 4
Source File: GarbageCollectorMetricSet.java    From semantic-metrics with Apache License 2.0 5 votes vote down vote up
@Override
public Map<MetricId, Metric> getMetrics() {
    final Map<MetricId, Metric> gauges = new HashMap<MetricId, Metric>();
    final MetricId base = MetricId.build();

    for (final GarbageCollectorMXBean m : garbageCollectors) {
        final MetricId gc = base.tagged("gc", m.getName());

        final MetricId collectionCount =
            gc.tagged("what", "jvm-gc-collections", "unit", "collection/s");
        final MetricId collectionTime =
            gc.tagged("what", "jvm-gc-collection-time", "unit", "ms/s");

        gauges.put(collectionCount, new DerivedLongGauge() {
            @Override
            public Long getNext() {
                return m.getCollectionCount();
            }
        });

        gauges.put(collectionTime, new DerivedLongGauge() {
            @Override
            public Long getNext() {
                return m.getCollectionTime();
            }
        });
    }

    return Collections.unmodifiableMap(gauges);
}
 
Example 5
Source File: SemanticQueryReporter.java    From heroic with Apache License 2.0 5 votes vote down vote up
public SemanticQueryReporter(final SemanticMetricRegistry registry) {
    final MetricId base = MetricId.build().tagged("component", COMPONENT);

    query =
        new SemanticFutureReporter(registry, base.tagged("what", "query", "unit", Units.QUERY));
    smallQueryLatency = registry.histogram(
        base.tagged("what", "small-query-latency", "unit", Units.MILLISECOND));
    queryReadRate =
        registry.histogram(base.tagged("what", "query-read-rate", "unit", Units.COUNT));

    rpcError = registry.counter(base.tagged("what", "cluster-rpc-error", "unit", Units.COUNT));
    rpcCancellation =
        registry.counter(base.tagged("what", "cluster-rpc-cancellation", "unit", Units.COUNT));
}
 
Example 6
Source File: SemanticMetadataBackendReporter.java    From heroic with Apache License 2.0 5 votes vote down vote up
public SemanticMetadataBackendReporter(SemanticMetricRegistry registry) {
    final MetricId base = MetricId.build().tagged("component", COMPONENT);

    findTags = new SemanticFutureReporter(registry,
        base.tagged("what", "find-tags", "unit", Units.QUERY));
    findSeries = new SemanticFutureReporter(registry,
        base.tagged("what", "find-series", "unit", Units.QUERY));
    findSeriesIds = new SemanticFutureReporter(registry,
        base.tagged("what", "find-series-ids", "unit", Units.QUERY));
    countSeries = new SemanticFutureReporter(registry,
        base.tagged("what", "count-series", "unit", Units.QUERY));
    deleteSeries = new SemanticFutureReporter(registry,
        base.tagged("what", "delete-series", "unit", Units.QUERY));
    findKeys = new SemanticFutureReporter(registry,
        base.tagged("what", "find-keys", "unit", Units.QUERY));
    write = new SemanticFutureReporter(registry,
        base.tagged("what", "write", "unit", Units.WRITE));
    backendWrite = new SemanticFutureReporter(registry,
        base.tagged("what", "backend-write", "unit", Units.WRITE));

    entries = registry.counter(base.tagged("what", "entries", "unit", Units.COUNT));

    writesDroppedByCacheHit = registry.counter(
        base.tagged("what", "writes-dropped-by-cache-hit", "unit", Units.COUNT));
    writesDroppedByDuplicate = registry.counter(
        base.tagged("what", "writes-dropped-by-duplicate", "unit", Units.COUNT));

    // only relevant to es backend.
    failedShards = registry.counter(
        base.tagged("what", "failed-es-shards", "unit", Units.COUNT));
}
 
Example 7
Source File: SemanticMetricBackendReporter.java    From heroic with Apache License 2.0 5 votes vote down vote up
public SemanticMetricBackendReporter(SemanticMetricRegistry registry) {
    final MetricId base = MetricId.build().tagged("component", COMPONENT);

    this.write =
        new SemanticFutureReporter(registry, base.tagged("what", "write", "unit", Units.WRITE));
    this.fetch =
        new SemanticFutureReporter(registry, base.tagged("what", "fetch", "unit", Units.QUERY));
    this.deleteKey = new SemanticFutureReporter(registry,
        base.tagged("what", "delete-key", "unit", Units.DELETE));
    this.countKey = new SemanticFutureReporter(registry,
        base.tagged("what", "count-key", "unit", Units.QUERY));
    this.fetchRow = new SemanticFutureReporter(registry,
        base.tagged("what", "fetch-row", "unit", Units.QUERY));

    this.findSeries = new SemanticFutureReporter(registry,
        base.tagged("what", "find-series", "unit", Units.QUERY));
    this.queryMetrics = new SemanticFutureReporter(registry,
        base.tagged("what", "query-metrics", "unit", Units.QUERY));

    sampleSizeLive = registry.counter(
        base.tagged("what", "sample-size-live", "unit", Units.SAMPLE));
    sampleSizeAccumulated = registry.counter(
        base.tagged("what", "sample-size-accumulated", "unit", Units.SAMPLE));

    querySamplesRead = registry.histogram(
        base.tagged("what", "query-metrics-samples-read", "unit", Units.COUNT));
    queryRowsAccessed = registry.histogram(
        base.tagged("what", "query-metrics-rows-accessed", "unit", Units.COUNT));
    queryMaxLiveSamples = registry.histogram(
        base.tagged("what", "query-metrics-max-live-samples", "unit", Units.COUNT));
    queryReadRate = registry.histogram(
        base.tagged("what", "query-metrics-read-rate", "unit", Units.COUNT));
    queryRowMsBetweenSamples = registry.histogram(
        base.tagged("what", "query-metrics-row-metric-distance", "unit", Units.MILLISECOND));
    queryRowDensity = registry.histogram(
        base.tagged("what", "query-metrics-row-density", "unit", Units.COUNT));
}
 
Example 8
Source File: GuavaCacheTest.java    From semantic-metrics with Apache License 2.0 4 votes vote down vote up
@Override
public MetricId load(MetricId id, String endpoint) {
    callCount.incrementAndGet();
    return id.tagged("endpoint", endpoint);
}