Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Simplify experience in discovering how much time left before Idempotency record expiration #4818

Closed
2 tasks done
heitorlessa opened this issue Jul 25, 2024 · 4 comments · Fixed by #5082
Closed
2 tasks done
Labels
feature-request feature request good first issue Good for newcomers help wanted Could use a second pair of eyes/hands idempotency Idempotency utility v3 Features that will be included in Powertools v3.

Comments

@heitorlessa
Copy link
Contributor

Use case

Provide a method to return a datetime object to make it easier to manipulate for customers building APIs, webhooks, and observable systems.

Docs

As of now, this is what we are expecting customers to do which is error prone for the non-initiated.

...

    # expiry_timestamp could be None so include if set
    expiry_timestamp = idempotent_data.expiry_timestamp
    if expiry_timestamp:
        expiry_time = datetime.datetime.fromtimestamp(int(expiry_timestamp))
        response["x-idempotent-expiration"] = expiry_time.isoformat()

    # Must return the response here
    return response

Solution/User Experience

    # this solution is not correct for edge cases, mostly for illustration
    def get_expiration_datetime(self) -> datetime | None:
        if self.expiry_timestamp:
            return datetime.datetime.fromtimestamp(int(self.expiry_timestamp))
        return None

Alternative solutions

Customers use the `expiry_timestamp` which they need to convert and manipulate from scratch.

https://docs.powertools.aws.dev/lambda/python/latest/utilities/idempotency/#manipulating-the-idempotent-response

Acknowledgment

@heitorlessa
Copy link
Contributor Author

cc @dreamorosi @hjgraca @jeromevdl so it's on everyone's radar for a good UX and think a name+logic that works for everyone

@dreamorosi dreamorosi removed the triage Pending triage from maintainers label Aug 12, 2024
@dreamorosi dreamorosi moved this from Triage to Backlog in Powertools for AWS Lambda (Python) Aug 12, 2024
@dreamorosi dreamorosi added good first issue Good for newcomers help wanted Could use a second pair of eyes/hands labels Aug 12, 2024
@leandrodamascena leandrodamascena moved this from Backlog to Working on it in Powertools for AWS Lambda (Python) Aug 27, 2024
@leandrodamascena leandrodamascena added the v3 Features that will be included in Powertools v3. label Aug 27, 2024
@github-actions github-actions bot added the pending-release Fix or implementation already in dev waiting to be released label Aug 27, 2024
@leandrodamascena
Copy link
Contributor

Closed as complete.

@github-project-automation github-project-automation bot moved this from Working on it to Coming soon in Powertools for AWS Lambda (Python) Aug 27, 2024
Copy link
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.

Copy link
Contributor

This is now released under 3.0.0 version!

@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request feature request good first issue Good for newcomers help wanted Could use a second pair of eyes/hands idempotency Idempotency utility v3 Features that will be included in Powertools v3.
Projects
Status: Coming soon
3 participants