Last active
July 13, 2023 13:58
-
-
Save lmonkiewicz/558bd31ae0d82a62ef50d9068b35f7b1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
metricOperations.increment(KafkaMetrics.METRIC_NAME, | |
Tags.of(KafkaTags.topic(topic), | |
KafkaTags.exception(exception.getClass().getName()), | |
KafkaTags.processor(context.applicationId()) | |
)); |
This file contains hidden or 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
@RequiredArgsConstructor | |
@Component | |
public class MetricOperations { | |
private final MeterRegistry meterRegistry; | |
public Counter counter(String metricName, Tags tags) { | |
return meterRegistry.counter(metricName, tags); | |
} | |
public void increment(String metricName, Tags tags) { | |
counter(metricName, tags).increment(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment