Skip to content

Bug: Tracer escape hatch does not expose full AWSXRay api #2943

@RaphaelManke

Description

@RaphaelManke

Expected Behavior

Based on the documentation

Escape hatch mechanism

You can use tracer.provider attribute to access all methods provided by the AWS X-Ray SDK.

But this is not true. It only re-exposes a subset of methods.

see https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/packages/tracer/src/provider/ProviderService.ts

In my case I wanted to overwrite the setStreamingThreshold() method which is not implemented.

Current Behavior

An error is thrown because the method is not implemented

Code snippet

const tracer = new Tracer({ serviceName: "serverlessAirline" });
tracer.provider.setStreamingThreshold(1);

produces an error.

{ 
  "errorType":"TypeError",
  "errorMessage":"tracer.provider.setStreamingThreshold is not a function"
 //  ....
}

### Steps to Reproduce

see code snippet

### Possible Solution

1. update docs 
2. implement/proxy all methods

### Powertools for AWS Lambda (TypeScript) version

latest

### AWS Lambda function runtime

20.x

### Packaging format used

Lambda Layers

### Execution logs

```Shell
{
"errorType":"TypeError","errorMessage":"tracer.provider.setStreamingThreshold is not a function","trace":["TypeError: tracer.provider.setStreamingThreshold is not a function","    at Object.<anonymous> (/var/task/index.js:6:17)","    at Module._compile (node:internal/modules/cjs/loader:1358:14)","    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)","    at Module.load (node:internal/modules/cjs/loader:1208:32)","    at Module._load (node:internal/modules/cjs/loader:1024:12)","    at Module.require (node:internal/modules/cjs/loader:1233:19)","    at require (node:internal/modules/helpers:179:18)","    at _tryRequireFile (file:///var/runtime/index.mjs:1002:37)","    at _tryRequire (file:///var/runtime/index.mjs:1052:25)","    at _loadUserApp (file:///var/runtime/index.mjs:1081:22)"]}

Metadata

Metadata

Assignees

Labels

completedThis item is complete and has been merged/shippeddocumentationImprovements or additions to documentationnot-a-bugNew and existing bug reports incorrectly submitted as bugtracerThis item relates to the Tracer Utility

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions