@aws-lambda-powertools/tracer
Advanced tools
Comparing version
import { Namespace } from 'cls-hooked'; | ||
import type { ProviderServiceInterface, ContextMissingStrategy } from '../types/ProviderServiceInterface.js'; | ||
import { Segment, Subsegment } from 'aws-xray-sdk-core'; | ||
import type { Segment, Subsegment } from 'aws-xray-sdk-core'; | ||
declare class ProviderService implements ProviderServiceInterface { | ||
@@ -5,0 +5,0 @@ captureAWS<T>(awssdk: T): T; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ProviderService = void 0; | ||
const aws_xray_sdk_core_1 = require("aws-xray-sdk-core"); | ||
const aws_xray_sdk_core_1 = __importDefault(require("aws-xray-sdk-core")); | ||
const { captureAWS, captureAWSClient, captureAWSv3Client, captureAsyncFunc, captureFunc, captureHTTPsGlobal, getNamespace, getSegment, setSegment, Segment: XraySegment, setContextMissingStrategy, setDaemonAddress, setLogger, } = aws_xray_sdk_core_1.default; | ||
const commons_1 = require("@aws-lambda-powertools/commons"); | ||
class ProviderService { | ||
captureAWS(awssdk) { | ||
return (0, aws_xray_sdk_core_1.captureAWS)(awssdk); | ||
return captureAWS(awssdk); | ||
} | ||
captureAWSClient(service) { | ||
return (0, aws_xray_sdk_core_1.captureAWSClient)(service); | ||
return captureAWSClient(service); | ||
} | ||
@@ -17,21 +21,21 @@ captureAWSv3Client(service) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return (0, aws_xray_sdk_core_1.captureAWSv3Client)(service); | ||
return captureAWSv3Client(service); | ||
} | ||
captureAsyncFunc(name, fcn, _parent) { | ||
return (0, aws_xray_sdk_core_1.captureAsyncFunc)(name, fcn); | ||
return captureAsyncFunc(name, fcn); | ||
} | ||
captureFunc(name, fcn, _parent) { | ||
return (0, aws_xray_sdk_core_1.captureFunc)(name, fcn); | ||
return captureFunc(name, fcn); | ||
} | ||
captureHTTPsGlobal() { | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
(0, aws_xray_sdk_core_1.captureHTTPsGlobal)(require('http')); | ||
captureHTTPsGlobal(require('http')); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
(0, aws_xray_sdk_core_1.captureHTTPsGlobal)(require('https')); | ||
captureHTTPsGlobal(require('https')); | ||
} | ||
getNamespace() { | ||
return (0, aws_xray_sdk_core_1.getNamespace)(); | ||
return getNamespace(); | ||
} | ||
getSegment() { | ||
return (0, aws_xray_sdk_core_1.getSegment)(); | ||
return getSegment(); | ||
} | ||
@@ -44,3 +48,3 @@ putAnnotation(key, value) { | ||
} | ||
if (segment instanceof aws_xray_sdk_core_1.Segment) { | ||
if (segment instanceof XraySegment) { | ||
console.warn('You cannot annotate the main segment in a Lambda execution environment'); | ||
@@ -57,3 +61,3 @@ return; | ||
} | ||
if (segment instanceof aws_xray_sdk_core_1.Segment) { | ||
if (segment instanceof XraySegment) { | ||
console.warn('You cannot add metadata to the main segment in a Lambda execution environment'); | ||
@@ -65,14 +69,14 @@ return; | ||
setContextMissingStrategy(strategy) { | ||
(0, aws_xray_sdk_core_1.setContextMissingStrategy)(strategy); | ||
setContextMissingStrategy(strategy); | ||
} | ||
setDaemonAddress(address) { | ||
(0, aws_xray_sdk_core_1.setDaemonAddress)(address); | ||
setDaemonAddress(address); | ||
} | ||
setLogger(logObj) { | ||
(0, aws_xray_sdk_core_1.setLogger)(logObj); | ||
setLogger(logObj); | ||
} | ||
setSegment(segment) { | ||
(0, aws_xray_sdk_core_1.setSegment)(segment); | ||
setSegment(segment); | ||
} | ||
} | ||
exports.ProviderService = ProviderService; |
@@ -5,3 +5,3 @@ import { Utility } from '@aws-lambda-powertools/commons'; | ||
import type { ProviderServiceInterface } from './types/ProviderServiceInterface.js'; | ||
import { type Segment, Subsegment } from 'aws-xray-sdk-core'; | ||
import type { Segment, Subsegment } from 'aws-xray-sdk-core'; | ||
/** | ||
@@ -8,0 +8,0 @@ * ## Intro |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -7,3 +10,4 @@ exports.Tracer = void 0; | ||
const ProviderService_js_1 = require("./provider/ProviderService.js"); | ||
const aws_xray_sdk_core_1 = require("aws-xray-sdk-core"); | ||
const aws_xray_sdk_core_1 = __importDefault(require("aws-xray-sdk-core")); | ||
const { Subsegment: XraySubsegment } = aws_xray_sdk_core_1.default; | ||
/** | ||
@@ -513,3 +517,3 @@ * ## Intro | ||
if (!this.isTracingEnabled()) { | ||
return new aws_xray_sdk_core_1.Subsegment('## Dummy segment'); | ||
return new XraySubsegment('## Dummy segment'); | ||
} | ||
@@ -516,0 +520,0 @@ const segment = this.provider.getSegment(); |
import { Namespace } from 'cls-hooked'; | ||
import type { ProviderServiceInterface, ContextMissingStrategy } from '../types/ProviderServiceInterface.js'; | ||
import { Segment, Subsegment } from 'aws-xray-sdk-core'; | ||
import type { Segment, Subsegment } from 'aws-xray-sdk-core'; | ||
declare class ProviderService implements ProviderServiceInterface { | ||
@@ -5,0 +5,0 @@ captureAWS<T>(awssdk: T): T; |
@@ -1,2 +0,3 @@ | ||
import { captureAWS, captureAWSClient, captureAWSv3Client, captureAsyncFunc, captureFunc, captureHTTPsGlobal, getNamespace, getSegment, setSegment, Segment, setContextMissingStrategy, setDaemonAddress, setLogger, } from 'aws-xray-sdk-core'; | ||
import xraySdk from 'aws-xray-sdk-core'; | ||
const { captureAWS, captureAWSClient, captureAWSv3Client, captureAsyncFunc, captureFunc, captureHTTPsGlobal, getNamespace, getSegment, setSegment, Segment: XraySegment, setContextMissingStrategy, setDaemonAddress, setLogger, } = xraySdk; | ||
import { addUserAgentMiddleware } from '@aws-lambda-powertools/commons'; | ||
@@ -40,3 +41,3 @@ class ProviderService { | ||
} | ||
if (segment instanceof Segment) { | ||
if (segment instanceof XraySegment) { | ||
console.warn('You cannot annotate the main segment in a Lambda execution environment'); | ||
@@ -53,3 +54,3 @@ return; | ||
} | ||
if (segment instanceof Segment) { | ||
if (segment instanceof XraySegment) { | ||
console.warn('You cannot add metadata to the main segment in a Lambda execution environment'); | ||
@@ -56,0 +57,0 @@ return; |
@@ -5,3 +5,3 @@ import { Utility } from '@aws-lambda-powertools/commons'; | ||
import type { ProviderServiceInterface } from './types/ProviderServiceInterface.js'; | ||
import { type Segment, Subsegment } from 'aws-xray-sdk-core'; | ||
import type { Segment, Subsegment } from 'aws-xray-sdk-core'; | ||
/** | ||
@@ -8,0 +8,0 @@ * ## Intro |
import { Utility } from '@aws-lambda-powertools/commons'; | ||
import { EnvironmentVariablesService } from './config/EnvironmentVariablesService.js'; | ||
import { ProviderService } from './provider/ProviderService.js'; | ||
import { Subsegment } from 'aws-xray-sdk-core'; | ||
import xraySdk from 'aws-xray-sdk-core'; | ||
const { Subsegment: XraySubsegment } = xraySdk; | ||
/** | ||
@@ -509,3 +510,3 @@ * ## Intro | ||
if (!this.isTracingEnabled()) { | ||
return new Subsegment('## Dummy segment'); | ||
return new XraySubsegment('## Dummy segment'); | ||
} | ||
@@ -512,0 +513,0 @@ const segment = this.provider.getSegment(); |
{ | ||
"name": "@aws-lambda-powertools/tracer", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "The tracer package for the Powertools for AWS Lambda (TypeScript) library", | ||
@@ -28,3 +28,3 @@ "author": { | ||
"dependencies": { | ||
"@aws-lambda-powertools/commons": "^2.0.1", | ||
"@aws-lambda-powertools/commons": "^2.0.2", | ||
"aws-xray-sdk-core": "^3.5.3" | ||
@@ -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
170427
0.22%3719
0.27%