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

Bug: Metrics class is unable to access namespace and service properties #2909

Closed
leandrodamascena opened this issue Aug 2, 2023 · 3 comments · Fixed by #2910
Closed

Bug: Metrics class is unable to access namespace and service properties #2909

leandrodamascena opened this issue Aug 2, 2023 · 3 comments · Fixed by #2910
Assignees
Labels
bug Something isn't working

Comments

@leandrodamascena
Copy link
Contributor

Expected Behaviour

Before merging PR #2194, we could directly access the service and namespace properties of the Metrics class. With refactoring this is no longer possible.

Current Behaviour

is failing to flush the metrics because there is no Namespace.

Code snippet

from aws_lambda_powertools import Metrics
from aws_lambda_powertools.metrics import MetricUnit

my_metrics = Metrics()

@my_metrics.log_metrics
def lambda_handler(event, context):
    namespace, service = "powertools", "airline"

    my_metrics.namespace = namespace
    my_metrics.service = service

    my_metrics.add_metric(name="booking",unit=MetricUnit.Count, value=2)
    
    return "success"

Possible Solution

No response

Steps to Reproduce

Create a Lambda with the code snippet example.

Powertools for AWS Lambda (Python) version

latest

AWS Lambda function runtime

3.11

Packaging format used

PyPi

Debugging logs

No response

@leandrodamascena leandrodamascena added bug Something isn't working triage Pending triage from maintainers labels Aug 2, 2023
@leandrodamascena leandrodamascena linked a pull request Aug 2, 2023 that will close this issue
7 tasks
@heitorlessa heitorlessa moved this from Triage to Working on it in Powertools for AWS Lambda (Python) Aug 2, 2023
@heitorlessa heitorlessa removed the triage Pending triage from maintainers label Aug 2, 2023
@heitorlessa
Copy link
Contributor

looking at the PR

@github-project-automation github-project-automation bot moved this from Working on it to Coming soon in Powertools for AWS Lambda (Python) Aug 2, 2023
@heitorlessa heitorlessa moved this from Coming soon to Shipped in Powertools for AWS Lambda (Python) Aug 2, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2023

⚠️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.

@heitorlessa heitorlessa moved this from Shipped to Coming soon in Powertools for AWS Lambda (Python) Aug 2, 2023
@github-actions github-actions bot added the pending-release Fix or implementation already in dev waiting to be released label Aug 2, 2023
@leandrodamascena leandrodamascena self-assigned this Aug 15, 2023
@github-actions
Copy link
Contributor

This is now released under 2.23.0 version!

@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Aug 18, 2023
@leandrodamascena leandrodamascena moved this from Coming soon to Shipped in Powertools for AWS Lambda (Python) Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Shipped
2 participants