feat(metrics): introduce MetricsUtils.withMetricsLogger utility#1000
feat(metrics): introduce MetricsUtils.withMetricsLogger utility#1000msailes merged 6 commits intoaws-powertools:masterfrom
Conversation
powertools-metrics/src/main/java/software/amazon/lambda/powertools/metrics/MetricsUtils.java
Show resolved
Hide resolved
scottgerring
left a comment
There was a problem hiding this comment.
Looks good to me @humanzz - I have one question on the changed body of the try / finally inline
|
It looks also good for me. The only concern that I have is about naming. Right now we have two methods: |
The names are also throwing me off a bit tbh as well. I am between
I'm more leaning towards the last one now that I think about it and will make a change. Let me know what you think |
|
Hey @humanzz I think that |
|
@kozub @scottgerring apologies folks. Had to make an additional commit to fix a documentation typo |
closes #999
Issue #, if available: #999
Description of changes:
introduce new
MetricsUtils.withMetricsLoggerutility method to enable higher level of customization to the metrics logger and eliminate the need to know the metric/configuration when calling the method and leave that instead to theConsumer<MetricsLogger>The main use case my team has
MetricsUtils.metricsLogger()i.e. we need a new metrics logger instanceSo, ideally, we create a new instance of a metrics logger, and then rely on to emit those 10 different metrics.
Checklist
Breaking change checklist
RFC issue #:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.