Skip to content

Commit

Permalink
Format PrometheusMetricsCollector
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcardell committed Jan 11, 2023
1 parent 724e6b3 commit db5e38f
Showing 1 changed file with 18 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,64 +38,42 @@ public PrometheusMetricsCollector(final CollectorRegistry registry) {
}

public PrometheusMetricsCollector(final CollectorRegistry registry, final String prefix) {
this.connections = Gauge.build()
.name(prefix + "_connections")
.help("Current connections")
.create();
this.connections = Gauge.build().name(prefix + "_connections").help("Current connections").create();
registry.register(this.connections);

this.channels = Gauge.build()
.name(prefix + "_channels")
.help("Current channels")
.create();
this.channels = Gauge.build().name(prefix + "_channels").help("Current channels").create();
registry.register(this.channels);

this.publishedMessages = Counter.build()
.name(prefix + "_published_messages")
.help("Count of published messages")
.create();
this.publishedMessages = Counter.build().name(prefix + "_published_messages")
.help("Count of published messages").create();
registry.register(this.publishedMessages);

this.failedToPublishMessages = Counter.build()
.name(prefix + "_failed_to_publish_messages")
.help("Count of failed to publish messages")
.create();
this.failedToPublishMessages = Counter.build().name(prefix + "_failed_to_publish_messages")
.help("Count of failed to publish messages").create();
registry.register(failedToPublishMessages);

this.ackedPublishedMessages = Counter.build()
.name(prefix + "_acked_published_messages")
.help("Count of acknowledged publish messages")
.create();
this.ackedPublishedMessages = Counter.build().name(prefix + "_acked_published_messages")
.help("Count of acknowledged publish messages").create();
registry.register(ackedPublishedMessages);

this.nackedPublishedMessages = Counter.build()
.name(prefix + "_nacked_published_messages")
.help("Count of not acknowledged publish messages")
.create();
this.nackedPublishedMessages = Counter.build().name(prefix + "_nacked_published_messages")
.help("Count of not acknowledged publish messages").create();
registry.register(nackedPublishedMessages);

this.unroutedPublishedMessages = Counter.build()
.name(prefix + "_unrouted_published_messages")
.help("Count of unrouted publish messages")
.create();
this.unroutedPublishedMessages = Counter.build().name(prefix + "_unrouted_published_messages")
.help("Count of unrouted publish messages").create();
registry.register(unroutedPublishedMessages);

this.consumedMessages = Counter.build()
.name(prefix + "_consumed_messages")
.help("Count of consumed messages")
.create();
this.consumedMessages = Counter.build().name(prefix + "_consumed_messages").help("Count of consumed messages")
.create();
registry.register(consumedMessages);

this.acknowledgedMessages = Counter.build()
.name(prefix + "_acknowledged_messages")
.help("Count of acknowledged consumed messages")
.create();
this.acknowledgedMessages = Counter.build().name(prefix + "_acknowledged_messages")
.help("Count of acknowledged consumed messages").create();
registry.register(acknowledgedMessages);

this.rejectedMessages = Counter.build()
.name(prefix + "_rejected_messages")
.help("Count of rejected consumed messages")
.create();
this.rejectedMessages = Counter.build().name(prefix + "_rejected_messages")
.help("Count of rejected consumed messages").create();
registry.register(rejectedMessages);

}
Expand Down

0 comments on commit db5e38f

Please sign in to comment.