-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(metrics): introduce MetricsUtils.withMetricsLogger utility #1000
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
powertools-metrics/src/main/java/software/amazon/lambda/powertools/metrics/MetricsUtils.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved
closes #999
Issue #, if available: #999
Description of changes:
introduce new
MetricsUtils.withMetricsLogger
utility 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.