-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement a processed messages metrics exposed via prometheus
- Loading branch information
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
api/src/main/java/dev/vrba/dubs/metrics/ProcessedMessagesMetric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package dev.vrba.dubs.metrics; | ||
|
||
import io.micrometer.core.instrument.MeterRegistry; | ||
import io.micrometer.core.instrument.Tag; | ||
import io.micrometer.core.instrument.Tags; | ||
import io.micronaut.core.annotation.NonNull; | ||
import jakarta.inject.Singleton; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Singleton | ||
@RequiredArgsConstructor | ||
public class ProcessedMessagesMetric { | ||
|
||
@NonNull | ||
private final MeterRegistry registry; | ||
|
||
public void record( | ||
@NonNull String user, | ||
@NonNull String channel, | ||
@NonNull String guild | ||
) { | ||
registry.counter("discord.messages.processes", | ||
Tags.of( | ||
Tag.of("guild", guild), | ||
Tag.of("channel", channel), | ||
Tag.of("user", user) | ||
) | ||
).increment(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters