Skip to content

Feature request: support metrics with unit "None" #4834

Closed
@ethantkoenig

Description

@ethantkoenig

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) Tenets
    Should this be considered in other Powertools for AWS Lambda languages? i.e. Java, TypeScript, and .NET

Activity

boring-cyborg

boring-cyborg commented on Jul 28, 2024

@boring-cyborg

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

sthulb commented on Jul 30, 2024

@sthulb
Contributor

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 as MetricUnit.None

I was wrong, Python does indeed care about None even as a property

removed
triagePending triage from maintainers
on Aug 2, 2024
moved this from Triage to Working on it in Powertools for AWS Lambda (Python)on Aug 2, 2024
github-actions

github-actions commented on Aug 7, 2024

@github-actions
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

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

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

    Participants

    @sthulb@ethantkoenig

    Issue actions

      Feature request: support metrics with unit "None" · Issue #4834 · aws-powertools/powertools-lambda-python