Skip to content

Commit e873720

Browse files
committed
docs(tracer): clarify escape hatch mechanism
1 parent 5a4571e commit e873720

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

Diff for: docs/core/tracer.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ Tracer exposes a `getRootXrayTraceId()` method that allows you to retrieve the [
378378

379379
### Escape hatch mechanism
380380

381-
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).
381+
You can use `tracer.provider` attribute to access some of the methods provided by the [AWS X-Ray SDK](https://docs.aws.amazon.com/xray-sdk-for-nodejs/latest/reference/AWSXRay.html).
382382

383383
This is useful when you need a feature available in X-Ray that is not available in the Tracer utility, for example [SQL queries tracing](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-nodejs-sqlclients.html), or [a custom logger](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-nodejs-configuration.html#xray-sdk-nodejs-configuration-logging).
384384

@@ -388,6 +388,10 @@ This is useful when you need a feature available in X-Ray that is not available
388388
--8<-- "examples/snippets/tracer/escapeHatch.ts"
389389
```
390390

391+
We only expose [a subset of the methods available](https://docs.powertools.aws.dev/lambda/typescript/latest/api/classes/_aws_lambda_powertools_tracer.provider_ProviderService.ProviderService.html) in the AWS X-Ray SDK for Node.js based on the most common use cases relevant for AWS Lambda and their compatibility with the Tracer utility.
392+
393+
If you need to access a method that is not available you can import it directly from the AWS X-Ray SDK for Node.js. Compatibility with the Tracer utility is not guaranteed.
394+
391395
## Testing your code
392396

393397
Tracer is disabled by default when not running in the AWS Lambda environment - This means no code changes or environment variables to be set.

Diff for: packages/tracer/src/provider/ProviderService.ts

+11
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ import {
3232
isHttpSubsegment,
3333
} from './utilities.js';
3434

35+
/**
36+
* The ProviderService class is a wrapper around the AWS X-Ray SDK for Node.js.
37+
*
38+
* The service provides exposes a selection of methods to interact with the SDK directly,
39+
* these methods were chosen to be the most useful in the context of a Lambda function and
40+
* have been tested to work with Powertools for AWS Lambda.
41+
*
42+
* If you want to use one of the other methods that are not exposed by this class,
43+
* you can import the methods directly from the `aws-xray-sdk-core` package, and for most cases,
44+
* they should work as expected. However, support for these methods is not guaranteed.
45+
*/
3546
class ProviderService implements ProviderServiceInterface {
3647
/**
3748
* @deprecated

Diff for: packages/tracer/typedoc.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{
2-
"extends": ["../../typedoc.base.json"],
2+
"extends": [
3+
"../../typedoc.base.json"
4+
],
35
"entryPoints": [
46
"./src/index.ts",
57
"./src/types/index.ts",
6-
"./src/middleware/middy.ts"
8+
"./src/middleware/middy.ts",
9+
"./src/provider/ProviderService.ts",
710
],
811
"readme": "README.md"
9-
}
12+
}

0 commit comments

Comments
 (0)