-
Notifications
You must be signed in to change notification settings - Fork 98
Description
Use case
As a user of Powertools v1, and considering moving to v2, I found the withMetricsLogger
now replaced with flushSingleMetric
. I see 2 issues
- The current overloads, requires setting
namespace
, even though previously I've been relying on the namespace being whatever was already set (e.g. via powertools environment variables). I find this a degradation in UX if - which I think is a typical use case - I wanna use the same namespace - I also had use cases for
withMetricsLogger
where I add multiple metrics, which share an overriden dimensionset. Now this needs to be replaced with multiple calls toflushSingleMetric
I think the refactor/abstractions led to some degradations when it comes to withMetricsLogger
. Moreover, LambdaMetricsAspect
do set a few other properties/metadata that no longer seem to be available in instances emitted by flushSingleMetric
such as trace and function id.
Solution/User Experience
For 1, one solution would be to add flushSingleMetric
overloads that don't take a namespace
, and to update EmfMetricsLogger
to treat the namespace
parameter as nullable and a potential override to its this.namespace
For 2, maybe Metrics
should get a new method flushMetrics
with takes a Consumer<Metrics>
, then one is more free about using default dimensions/namespace, or overriding them and adding multiple metrics.
Alternative solutions
N/A
Acknowledgment
- This feature request meets Powertools for AWS Lambda (Java) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Python, TypeScript, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.
Metadata
Metadata
Labels
Type
Projects
Status