You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was reviewing the documentation on sampling and testing out the example code. While running the example code I noticed that my sampling was not properly working. I eventually was able to get sampling to work by using sampling_rate instead of sample_rate when creating my logger. Additionally, in the source code sampling_rate is used and not sample_rate.
from aws_lambda_powertools import Logger
from aws_lambda_powertools.utilities.typing import LambdaContext
# Sample 10% of debug logs e.g. 0.1
logger = Logger(service="payment", sample_rate=0.1)
def lambda_handler(event: dict, context: LambdaContext):
logger.debug("Verifying whether order_id is present")
logger.info("Collecting payment")
logger.refresh_sample_rate_calculation()
return "hello world"
Is this related to an existing documentation section?
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
Hi @trevmt, thanks so much for opening this issue! You nailed it, our example is broken and using a wrong field name. Do you want to submit a PR to fix this? I'd love to have your contribution here. If you can't, no worries, I can fix it by end of this week.
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 reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Activity
boring-cyborg commentedon Aug 6, 2025
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
leandrodamascena commentedon Aug 6, 2025
Hi @trevmt, thanks so much for opening this issue! You nailed it, our example is broken and using a wrong field name. Do you want to submit a PR to fix this? I'd love to have your contribution here. If you can't, no worries, I can fix it by end of this week.
trevmt commentedon Aug 7, 2025
Submitted a PR
powertools-for-aws-oss-automation commentedon Aug 7, 2025
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 reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.