Skip to content

Commit efeedd2

Browse files
authored
docs(tracer): new ignore_endpoint feature (#931)
1 parent d304345 commit efeedd2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Diff for: docs/core/tracer.md

+26
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,32 @@ def handler(event, context):
221221
raise ValueError("some sensitive info in the stack trace...")
222222
```
223223

224+
### Ignoring certain HTTP endpoints
225+
226+
You might have endpoints you don't want requests to be traced, perhaps due to the volume of calls or sensitive URLs.
227+
228+
You can use `ignore_endpoint` method with the hostname and/or URLs you'd like it to be ignored - globs (`*`) are allowed.
229+
230+
```python title="Ignoring certain HTTP endpoints from being traced"
231+
from aws_lambda_powertools import Tracer
232+
233+
tracer = Tracer()
234+
# ignore all calls to `ec2.amazon.com`
235+
tracer.ignore_endpoint(hostname="ec2.amazon.com")
236+
# ignore calls to `*.sensitive.com/password` and `*.sensitive.com/credit-card`
237+
tracer.ignore_endpoint(hostname="*.sensitive.com", urls=["/password", "/credit-card"])
238+
239+
240+
def ec2_api_calls():
241+
return "suppress_api_responses"
242+
243+
@tracer.capture_lambda_handler
244+
def handler(event, context):
245+
for x in long_list:
246+
ec2_api_calls()
247+
```
248+
249+
224250
### Tracing aiohttp requests
225251

226252
???+ info

0 commit comments

Comments
 (0)