Java Code Examples for com.spotify.metrics.core.SemanticMetricRegistry#counter()

The following examples show how to use com.spotify.metrics.core.SemanticMetricRegistry#counter() . 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: SemanticFutureReporter.java    From heroic with Apache License 2.0 6 votes vote down vote up
public SemanticFutureReporter(SemanticMetricRegistry registry, MetricId id) {
    final String what = id.getTags().get("what");

    if (what == null) {
        throw new IllegalArgumentException("id does not provide the tag 'what'");
    }

    this.timer = new SemanticHeroicTimer(registry.timer(id.tagged("what", what + "-latency")));
    this.failed =
        registry.counter(id.tagged("what", what + "-failed", "unit", Units.COUNT));
    this.resolved =
        registry.counter(id.tagged("what", what + "-resolved", "unit", Units.COUNT));
    this.cancelled =
        registry.counter(id.tagged("what", what + "-cancelled", "unit", Units.COUNT));
    this.pending =
        registry.counter(id.tagged("what", what + "-pending", "unit", Units.COUNT));
}
 
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: FastForwardReporterTest.java    From semantic-metrics with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    registry = new SemanticMetricRegistry();
    fastForward = mock(FastForward.class);
    executorService = new DeterministicScheduler();
    reporter = FastForwardReporter
        .forRegistry(registry)
        .schedule(TimeUnit.MILLISECONDS, REPORTING_PERIOD)
        .fastForward(fastForward)
        .executorService(executorService)
        .build();

    registry.counter(MetricId.build("hi"));
}
 
Example 5
Source File: SemanticMemcachedReporter.java    From heroic with Apache License 2.0 5 votes vote down vote up
public SemanticMemcachedReporter(SemanticMetricRegistry registry, final String consumerType) {
  final MetricId id = MetricId.build().tagged("component", COMPONENT, "consumer", consumerType);

  memcachedHit = registry.counter(id.tagged("what", "memcached-performance", "result",
      "hit"));
  memcachedMiss = registry.counter(id.tagged("what", "memcached-performance", "result",
      "miss"));
  memcachedTimeout = registry.counter(id.tagged("what", "memcached-performance", "result",
      "timeout"));

  memcachedError = registry.counter(id.tagged("what", "memcached-performance", "result",
      "error"));


}
 
Example 6
Source File: SemanticConsumerReporter.java    From heroic with Apache License 2.0 5 votes vote down vote up
public SemanticConsumerReporter(SemanticMetricRegistry registry, String id) {
    this.base = MetricId.build().tagged("component", COMPONENT, "id", id);

    messageIn = registry.counter(base.tagged("what", "message-in", "unit", Units.COUNT));
    metricsIn = registry.counter(base.tagged("what", "metrics-in", "unit", Units.COUNT));
    messageError = registry.counter(base.tagged("what", "message-error", "unit", Units.COUNT));
    messageRetry = registry.counter(base.tagged("what", "message-retry", "unit", Units.COUNT));
    consumerSchemaError =
        registry.counter(base.tagged("what", "consumer-schema-error", "unit", Units.COUNT));
    consumerThreadsLiveRatio = new SemanticRatioGauge();
    registry.register(base.tagged("what", "consumer-threads-live-ratio", "unit", Units.RATIO),
        consumerThreadsLiveRatio);

    messageSize = registry.histogram(base.tagged("what", "message-size", "unit", Units.BYTE));
    messageDrift =
        registry.histogram(base.tagged("what", "message-drift", "unit", Units.MILLISECOND));

    consumer = new SemanticFutureReporter(registry,
        base.tagged("what", "consumer", "unit", Units.WRITE));

    consumerCommitWholeOperationTimer =
        registry.register(base.tagged("what", "consumer-commit-latency"),
            new SemanticHeroicTimerGauge());
    consumerCommitPhase1Timer =
        registry.register(base.tagged("what", "consumer-commit-phase1-latency"),
            new SemanticHeroicTimerGauge());
    consumerCommitPhase2Timer =
        registry.register(base.tagged("what", "consumer-commit-phase2-latency"),
            new SemanticHeroicTimerGauge());
}
 
Example 7
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 8
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 9
Source File: SemanticIngestionManagerReporter.java    From heroic with Apache License 2.0 5 votes vote down vote up
public SemanticIngestionManagerReporter(SemanticMetricRegistry registry) {
    final MetricId id = MetricId.build().tagged("component", COMPONENT);
    this.concurrentWritesCounter =
        registry.counter(id.tagged("what", "concurrent-writes", "unit", Units.WRITE));
    this.droppedByFilter =
        registry.counter(id.tagged("what", "dropped-by-filter", "unit", Units.COUNT));
}
 
Example 10
Source File: SemanticAnalyticsReporter.java    From heroic with Apache License 2.0 5 votes vote down vote up
public SemanticAnalyticsReporter(SemanticMetricRegistry registry) {
    final MetricId id = MetricId.build().tagged("component", COMPONENT);

    this.droppedFetchSeries =
        registry.counter(id.tagged("what", "dropped-fetch-series", "unit", Units.DROP));
    this.failedFetchSeries =
        registry.counter(id.tagged("what", "failed-fetch-series", "unit", Units.FAILURE));
}
 
Example 11
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));
}