@opentelemetry/instrumentation-aws-sdk
Advanced tools
Comparing version 0.43.0 to 0.43.1
import { AwsSdkInstrumentationConfig } from './types'; | ||
import { InstrumentationBase, InstrumentationModuleDefinition } from '@opentelemetry/instrumentation'; | ||
export declare class AwsInstrumentation extends InstrumentationBase { | ||
export declare class AwsInstrumentation extends InstrumentationBase<AwsSdkInstrumentationConfig> { | ||
static readonly component = "aws-sdk"; | ||
protected _config: AwsSdkInstrumentationConfig; | ||
private servicesExtensions; | ||
constructor(config?: AwsSdkInstrumentationConfig); | ||
setConfig(config?: AwsSdkInstrumentationConfig): void; | ||
protected init(): InstrumentationModuleDefinition[]; | ||
@@ -10,0 +8,0 @@ protected patchV3ConstructStack(moduleExports: any, moduleVersion?: string): any; |
@@ -35,5 +35,2 @@ "use strict"; | ||
} | ||
setConfig(config = {}) { | ||
this._config = Object.assign({}, config); | ||
} | ||
init() { | ||
@@ -122,4 +119,4 @@ const v3MiddlewareStackFileOldVersions = new instrumentation_1.InstrumentationNodeModuleFile('@aws-sdk/middleware-stack/dist/cjs/MiddlewareStack.js', ['>=3.1.0 <3.35.0'], this.patchV3ConstructStack.bind(this), this.unpatchV3ConstructStack.bind(this)); | ||
_callUserPreRequestHook(span, request, moduleVersion) { | ||
var _a; | ||
if ((_a = this._config) === null || _a === void 0 ? void 0 : _a.preRequestHook) { | ||
const { preRequestHook } = this.getConfig(); | ||
if (preRequestHook) { | ||
const requestInfo = { | ||
@@ -129,3 +126,3 @@ moduleVersion, | ||
}; | ||
(0, instrumentation_1.safeExecuteInTheMiddle)(() => this._config.preRequestHook(span, requestInfo), (e) => { | ||
(0, instrumentation_1.safeExecuteInTheMiddle)(() => preRequestHook(span, requestInfo), (e) => { | ||
if (e) | ||
@@ -137,4 +134,3 @@ api_1.diag.error(`${AwsInstrumentation.component} instrumentation: preRequestHook error`, e); | ||
_callUserResponseHook(span, response) { | ||
var _a; | ||
const responseHook = (_a = this._config) === null || _a === void 0 ? void 0 : _a.responseHook; | ||
const { responseHook } = this.getConfig(); | ||
if (!responseHook) | ||
@@ -171,3 +167,3 @@ return; | ||
else { | ||
this.servicesExtensions.responseHook(normalizedResponse, span, self.tracer, self._config); | ||
this.servicesExtensions.responseHook(normalizedResponse, span, self.tracer, self.getConfig()); | ||
} | ||
@@ -225,3 +221,3 @@ span.setAttribute(enums_1.AttributeNames.AWS_REQUEST_ID, requestId); | ||
const normalizedRequest = (0, utils_1.normalizeV3Request)(serviceName, commandName, command.input, undefined); | ||
const requestMetadata = self.servicesExtensions.requestPreSpanHook(normalizedRequest, self._config, self._diag); | ||
const requestMetadata = self.servicesExtensions.requestPreSpanHook(normalizedRequest, self.getConfig(), self._diag); | ||
const span = self._startAwsV3Span(normalizedRequest, requestMetadata); | ||
@@ -266,3 +262,3 @@ const activeContextWithSpan = api_1.trace.setSpan(api_1.context.active(), span); | ||
}; | ||
self.servicesExtensions.responseHook(normalizedResponse, span, self.tracer, self._config); | ||
self.servicesExtensions.responseHook(normalizedResponse, span, self.tracer, self.getConfig()); | ||
self._callUserResponseHook(span, normalizedResponse); | ||
@@ -272,2 +268,3 @@ return response; | ||
.catch(err => { | ||
var _a; | ||
const requestId = err === null || err === void 0 ? void 0 : err.RequestId; | ||
@@ -277,2 +274,6 @@ if (requestId) { | ||
} | ||
const httpStatusCode = (_a = err === null || err === void 0 ? void 0 : err.$metadata) === null || _a === void 0 ? void 0 : _a.httpStatusCode; | ||
if (httpStatusCode) { | ||
span.setAttribute(semantic_conventions_1.SEMATTRS_HTTP_STATUS_CODE, httpStatusCode); | ||
} | ||
const extendedRequestId = err === null || err === void 0 ? void 0 : err.extendedRequestId; | ||
@@ -317,3 +318,3 @@ if (extendedRequestId) { | ||
const normalizedRequest = (0, utils_1.normalizeV2Request)(this); | ||
const requestMetadata = self.servicesExtensions.requestPreSpanHook(normalizedRequest, self._config, self._diag); | ||
const requestMetadata = self.servicesExtensions.requestPreSpanHook(normalizedRequest, self.getConfig(), self._diag); | ||
const span = self._startAwsV2Span(this, requestMetadata, normalizedRequest); | ||
@@ -339,3 +340,3 @@ this[REQUEST_SPAN_KEY] = span; | ||
const normalizedRequest = (0, utils_1.normalizeV2Request)(this); | ||
const requestMetadata = self.servicesExtensions.requestPreSpanHook(normalizedRequest, self._config, self._diag); | ||
const requestMetadata = self.servicesExtensions.requestPreSpanHook(normalizedRequest, self.getConfig(), self._diag); | ||
const span = self._startAwsV2Span(this, requestMetadata, normalizedRequest); | ||
@@ -356,4 +357,3 @@ this[REQUEST_SPAN_KEY] = span; | ||
_callOriginalFunction(originalFunction) { | ||
var _a; | ||
if ((_a = this._config) === null || _a === void 0 ? void 0 : _a.suppressInternalInstrumentation) { | ||
if (this.getConfig().suppressInternalInstrumentation) { | ||
return api_1.context.with((0, core_1.suppressTracing)(api_1.context.active()), originalFunction); | ||
@@ -360,0 +360,0 @@ } |
@@ -1,3 +0,3 @@ | ||
export declare const PACKAGE_VERSION = "0.43.0"; | ||
export declare const PACKAGE_VERSION = "0.43.1"; | ||
export declare const PACKAGE_NAME = "@opentelemetry/instrumentation-aws-sdk"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,4 +20,4 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.PACKAGE_VERSION = '0.43.0'; | ||
exports.PACKAGE_VERSION = '0.43.1'; | ||
exports.PACKAGE_NAME = '@opentelemetry/instrumentation-aws-sdk'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-aws-sdk", | ||
"version": "0.43.0", | ||
"version": "0.43.1", | ||
"description": "OpenTelemetry instrumentation for `aws-sdk` and `@aws-sdk/client-*` clients for various AWS services", | ||
@@ -81,3 +81,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "ad8436d6a4174f2288cb939080cd4e74da94b0d7" | ||
"gitHead": "c1d67f8befb716c57bb5083a9d24f154128963df" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
233714
1616