diff --git a/docs/core/tracer.md b/docs/core/tracer.md index f97e4477acf..363611bbbc0 100644 --- a/docs/core/tracer.md +++ b/docs/core/tracer.md @@ -221,6 +221,32 @@ def handler(event, context): raise ValueError("some sensitive info in the stack trace...") ``` +### Ignoring certain HTTP endpoints + +You might have endpoints you don't want requests to be traced, perhaps due to the volume of calls or sensitive URLs. + +You can use `ignore_endpoint` method with the hostname and/or URLs you'd like it to be ignored - globs (`*`) are allowed. + +```python title="Ignoring certain HTTP endpoints from being traced" +from aws_lambda_powertools import Tracer + +tracer = Tracer() +# ignore all calls to `ec2.amazon.com` +tracer.ignore_endpoint(hostname="ec2.amazon.com") +# ignore calls to `*.sensitive.com/password` and `*.sensitive.com/credit-card` +tracer.ignore_endpoint(hostname="*.sensitive.com", urls=["/password", "/credit-card"]) + + +def ec2_api_calls(): + return "suppress_api_responses" + +@tracer.capture_lambda_handler +def handler(event, context): + for x in long_list: + ec2_api_calls() +``` + + ### Tracing aiohttp requests ???+ info