Skip to content

Commit c126cc5

Browse files
Addressing Andrea's feedback
1 parent b503137 commit c126cc5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/core/logger.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -627,16 +627,16 @@ Notice in the CloudWatch Logs output how `payment_id` appears as expected when l
627627

628628
### Sampling debug logs
629629

630-
Use sampling when you want to dynamically change your log level to **DEBUG** based on a **percentage of the Lambda function executions**.
630+
Use sampling when you want to dynamically change your log level to **DEBUG** based on a **percentage of the Lambda function invocations**.
631631

632632
You can use values ranging from `0.0` to `1` (100%) when setting `POWERTOOLS_LOGGER_SAMPLE_RATE` env var, or `sampling_rate` parameter in Logger.
633633

634634
???+ tip "Tip: When is this useful?"
635-
Log sampling allows you to capture debug information for a fraction of your requests, helping you diagnose rare or intermittent issues without drowning your logs in unnecessary details.
635+
Log sampling allows you to capture debug information for a fraction of your requests, helping you diagnose rare or intermittent issues without increasing the overall verbosity of your logs.
636636

637637
Example: Imagine an e-commerce checkout process where you want to understand rare payment gateway errors. With 10% sampling, you'll log detailed information for a small subset of transactions, making troubleshooting easier without generating excessive logs.
638638

639-
Sampling decision happens at every execution when using `@logger.inject_lambda_context` decorator or `refresh_sample_rate_calculation` method. If you don't use any of both, you may end up with undesired sampling behavior.
639+
The sampling decision happens automatically with each invocation when using `@logger.inject_lambda_context` decorator. When not using the decorator, you're in charge of refreshing it via `refresh_sample_rate_calculation` method. Skipping both may lead to unexpected sampling results.
640640

641641
=== "sampling_debug_logs_with_decorator.py"
642642

0 commit comments

Comments
 (0)