@aws-lambda-powertools/tracer
Advanced tools
Comparing version
@@ -47,3 +47,4 @@ import { EnvironmentVariablesService as CommonEnvironmentVariablesService } from '@aws-lambda-powertools/commons'; | ||
} | ||
export { EnvironmentVariablesService }; | ||
declare const environmentVariablesService: EnvironmentVariablesService; | ||
export { EnvironmentVariablesService, environmentVariablesService }; | ||
//# sourceMappingURL=EnvironmentVariablesService.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EnvironmentVariablesService = void 0; | ||
exports.environmentVariablesService = exports.EnvironmentVariablesService = void 0; | ||
const commons_1 = require("@aws-lambda-powertools/commons"); | ||
@@ -63,1 +63,3 @@ class EnvironmentVariablesService extends commons_1.EnvironmentVariablesService { | ||
exports.EnvironmentVariablesService = EnvironmentVariablesService; | ||
const environmentVariablesService = new EnvironmentVariablesService(); | ||
exports.environmentVariablesService = environmentVariablesService; |
@@ -13,2 +13,3 @@ "use strict"; | ||
const commons_1 = require("@aws-lambda-powertools/commons"); | ||
const EnvironmentVariablesService_js_1 = require("../config/EnvironmentVariablesService.js"); | ||
const utilities_js_1 = require("./utilities.js"); | ||
@@ -88,2 +89,5 @@ /** | ||
subsegment.addAttribute('namespace', 'remote'); | ||
// addHeader is not part of the type definition but it's available https://github.com/nodejs/undici/blob/main/docs/docs/api/DiagnosticsChannel.md#undicirequestcreate | ||
// @ts-expect-error | ||
request.addHeader('X-Amzn-Trace-Id', `Root=${EnvironmentVariablesService_js_1.environmentVariablesService.getXrayTraceId()};Parent=${subsegment.id};Sampled=${subsegment.notTraced ? '0' : '1'}`); | ||
subsegment.http = { | ||
@@ -90,0 +94,0 @@ request: { |
@@ -511,7 +511,2 @@ import { Utility } from '@aws-lambda-powertools/commons'; | ||
/** | ||
* Set and initialize `envVarsService`. | ||
* Used internally during initialization. | ||
*/ | ||
private setEnvVarsService; | ||
/** | ||
* Method that reconciles the configuration passed with the environment variables. | ||
@@ -518,0 +513,0 @@ * Used internally during initialization. |
@@ -762,9 +762,2 @@ "use strict"; | ||
/** | ||
* Set and initialize `envVarsService`. | ||
* Used internally during initialization. | ||
*/ | ||
setEnvVarsService() { | ||
this.envVarsService = new EnvironmentVariablesService_js_1.EnvironmentVariablesService(); | ||
} | ||
/** | ||
* Method that reconciles the configuration passed with the environment variables. | ||
@@ -777,3 +770,3 @@ * Used internally during initialization. | ||
const { enabled, serviceName, captureHTTPsRequests, customConfigService } = options; | ||
this.setEnvVarsService(); | ||
this.envVarsService = EnvironmentVariablesService_js_1.environmentVariablesService; | ||
this.setCustomConfigService(customConfigService); | ||
@@ -780,0 +773,0 @@ this.setTracingEnabled(enabled); |
@@ -47,3 +47,4 @@ import { EnvironmentVariablesService as CommonEnvironmentVariablesService } from '@aws-lambda-powertools/commons'; | ||
} | ||
export { EnvironmentVariablesService }; | ||
declare const environmentVariablesService: EnvironmentVariablesService; | ||
export { EnvironmentVariablesService, environmentVariablesService }; | ||
//# sourceMappingURL=EnvironmentVariablesService.d.ts.map |
@@ -59,2 +59,3 @@ import { EnvironmentVariablesService as CommonEnvironmentVariablesService } from '@aws-lambda-powertools/commons'; | ||
} | ||
export { EnvironmentVariablesService }; | ||
const environmentVariablesService = new EnvironmentVariablesService(); | ||
export { EnvironmentVariablesService, environmentVariablesService }; |
@@ -7,2 +7,3 @@ import xraySdk from 'aws-xray-sdk-core'; | ||
import { addUserAgentMiddleware } from '@aws-lambda-powertools/commons'; | ||
import { environmentVariablesService } from '../config/EnvironmentVariablesService.js'; | ||
import { findHeaderAndDecode, getRequestURL, isHttpSubsegment, } from './utilities.js'; | ||
@@ -82,2 +83,5 @@ /** | ||
subsegment.addAttribute('namespace', 'remote'); | ||
// addHeader is not part of the type definition but it's available https://github.com/nodejs/undici/blob/main/docs/docs/api/DiagnosticsChannel.md#undicirequestcreate | ||
// @ts-expect-error | ||
request.addHeader('X-Amzn-Trace-Id', `Root=${environmentVariablesService.getXrayTraceId()};Parent=${subsegment.id};Sampled=${subsegment.notTraced ? '0' : '1'}`); | ||
subsegment.http = { | ||
@@ -84,0 +88,0 @@ request: { |
@@ -511,7 +511,2 @@ import { Utility } from '@aws-lambda-powertools/commons'; | ||
/** | ||
* Set and initialize `envVarsService`. | ||
* Used internally during initialization. | ||
*/ | ||
private setEnvVarsService; | ||
/** | ||
* Method that reconciles the configuration passed with the environment variables. | ||
@@ -518,0 +513,0 @@ * Used internally during initialization. |
@@ -13,3 +13,3 @@ /** | ||
import xraySdk from 'aws-xray-sdk-core'; | ||
import { EnvironmentVariablesService } from './config/EnvironmentVariablesService.js'; | ||
import { environmentVariablesService, } from './config/EnvironmentVariablesService.js'; | ||
import { ProviderService } from './provider/ProviderService.js'; | ||
@@ -757,9 +757,2 @@ const { Subsegment: XraySubsegment } = xraySdk; | ||
/** | ||
* Set and initialize `envVarsService`. | ||
* Used internally during initialization. | ||
*/ | ||
setEnvVarsService() { | ||
this.envVarsService = new EnvironmentVariablesService(); | ||
} | ||
/** | ||
* Method that reconciles the configuration passed with the environment variables. | ||
@@ -772,3 +765,3 @@ * Used internally during initialization. | ||
const { enabled, serviceName, captureHTTPsRequests, customConfigService } = options; | ||
this.setEnvVarsService(); | ||
this.envVarsService = environmentVariablesService; | ||
this.setCustomConfigService(customConfigService); | ||
@@ -775,0 +768,0 @@ this.setTracingEnabled(enabled); |
{ | ||
"name": "@aws-lambda-powertools/tracer", | ||
"version": "2.12.0", | ||
"version": "2.13.0", | ||
"description": "The tracer package for the Powertools for AWS Lambda (TypeScript) library", | ||
@@ -28,3 +28,3 @@ "author": { | ||
"dependencies": { | ||
"@aws-lambda-powertools/commons": "^2.12.0", | ||
"@aws-lambda-powertools/commons": "^2.13.0", | ||
"aws-xray-sdk-core": "^3.10.2" | ||
@@ -31,0 +31,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
195227
0.45%4293
-0.26%