Skip to content

Commit a2f5076

Browse files
committed
docs: bring new feature upfront when returning sensitive info
1 parent adfee49 commit a2f5076

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

docs/content/core/tracer.mdx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ Tracer is an opinionated thin wrapper for [AWS X-Ray Python SDK](https://github.
1717
* Support tracing async methods, generators, and context managers
1818
* Auto patch supported modules, or a tuple of explicit modules supported by AWS X-Ray
1919

20+
<Note type="warning">
21+
<strong>Returning sensitive information from your Lambda handler or functions, where Tracer is used?</strong>
22+
<br/><br/>
23+
You can disable capturing their responses as tracing metadata with <strong><code>capture_response=False</code></strong> parameter for both capture_lambda_handler and capture_method decorators.
24+
</Note><br/>
25+
2026
## Initialization
2127

2228
Your AWS Lambda function must have permission to send traces to AWS X-Ray - Here is an example using AWS Serverless Application Model (SAM)
@@ -63,6 +69,10 @@ def handler(event, context):
6369
charge_id = event.get('charge_id')
6470
payment = collect_payment(charge_id)
6571
...
72+
73+
@tracer.capture_lambda_handler(capture_response=False) # highlight-line
74+
def handler(event, context):
75+
return "sensitive_information"
6676
```
6777

6878
### Annotations
@@ -108,7 +118,10 @@ def collect_payment(charge_id):
108118
ret = requests.post(PAYMENT_ENDPOINT) # logic
109119
tracer.put_annotation("PAYMENT_STATUS", "SUCCESS") # custom annotation
110120
return ret
111-
...
121+
122+
@tracer.capture_method(capture_response=False) # highlight-line
123+
def sensitive_information_to_be_processed():
124+
return "sensitive_information"
112125
```
113126

114127
## Asynchronous and generator functions

0 commit comments

Comments
 (0)