-
Notifications
You must be signed in to change notification settings - Fork 455
Description
Use case
This is a quite related to #3917
I've been using the https://github.com/aws-powertools/powertools-lambda-typescript/
I'm using "@aws-lambda-powertools/metrics": "^2.8.0" on the JS side, which is up to date at time of writing. I wanted to log from python to the same metric. That JS library does not by default add an 'environment' dimension (or at least if it does, I've removed it in the way I'm operating with it)
Whereas it seems in this library in Python there is always an 'environment' dimension even when explicitly calling clear_default_dimensions().
API_METRICS_SERVICE = Metrics(service="cci-call-panel-api")
API_METRICS_SERVICE.clear_default_dimensions() # remove default "environment" dimension
API_METRICS_SERVICE.set_default_dimensions(
aws_region=os.environ.get("REGION", "ap-northeast-1"),
stage=os.environ.get("NODE_ENV", "unknown")
)
I should note I'm using a little old version of the library (aws-lambda-powertools==2.30.2
) as it's not trivial for me to upgrade (would need to update a lot of repos using that layer) - so please feel free to close this issue if it's an issue already resolved.
Solution/User Experience
- It would be good to document that
environment
is always added as a default dimension, and make behaviour consistent with the JS library. - clear_default_dimensions() should clear all dimensions
Alternative solutions
I can maybe edit my Javascript repo to add this dimension...but the problem is that I think cloudwatch metrics are fairly immutable, so I would lose historical data of that metric if I made a new metric with this dimension.
Acknowledgment
- This feature request meets Powertools for AWS Lambda (Python) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Java, TypeScript, and .NET
Metadata
Metadata
Assignees
Labels
Type
Projects
Status