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
Copy file name to clipboardExpand all lines: docs/core/tracer.md
+68
Original file line number
Diff line number
Diff line change
@@ -412,6 +412,40 @@ Use **`POWERTOOLS_TRACER_CAPTURE_RESPONSE=false`** environment variable to instr
412
412
2. You might manipulate **streaming objects that can be read only once**; this prevents subsequent calls from being empty
413
413
3. You might return **more than 64K** of data _e.g., `message too long` error_
414
414
415
+
### Disabling response capture for targeted methods and handlers
416
+
417
+
Use the `captureResponse: false` option in both `tracer.captureLambdaHandler()` and `tracer.captureMethod()` decorators to instruct Tracer **not** to serialize function responses as metadata.
418
+
419
+
=== "method.ts"
420
+
421
+
```typescript hl_lines="5"
422
+
import { Tracer } from '@aws-lambda-powertools/tracer';
423
+
424
+
const tracer = new Tracer({ serviceName: 'serverlessAirline' });
425
+
class MyThing {
426
+
@tracer.captureMethod({ captureResponse: false })
427
+
myMethod(): string {
428
+
/* ... */
429
+
return 'foo bar';
430
+
}
431
+
}
432
+
```
433
+
434
+
=== "handler.ts"
435
+
436
+
```typescript hl_lines="6"
437
+
import { Tracer } from '@aws-lambda-powertools/tracer';
438
+
import { LambdaInterface } from '@aws-lambda-powertools/commons';
439
+
440
+
const tracer = new Tracer({ serviceName: 'serverlessAirline' });
Use **`POWERTOOLS_TRACER_CAPTURE_ERROR=false`** environment variable to instruct Tracer **not** to serialize exceptions as metadata.
@@ -420,6 +454,40 @@ Use **`POWERTOOLS_TRACER_CAPTURE_ERROR=false`** environment variable to instruct
420
454
421
455
1. You might **return sensitive** information from exceptions, stack traces you might not control
422
456
457
+
### Disabling exception capture for targeted methods and handlers
458
+
459
+
Use the `captureError: false` option in both `tracer.captureLambdaHandler()` and `tracer.captureMethod()` decorators to instruct Tracer **not** to serialize exceptions as metadata.
460
+
461
+
=== "method.ts"
462
+
463
+
```typescript hl_lines="5"
464
+
import { Tracer } from '@aws-lambda-powertools/tracer';
465
+
466
+
const tracer = new Tracer({ serviceName: 'serverlessAirline' });
467
+
class MyThing {
468
+
@tracer.captureMethod({ captureError: false })
469
+
myMethod(): string {
470
+
/* ... */
471
+
return 'foo bar';
472
+
}
473
+
}
474
+
```
475
+
476
+
=== "handler.ts"
477
+
478
+
```typescript hl_lines="6"
479
+
import { Tracer } from '@aws-lambda-powertools/tracer';
480
+
import { LambdaInterface } from '@aws-lambda-powertools/commons';
481
+
482
+
const tracer = new Tracer({ serviceName: 'serverlessAirline' });
You can use `tracer.provider` attribute to access all methods provided by the [AWS X-Ray SDK](https://docs.aws.amazon.com/xray-sdk-for-nodejs/latest/reference/AWSXRay.html).
0 commit comments