Skip to content

Commit

Permalink
Merge pull request #908 from rax-maas/add-indexed-tokens-count
Browse files Browse the repository at this point in the history
add counter for indexed tokens
  • Loading branch information
iWebi committed Aug 13, 2022
2 parents 3d338d8 + af41c52 commit ce7a3e2
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.rackspacecloud.blueflood.io;

import com.codahale.metrics.Histogram;
import com.codahale.metrics.Meter;
import com.codahale.metrics.Timer;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -28,6 +29,7 @@ public class ElasticTokensIO implements TokenDiscoveryIO {
public static final String ES_DOCUMENT_TYPE = "tokens";

protected final Histogram batchHistogram = Metrics.histogram(getClass(), "Batch Sizes");
protected final Meter tokenCount = Metrics.meter(getClass(), "Tokens Written");
protected final Timer writeTimer = Metrics.timer(getClass(), "Write Duration");

protected final Timer esMetricNamesQueryTimer = Metrics.timer(getClass(), "ES Metric Names Query Duration");
Expand All @@ -53,6 +55,7 @@ public void insertDiscovery(Token token) throws IOException {
@Override
public void insertDiscovery(List<Token> tokens) throws IOException {
batchHistogram.update(tokens.size());
tokenCount.mark(tokens.size());
if (tokens.size() == 0) return;

Timer.Context ctx = writeTimer.time();
Expand Down

0 comments on commit ce7a3e2

Please sign in to comment.