Closed
Description
Use case
https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html reports that "None" is a valid unit for CloudWatch metrics, but the MetricUnit
enum does not have a member for this unit.
The lack of such a member means that there is no way to create metrics with unit "None" via Powertools. One cannot pass the string "None"
as the unit
parameter of Metric.add_metric
, due to this code.
Solution/User Experience
Of course, I realize that a MetricUnit
member for "None" cannot be named None
, but can a member with a different name (perhaps named None_
or NoUnit
) please be added to the enum?
Alternative solutions
No response
Acknowledgment
- This feature request meets Powertools for AWS Lambda (Python) TenetsShould this be considered in other Powertools for AWS Lambda languages? i.e. Java, TypeScript, and .NET
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Shipped
Activity
boring-cyborg commentedon Jul 28, 2024
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link
sthulb commentedon Jul 30, 2024
Hi @ethantkoenig
I think we’re able to support this easily by adding a None element to the MetricUnit class/enum. I can’t see this causing any issues since it would always be used asMetricUnit.None
I was wrong, Python does indeed care about
None
even as a propertygithub-actions commentedon Aug 7, 2024
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
5 remaining items