UNPKG

@aws-lambda-powertools/tracer

Version:
51 lines 2.46 kB
import type { Segment, Subsegment } from 'aws-xray-sdk-core'; import type { Namespace } from 'cls-hooked'; import type { ContextMissingStrategy, ProviderServiceInterface } from '../types/ProviderService.js'; /** * The ProviderService class is a wrapper around the AWS X-Ray SDK for Node.js. * * The service provides exposes a selection of methods to interact with the SDK directly, * these methods were chosen to be the most useful in the context of a Lambda function and * have been tested to work with Powertools for AWS Lambda. * * If you want to use one of the other methods that are not exposed by this class, * you can import the methods directly from the `aws-xray-sdk-core` package, and for most cases, * they should work as expected. However, support for these methods is not guaranteed. */ declare class ProviderService implements ProviderServiceInterface { /** * @deprecated */ captureAWS<T>(awssdk: T): T; /** * @deprecated */ captureAWSClient<T>(service: T): T; captureAWSv3Client<T>(service: T): T; captureAsyncFunc(name: string, fcn: (subsegment?: Subsegment) => unknown, _parent?: Segment | Subsegment): unknown; captureFunc(name: string, fcn: (subsegment?: Subsegment) => unknown, _parent?: Segment | Subsegment): unknown; captureHTTPsGlobal(): void; getNamespace(): Namespace; getSegment(): Segment | Subsegment | undefined; /** * Instrument `fetch` requests with AWS X-Ray * * The instrumentation is done by subscribing to the `undici` events. When a request is created, * a new subsegment is created with the hostname of the request. * * Then, when the headers are received, the subsegment is updated with the request and response details. * * Finally, when the request is completed, the subsegment is closed. * * @see {@link https://nodejs.org/api/diagnostics_channel.html#diagnostics_channel_channel_publish | Diagnostics Channel - Node.js Documentation} */ instrumentFetch(): void; putAnnotation(key: string, value: string | number | boolean): void; putMetadata(key: string, value: unknown, namespace?: string): void; setContextMissingStrategy(strategy: ContextMissingStrategy): void; setDaemonAddress(address: string): void; setLogger(logObj: unknown): void; setSegment(segment: Segment | Subsegment): void; } export { ProviderService }; //# sourceMappingURL=ProviderService.d.ts.map