Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Adding missing dimension for 2 new stats (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
khanuzair committed Mar 24, 2020
1 parent f17f3e4 commit ba68fb0
Showing 1 changed file with 12 additions and 24 deletions.
36 changes: 12 additions & 24 deletions core/src/main/java/com/nextdoor/bender/handler/BaseHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
import java.io.IOException;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
Expand Down Expand Up @@ -446,25 +442,17 @@ private void writeStats(long evtCount,
/*
* Add some stats about this invocation
*/
Stat eventCount = new Stat("event.count", evtCount, Stat.MetricType.count);
Stat spoutLag = new Stat("spout.lag.ms", (System.currentTimeMillis() - oldestArrivalTime),
Stat.MetricType.gauge);
Stat sourceLag = new Stat("source.lag.ms", (System.currentTimeMillis() - oldestOccurrenceTime),
Stat.MetricType.gauge);
Stat eventByteSize = new Stat("event.byte_size", totalEventBytes);
Stat serializedBytes = new Stat("serializer.serialized_bytes", totalSerializedBytes);

eventCount.addTag("source", source);
spoutLag.addTag("source", source);
sourceLag.addTag("source", source);
runtime.addTag("source", source);

this.monitor.addInvocationStat(eventCount);
this.monitor.addInvocationStat(spoutLag);
this.monitor.addInvocationStat(sourceLag);
this.monitor.addInvocationStat(runtime);
this.monitor.addInvocationStat(eventByteSize);
this.monitor.addInvocationStat(serializedBytes);
List<Stat> stats = Arrays.asList(
new Stat("event.count", evtCount, Stat.MetricType.count),
new Stat("spout.lag.ms", (System.currentTimeMillis() - oldestArrivalTime), Stat.MetricType.gauge),
new Stat("source.lag.ms", (System.currentTimeMillis() - oldestOccurrenceTime), Stat.MetricType.gauge),
runtime,
new Stat("event.byte_size", totalEventBytes),
new Stat("serializer.serialized_bytes", totalSerializedBytes)
);

stats.forEach(s -> s.addTag("source", source));
stats.forEach(s -> this.monitor.addInvocationStat(s));

/*
* Report stats
Expand Down

0 comments on commit ba68fb0

Please sign in to comment.