0.0.1 • Published 2 years ago
@idpartner/tracing v0.0.1
@idpartner/tracing
This library provides tools for thread-safe tracing.
Table of Contents
Installation
yarn add @idpartner/tracingAPI
tracingStorage
getData(key: string): any
key: The key for the value to retrieve from the async local storage.- Description: Obtains data from the async local storage using a specified key.
setData(key: string, value: any): void
key: The key for the value to set in the async local storage.value: The value to set.- Description: Sets data in the async local storage using a specified key and value.
tracingMiddlewares
retrieveAndSetTracingData(req, res, next): void
req: The request object.res: The response object (not used).next: The next middleware function.- Description: Retrieves the
x-verification-idandx-fapi-interaction-idfrom the request (session, headers, or query) and stores them in the async local storage.
logIncomingRequestWithTracingData(req, res, next): void
req: The request object.res: The response object.next: The next middleware function.- Description: Logs the incoming request along with any available tracing data using Morgan.
tracingRequestInterceptor
addTracingDataToRequestHeaders(config: object): object
config: The Axios request config object.- Description: Adds an Axios interceptor to inject
x-verification-idandx-fapi-interaction-idheaders into outgoing requests.
tracingUrl
addTracingData(url: string): string
url: The URL to which tracing data will be added.- Description: Adds
x-verification-idandx-fapi-interaction-idas query parameters to the provided URL.
0.0.1
2 years ago