Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@opentelemetry/instrumentation-aws-sdk

Package Overview
Dependencies
Maintainers
3
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/instrumentation-aws-sdk - npm Package Compare versions

Comparing version 0.34.3 to 0.35.0

15

build/src/index.js
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
/*

@@ -28,4 +19,4 @@ * Copyright The OpenTelemetry Authors

*/
__exportStar(require("./aws-sdk"), exports);
__exportStar(require("./types"), exports);
tslib_1.__exportStar(require("./aws-sdk"), exports);
tslib_1.__exportStar(require("./types"), exports);
//# sourceMappingURL=index.js.map

1

build/src/services/dynamodb.d.ts

@@ -5,2 +5,3 @@ import { Span, Tracer } from '@opentelemetry/api';

export declare class DynamodbServiceExtension implements ServiceExtension {
toArray<T>(values: T | T[]): T[];
requestPreSpanHook(normalizedRequest: NormalizedRequest): RequestMetadata;

@@ -7,0 +8,0 @@ responseHook(response: NormalizedResponse, span: Span, tracer: Tracer, config: AwsSdkInstrumentationConfig): void;

@@ -22,4 +22,7 @@ "use strict";

class DynamodbServiceExtension {
toArray(values) {
return Array.isArray(values) ? values : [values];
}
requestPreSpanHook(normalizedRequest) {
var _a;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
const spanKind = api_1.SpanKind.CLIENT;

@@ -35,5 +38,100 @@ let spanName;

};
if (operation === 'BatchGetItem') {
// normalizedRequest.commandInput.RequestItems) is undefined when no table names are returned
// keys in this object are the table names
if ((_b = normalizedRequest.commandInput) === null || _b === void 0 ? void 0 : _b.TableName) {
// Necessary for commands with only 1 table name (example: CreateTable). Attribute is TableName not keys of RequestItems
// single table name returned for operations like CreateTable
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_TABLE_NAMES] = [
normalizedRequest.commandInput.TableName,
];
}
else if ((_c = normalizedRequest.commandInput) === null || _c === void 0 ? void 0 : _c.RequestItems) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_TABLE_NAMES] = Object.keys(normalizedRequest.commandInput.RequestItems);
}
if (operation === 'CreateTable' || operation === 'UpdateTable') {
// only check for ProvisionedThroughput since ReadCapacityUnits and WriteCapacity units are required attributes
if ((_d = normalizedRequest.commandInput) === null || _d === void 0 ? void 0 : _d.ProvisionedThroughput) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_PROVISIONED_READ_CAPACITY] =
normalizedRequest.commandInput.ProvisionedThroughput.ReadCapacityUnits;
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY] =
normalizedRequest.commandInput.ProvisionedThroughput.WriteCapacityUnits;
}
}
if (operation === 'GetItem' ||
operation === 'Scan' ||
operation === 'Query') {
if ((_e = normalizedRequest.commandInput) === null || _e === void 0 ? void 0 : _e.ConsistentRead) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_CONSISTENT_READ] =
normalizedRequest.commandInput.ConsistentRead;
}
}
if (operation === 'Query' || operation === 'Scan') {
if ((_f = normalizedRequest.commandInput) === null || _f === void 0 ? void 0 : _f.ProjectionExpression) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_PROJECTION] =
normalizedRequest.commandInput.ProjectionExpression;
}
}
if (operation === 'CreateTable') {
if ((_g = normalizedRequest.commandInput) === null || _g === void 0 ? void 0 : _g.GlobalSecondaryIndexes) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES] = this.toArray(normalizedRequest.commandInput.GlobalSecondaryIndexes).map((x) => JSON.stringify(x));
}
if ((_h = normalizedRequest.commandInput) === null || _h === void 0 ? void 0 : _h.LocalSecondaryIndexes) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES] = this.toArray(normalizedRequest.commandInput.LocalSecondaryIndexes).map((x) => JSON.stringify(x));
}
}
if (operation === 'ListTables' ||
operation === 'Query' ||
operation === 'Scan') {
if ((_j = normalizedRequest.commandInput) === null || _j === void 0 ? void 0 : _j.Limit) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_LIMIT] =
normalizedRequest.commandInput.Limit;
}
}
if (operation === 'ListTables') {
if ((_k = normalizedRequest.commandInput) === null || _k === void 0 ? void 0 : _k.ExclusiveStartTableName) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_EXCLUSIVE_START_TABLE] =
normalizedRequest.commandInput.ExclusiveStartTableName;
}
}
if (operation === 'Query') {
if ((_l = normalizedRequest.commandInput) === null || _l === void 0 ? void 0 : _l.ScanIndexForward) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_SCAN_FORWARD] =
normalizedRequest.commandInput.ScanIndexForward;
}
if ((_m = normalizedRequest.commandInput) === null || _m === void 0 ? void 0 : _m.IndexName) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_INDEX_NAME] =
normalizedRequest.commandInput.IndexName;
}
if ((_o = normalizedRequest.commandInput) === null || _o === void 0 ? void 0 : _o.Select) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_SELECT] =
normalizedRequest.commandInput.Select;
}
}
if (operation === 'Scan') {
if ((_p = normalizedRequest.commandInput) === null || _p === void 0 ? void 0 : _p.Segment) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_SEGMENT] =
(_q = normalizedRequest.commandInput) === null || _q === void 0 ? void 0 : _q.Segment;
}
if ((_r = normalizedRequest.commandInput) === null || _r === void 0 ? void 0 : _r.TotalSegments) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_TOTAL_SEGMENTS] =
(_s = normalizedRequest.commandInput) === null || _s === void 0 ? void 0 : _s.TotalSegments;
}
if ((_t = normalizedRequest.commandInput) === null || _t === void 0 ? void 0 : _t.IndexName) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_INDEX_NAME] =
normalizedRequest.commandInput.IndexName;
}
if ((_u = normalizedRequest.commandInput) === null || _u === void 0 ? void 0 : _u.Select) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_SELECT] =
normalizedRequest.commandInput.Select;
}
}
if (operation === 'UpdateTable') {
if ((_v = normalizedRequest.commandInput) === null || _v === void 0 ? void 0 : _v.AttributeDefinitions) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS] =
this.toArray(normalizedRequest.commandInput.AttributeDefinitions).map((x) => JSON.stringify(x));
}
if ((_w = normalizedRequest.commandInput) === null || _w === void 0 ? void 0 : _w.GlobalSecondaryIndexUpdates) {
spanAttributes[semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES] = this.toArray(normalizedRequest.commandInput.GlobalSecondaryIndexUpdates).map((x) => JSON.stringify(x));
}
}
return {

@@ -47,3 +145,3 @@ isIncoming,

responseHook(response, span, tracer, config) {
var _a;
var _a, _b, _c, _d, _e, _f, _g, _h;
const operation = response.request.commandName;

@@ -55,2 +153,14 @@ if (operation === 'BatchGetItem') {

}
if ((_b = response.data) === null || _b === void 0 ? void 0 : _b.ItemCollectionMetrics) {
span.setAttribute(semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_ITEM_COLLECTION_METRICS, this.toArray(response.data.ItemCollectionMetrics).map((x) => JSON.stringify(x)));
}
if ((_c = response.data) === null || _c === void 0 ? void 0 : _c.TableNames) {
span.setAttribute(semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_TABLE_COUNT, (_d = response.data) === null || _d === void 0 ? void 0 : _d.TableNames.length);
}
if ((_e = response.data) === null || _e === void 0 ? void 0 : _e.Count) {
span.setAttribute(semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_COUNT, (_f = response.data) === null || _f === void 0 ? void 0 : _f.Count);
}
if ((_g = response.data) === null || _g === void 0 ? void 0 : _g.ScannedCount) {
span.setAttribute(semantic_conventions_1.SemanticAttributes.AWS_DYNAMODB_SCANNED_COUNT, (_h = response.data) === null || _h === void 0 ? void 0 : _h.ScannedCount);
}
}

@@ -57,0 +167,0 @@ }

