@Override public void bindTo(MeterRegistry registry) { for (Map.Entry<String, KafkaMessageChannelBinder.TopicInformation> topicInfo : this.binder.getTopicsInUse() .entrySet()) { if (!topicInfo.getValue().isConsumerTopic()) { continue; } String topic = topicInfo.getKey(); String group = topicInfo.getValue().getConsumerGroup(); Gauge.builder(METRIC_NAME, this, (o) -> computeUnconsumedMessages(topic, group)) .tag("group", group) .tag("topic", topic) .description("Unconsumed messages for a particular group and topic") .register(registry); } }
@Override public void bindTo(MeterRegistry registry) { for (Map.Entry<String, KafkaMessageChannelBinder.TopicInformation> topicInfo : this.binder.getTopicsInUse() .entrySet()) { if (!topicInfo.getValue().isConsumerTopic()) { continue; } String topic = topicInfo.getKey(); String group = topicInfo.getValue().getConsumerGroup(); Gauge.builder(METRIC_NAME, this, (o) -> computeUnconsumedMessages(topic, group)) .tag("group", group) .tag("topic", topic) .description("Unconsumed messages for a particular group and topic") .register(registry); } }
Gauge.builder("zipkin_collector.message_spans", messageSpans, AtomicInteger::get) .description("count of spans per message") .tag("transport", transport) .register(registryInstance); this.messageBytes = new AtomicInteger(0); Gauge.builder("zipkin_collector.message_bytes", messageBytes, AtomicInteger::get) .description("size of a message containing serialized spans") .tag("transport", transport) .baseUnit("bytes") .register(registryInstance);
private void nearCacheMetrics(MeterRegistry registry) { if (isNearCacheEnabled()) { Gauge.builder("cache.near.requests", cache, cache -> cache.clientStatistics().getNearCacheHits()) .tags(getTagsWithCacheName()).tag("result", "hit") .description("The number of hits (reads) of near cache entries owned by this client") .register(registry); Gauge.builder("cache.near.requests", cache, cache -> cache.clientStatistics().getNearCacheMisses()) .tags(getTagsWithCacheName()).tag("result", "miss") .description("The number of hits (reads) of near cache entries owned by this client") .register(registry); Gauge.builder("cache.near.invalidations", cache, cache -> cache.clientStatistics().getNearCacheInvalidations()) .tags(getTagsWithCacheName()) .description("The number of invalidations of near cache entries owned by this client") .register(registry); Gauge.builder("cache.near.size", cache, cache -> cache.clientStatistics().getNearCacheSize()) .tags(getTagsWithCacheName()) .description("The size of the near cache owned by this client") .register(registry); } }
@Override protected void bindImplementationSpecificMetrics(MeterRegistry registry) { if (cache == null) return; Gauge.builder("cache.reset", cache, cache -> cache.clientStatistics().getTimeSinceReset()) .tags(getTagsWithCacheName()).tag("ownership", "backup") .description("Time elapsed in seconds since the last statistics reset") .register(registry); averages(registry); nearCacheMetrics(registry); }
@Override public GaugeBuilder tag(String key, String value) { this.builder.tag(key, value); return this; }
@Override public GaugeBuilder tag(String key, String value) { this.builder.tag(key, value); return this; }