Stupidly and blindly fire a bunch of crap into statsd on localhost
This is not the final product by a long shot, just needed to figure out how things would look inside datadog
This commit is contained in:
parent
5fe4d8efaa
commit
ba2fa562ac
|
@ -59,8 +59,6 @@ class KafkaPoller extends Thread {
|
|||
withScalaCollection(f.partitionsMetadata).each { p ->
|
||||
Long offset = latestFromLeader(p.leader.get()?.id, f.topic, p.partitionId)
|
||||
TopicPartition tp = new TopicPartition(f.topic, p.partitionId)
|
||||
print "Consumer for ${f.topic}:${p.partitionId}"
|
||||
println " latest: ${offset}"
|
||||
|
||||
this.consumersMap[tp].each { zk.ConsumerOffset c ->
|
||||
Long delta = offset - c.offset
|
||||
|
|
|
@ -6,6 +6,9 @@ import com.github.lookout.verspaetung.zk.StandardTreeWatcher
|
|||
import java.util.concurrent.ConcurrentHashMap
|
||||
import groovy.transform.TypeChecked
|
||||
|
||||
import com.timgroup.statsd.StatsDClient
|
||||
import com.timgroup.statsd.NonBlockingStatsDClient
|
||||
|
||||
import org.apache.curator.retry.ExponentialBackoffRetry
|
||||
import org.apache.curator.framework.CuratorFrameworkFactory
|
||||
import org.apache.curator.framework.CuratorFramework
|
||||
|
@ -13,6 +16,8 @@ import org.apache.curator.framework.recipes.cache.TreeCache
|
|||
|
||||
//@TypeChecked
|
||||
class Main {
|
||||
private static final StatsDClient statsd = new NonBlockingStatsDClient('verspaetung', 'localhost', 8125)
|
||||
|
||||
static void main(String[] args) {
|
||||
println "Running ${args}"
|
||||
|
||||
|
@ -38,7 +43,7 @@ class Main {
|
|||
cache.listenable.addListener(consumerWatcher)
|
||||
|
||||
poller.onDelta << { String groupName, TopicPartition tp, Long delta ->
|
||||
println "${groupName} ${tp} -- ${delta}"
|
||||
statsd.recordGaugeValue("${tp.topic}.${tp.partition}.${groupName}", delta)
|
||||
}
|
||||
|
||||
poller.start()
|
||||
|
@ -46,7 +51,7 @@ class Main {
|
|||
cache.start()
|
||||
println 'started..'
|
||||
|
||||
Thread.sleep(5 * 1000)
|
||||
while (true) { Thread.sleep(1000) }
|
||||
|
||||
println 'exiting..'
|
||||
poller.die()
|
||||
|
|
Loading…
Reference in New Issue