@@ -1,2 +0,2 @@

export declare const VERSION = "0.34.3";
export declare const VERSION = "0.35.0";
//# sourceMappingURL=version.d.ts.map

@@ -20,3 +20,3 @@ "use strict";

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '0.34.3';
exports.VERSION = '0.35.0';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/instrumentation-aws-sdk",
"version": "0.34.3",
"version": "0.35.0",
"description": "OpenTelemetry automatic instrumentation for the `aws-sdk` package",

@@ -50,5 +50,6 @@ "keywords": [

"@opentelemetry/core": "^1.8.0",
"@opentelemetry/instrumentation": "^0.40.0",
"@opentelemetry/propagation-utils": "^0.29.5",
"@opentelemetry/semantic-conventions": "^1.0.0"
"@opentelemetry/instrumentation": "^0.41.0",
"@opentelemetry/propagation-utils": "^0.30.0",
"@opentelemetry/semantic-conventions": "^1.0.0",
"tslib": "^2.3.1"
},

@@ -63,3 +64,3 @@ "devDependencies": {

"@opentelemetry/api": "^1.3.0",
"@opentelemetry/contrib-test-utils": "^0.33.4",
"@opentelemetry/contrib-test-utils": "^0.34.0",
"@opentelemetry/sdk-trace-base": "^1.8.0",

@@ -84,3 +85,3 @@ "@types/mocha": "8.2.3",

},
"gitHead": "efdfc727a49090accee7fea8ff93011b6b84c1e4"
"gitHead": "f81f8a76a8f0af2101c62dbc73cde442f875d833"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc