AWS powertools metrics #787
Replies: 1 comment
-
Hey! Apologies for the slow reply - just back from leave! I think either option would work - not sure what the preferred approach would be, probably environment variables for the lowest code approach but you'd need to remember to set it for all your lambdas. If you opt for the interceptor it might be neatest to not use the metrics interceptor, and instead to write your own with a similar implementation - the If useful I'd happily accept a PR which adjusts the metrics interceptor to follow the same pattern as cors/try-catch/tracer where there's a "build" method to initialise the interceptor, which could then accept namespace and service as parameters and be used instead of the default if users prefer. Cheers, |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm trying to use AWS powertools metrics which are generated by pdk. How can I set namespace and service for all metrics? Generated
MetricsInterceptor.ts
class creates Metrics using 0-arg constructor. Should I add my interceptor which initializes Metrics to my liking and sets them inrequest.interceptorContext.metrics
? Or maybe there is a better way? Is setting the env variables (POWERTOOLS_METRICS_NAMESPACE/POWERTOOLS_SERVICE_NAME) the preferred solution?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions