@opentelemetry/instrumentation-aws-sdk 0.39.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/build/src/aws-sdk.types.d.ts +1 -1
- package/build/src/aws-sdk.types.js.map +1 -1
- package/build/src/propwrap.d.ts +1 -1
- package/build/src/propwrap.js +1 -1
- package/build/src/propwrap.js.map +1 -1
- package/build/src/services/sqs.js +8 -5
- package/build/src/services/sqs.js.map +1 -1
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/build/src/version.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -68,8 +68,8 @@ In addition to the above attributes, the instrumentation also collect the follow
|
|
|
68
68
|
| -------------- | ---- | ----------- | ------- |
|
|
69
69
|
| `aws.operation` | string | The method name for the request. | for `SQS.sendMessage(...)` the operation is "sendMessage" |
|
|
70
70
|
| `aws.signature.version` | string | AWS version of authentication signature on the request. | "v4" |
|
|
71
|
-
| `aws.service.api` | string | The
|
|
72
|
-
| `aws.service.identifier` | string | Identifier for the service in the
|
|
71
|
+
| `aws.service.api` | string | The SDK class name for the service | "SQS" |
|
|
72
|
+
| `aws.service.identifier` | string | Identifier for the service in the SDK | "sqs" |
|
|
73
73
|
| `aws.service.name` | string | Abbreviation name for the service | "Amazon SQS" |
|
|
74
74
|
| `aws.request.id` | uuid | Request unique id, as returned from aws on response | "01234567-89ab-cdef-0123-456789abcdef" |
|
|
75
75
|
|
|
@@ -55,7 +55,7 @@ export declare namespace SQS {
|
|
|
55
55
|
};
|
|
56
56
|
export interface Message {
|
|
57
57
|
/**
|
|
58
|
-
* A unique identifier for the message. A
|
|
58
|
+
* A unique identifier for the message. A MessageId is considered unique across all accounts for an extended period of time.
|
|
59
59
|
*/
|
|
60
60
|
MessageId?: string;
|
|
61
61
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aws-sdk.types.js","sourceRoot":"","sources":["../../src/aws-sdk.types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * AWS SDK for JavaScript\n * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * This product includes software developed at\n * Amazon Web Services, Inc. (http://aws.amazon.com/).\n */\n\n/*\n These are slightly modified and simplified versions of the actual SQS types included\n in the official distribution:\n https://github.com/aws/aws-sdk-js/blob/master/clients/sqs.d.ts\n These are brought here to avoid having users install the `aws-sdk` whenever they\n require this instrumentation.\n*/\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface -- Our lint doesn't like it, but we prefer to keep it the way original source code has it\ninterface Blob {}\ntype Binary = Buffer | Uint8Array | Blob | string;\n\n// eslint-disable-next-line @typescript-eslint/no-namespace -- Prefer to contain the types copied over in one location\nexport namespace SNS {\n interface MessageAttributeValue {\n /**\n * Amazon SNS supports the following logical data types: String, String.Array, Number, and Binary. For more information, see Message Attribute Data Types.\n */\n DataType: string;\n /**\n * Strings are Unicode with UTF8 binary encoding. For a list of code values, see ASCII Printable Characters.\n */\n StringValue?: string;\n /**\n * Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images.\n */\n BinaryValue?: Binary;\n }\n\n export type MessageAttributeMap = { [key: string]: MessageAttributeValue };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace -- Prefer to contain the types copied over in one location\nexport namespace SQS {\n type StringList = string[];\n type BinaryList = Binary[];\n interface MessageAttributeValue {\n /**\n * Strings are Unicode with UTF-8 binary encoding. For a list of code values, see ASCII Printable Characters.\n */\n StringValue?: string;\n /**\n * Binary type attributes can store any binary data, such as compressed data, encrypted data, or images.\n */\n BinaryValue?: Binary;\n /**\n * Not implemented. Reserved for future use.\n */\n StringListValues?: StringList;\n /**\n * Not implemented. Reserved for future use.\n */\n BinaryListValues?: BinaryList;\n /**\n * Amazon SQS supports the following logical data types: String, Number, and Binary. For the Number data type, you must use StringValue. You can also append custom labels. For more information, see Amazon SQS Message Attributes in the Amazon SQS Developer Guide.\n */\n DataType: string;\n }\n\n export type MessageBodyAttributeMap = {\n [key: string]: MessageAttributeValue;\n };\n\n type MessageSystemAttributeMap = { [key: string]: string };\n\n export interface Message {\n /**\n * A unique identifier for the message. A
|
|
1
|
+
{"version":3,"file":"aws-sdk.types.js","sourceRoot":"","sources":["../../src/aws-sdk.types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * AWS SDK for JavaScript\n * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * This product includes software developed at\n * Amazon Web Services, Inc. (http://aws.amazon.com/).\n */\n\n/*\n These are slightly modified and simplified versions of the actual SQS types included\n in the official distribution:\n https://github.com/aws/aws-sdk-js/blob/master/clients/sqs.d.ts\n These are brought here to avoid having users install the `aws-sdk` whenever they\n require this instrumentation.\n*/\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface -- Our lint doesn't like it, but we prefer to keep it the way original source code has it\ninterface Blob {}\ntype Binary = Buffer | Uint8Array | Blob | string;\n\n// eslint-disable-next-line @typescript-eslint/no-namespace -- Prefer to contain the types copied over in one location\nexport namespace SNS {\n interface MessageAttributeValue {\n /**\n * Amazon SNS supports the following logical data types: String, String.Array, Number, and Binary. For more information, see Message Attribute Data Types.\n */\n DataType: string;\n /**\n * Strings are Unicode with UTF8 binary encoding. For a list of code values, see ASCII Printable Characters.\n */\n StringValue?: string;\n /**\n * Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images.\n */\n BinaryValue?: Binary;\n }\n\n export type MessageAttributeMap = { [key: string]: MessageAttributeValue };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace -- Prefer to contain the types copied over in one location\nexport namespace SQS {\n type StringList = string[];\n type BinaryList = Binary[];\n interface MessageAttributeValue {\n /**\n * Strings are Unicode with UTF-8 binary encoding. For a list of code values, see ASCII Printable Characters.\n */\n StringValue?: string;\n /**\n * Binary type attributes can store any binary data, such as compressed data, encrypted data, or images.\n */\n BinaryValue?: Binary;\n /**\n * Not implemented. Reserved for future use.\n */\n StringListValues?: StringList;\n /**\n * Not implemented. Reserved for future use.\n */\n BinaryListValues?: BinaryList;\n /**\n * Amazon SQS supports the following logical data types: String, Number, and Binary. For the Number data type, you must use StringValue. You can also append custom labels. For more information, see Amazon SQS Message Attributes in the Amazon SQS Developer Guide.\n */\n DataType: string;\n }\n\n export type MessageBodyAttributeMap = {\n [key: string]: MessageAttributeValue;\n };\n\n type MessageSystemAttributeMap = { [key: string]: string };\n\n export interface Message {\n /**\n * A unique identifier for the message. A MessageId is considered unique across all accounts for an extended period of time.\n */\n MessageId?: string;\n /**\n * An identifier associated with the act of receiving the message. A new receipt handle is returned every time you receive a message. When deleting a message, you provide the last received receipt handle to delete the message.\n */\n ReceiptHandle?: string;\n /**\n * An MD5 digest of the non-URL-encoded message body string.\n */\n MD5OfBody?: string;\n /**\n * The message's contents (not URL-encoded).\n */\n Body?: string;\n /**\n * A map of the attributes requested in ReceiveMessage to their respective values. Supported attributes: ApproximateReceiveCount ApproximateFirstReceiveTimestamp MessageDeduplicationId MessageGroupId SenderId SentTimestamp SequenceNumber ApproximateFirstReceiveTimestamp and SentTimestamp are each returned as an integer representing the epoch time in milliseconds.\n */\n Attributes?: MessageSystemAttributeMap;\n /**\n * An MD5 digest of the non-URL-encoded message attribute string. You can use this attribute to verify that Amazon SQS received the message correctly. Amazon SQS URL-decodes the message before creating the MD5 digest. For information about MD5, see RFC1321.\n */\n MD5OfMessageAttributes?: string;\n /**\n * Each message attribute consists of a Name, Type, and Value. For more information, see Amazon SQS message attributes in the Amazon SQS Developer Guide.\n */\n MessageAttributes?: MessageBodyAttributeMap;\n }\n}\n"]}
|
package/build/src/propwrap.d.ts
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* `orig` is the original property value. This must synchronously return the
|
|
32
32
|
* new property value.
|
|
33
33
|
* @returns {object} A new object with the wrapped property.
|
|
34
|
-
* @throws {TypeError} if the subpath points to a non-
|
|
34
|
+
* @throws {TypeError} if the subpath points to a non-existent property, or if
|
|
35
35
|
* any but the last subpath part points to a non-Object.
|
|
36
36
|
*/
|
|
37
37
|
export declare const propwrap: (obj: any, subpath: string, wrapper: Function) => any;
|
package/build/src/propwrap.js
CHANGED
|
@@ -93,7 +93,7 @@ const __copyProps = (to, from, except, desc) => {
|
|
|
93
93
|
* `orig` is the original property value. This must synchronously return the
|
|
94
94
|
* new property value.
|
|
95
95
|
* @returns {object} A new object with the wrapped property.
|
|
96
|
-
* @throws {TypeError} if the subpath points to a non-
|
|
96
|
+
* @throws {TypeError} if the subpath points to a non-existent property, or if
|
|
97
97
|
* any but the last subpath part points to a non-Object.
|
|
98
98
|
*/
|
|
99
99
|
const propwrap = (obj, subpath, wrapper) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propwrap.js","sourceRoot":"","sources":["../../src/propwrap.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;;;;;;;;;;;;;;;;;;;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CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAC9C,MAAM,gBAAgB,GAAG,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE;YAC1C,KAAK,EAAE,GAAG;YACV,UAAU,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU;SACrC,CAAC,CAAC;QACH,WAAW,CAAC,gBAAgB,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;QAC9C,UAAU,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC;KAClC;IAED,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC,CAAC;AApDW,QAAA,QAAQ,YAoDnB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * This block is derived from esbuild's bundling support.\n * https://github.com/evanw/esbuild/blob/v0.14.42/internal/runtime/runtime.go#L22\n *\n * License:\n * MIT License\n *\n * Copyright (c) 2020 Evan Wallace\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nconst __defProp = Object.defineProperty;\nconst __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nconst __hasOwnProp = Object.prototype.hasOwnProperty;\nconst __getOwnPropNames = Object.getOwnPropertyNames;\nconst __copyProps = (\n to: any,\n from: any,\n except: string,\n desc?: PropertyDescriptor | undefined\n) => {\n if ((from && typeof from === 'object') || typeof from === 'function') {\n for (const key of __getOwnPropNames(from)) {\n if (!__hasOwnProp.call(to, key) && key !== except) {\n __defProp(to, key, {\n get: () => from[key] as any,\n enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,\n });\n }\n }\n }\n return to;\n};\n\n/**\n * Return a new object that is a copy of `obj`, with its `subpath` property\n * replaced with the return value of `wrapper(original)`.\n *\n * This is similar to shimmer (i.e. `InstrumentationBase.prototype._wrap`).\n * However, it uses a different technique to support wrapping properties that\n * are only available via a getter (i.e. their property descriptor is `.writable\n * === false`).\n *\n * For example:\n * var os = propwrap(require('os'), 'platform', (orig) => {\n * return function wrappedPlatform () {\n * return orig().toUpperCase()\n * }\n * })\n * console.log(os.platform()) // => DARWIN\n *\n * The subpath can indicate a nested property. Each property in that subpath,\n * except the last, must identify an *Object*.\n *\n * Limitations:\n * - This doesn't handle possible Symbol properties on the copied object(s).\n * - This cannot wrap a property of a function, because we cannot create a\n * copy of the function.\n *\n * @param {object} obj\n * @param {string} subpath - The property subpath on `obj` to wrap. This may\n * point to a nested property by using a '.' to separate levels. For example:\n * var fs = wrap(fs, 'promises.sync', (orig) => { ... })\n * @param {Function} wrapper - A function of the form `function (orig)`, where\n * `orig` is the original property value. This must synchronously return the\n * new property value.\n * @returns {object} A new object with the wrapped property.\n * @throws {TypeError} if the subpath points to a non-
|
|
1
|
+
{"version":3,"file":"propwrap.js","sourceRoot":"","sources":["../../src/propwrap.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACxC,MAAM,gBAAgB,GAAG,MAAM,CAAC,wBAAwB,CAAC;AACzD,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACrD,MAAM,iBAAiB,GAAG,MAAM,CAAC,mBAAmB,CAAC;AACrD,MAAM,WAAW,GAAG,CAClB,EAAO,EACP,IAAS,EACT,MAAc,EACd,IAAqC,EACrC,EAAE;IACF,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;QACpE,KAAK,MAAM,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,EAAE;YACzC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,GAAG,KAAK,MAAM,EAAE;gBACjD,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE;oBACjB,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAQ;oBAC3B,UAAU,EAAE,CAAC,CAAC,IAAI,GAAG,gBAAgB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,UAAU;iBACrE,CAAC,CAAC;aACJ;SACF;KACF;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACI,MAAM,QAAQ,GAAG,CAAC,GAAQ,EAAE,OAAe,EAAE,OAAiB,EAAO,EAAE;IAC5E,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC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AAC,GAAG,CAAC,CAAC;YAC5B,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;SACrB;aAAM;YACL,GAAG,GAAG,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;SACzB;QACD,MAAM,IAAI,GAAG,gBAAgB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAC9C,MAAM,gBAAgB,GAAG,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE;YAC1C,KAAK,EAAE,GAAG;YACV,UAAU,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU;SACrC,CAAC,CAAC;QACH,WAAW,CAAC,gBAAgB,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;QAC9C,UAAU,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC;KAClC;IAED,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC,CAAC;AApDW,QAAA,QAAQ,YAoDnB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * This block is derived from esbuild's bundling support.\n * https://github.com/evanw/esbuild/blob/v0.14.42/internal/runtime/runtime.go#L22\n *\n * License:\n * MIT License\n *\n * Copyright (c) 2020 Evan Wallace\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nconst __defProp = Object.defineProperty;\nconst __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nconst __hasOwnProp = Object.prototype.hasOwnProperty;\nconst __getOwnPropNames = Object.getOwnPropertyNames;\nconst __copyProps = (\n to: any,\n from: any,\n except: string,\n desc?: PropertyDescriptor | undefined\n) => {\n if ((from && typeof from === 'object') || typeof from === 'function') {\n for (const key of __getOwnPropNames(from)) {\n if (!__hasOwnProp.call(to, key) && key !== except) {\n __defProp(to, key, {\n get: () => from[key] as any,\n enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,\n });\n }\n }\n }\n return to;\n};\n\n/**\n * Return a new object that is a copy of `obj`, with its `subpath` property\n * replaced with the return value of `wrapper(original)`.\n *\n * This is similar to shimmer (i.e. `InstrumentationBase.prototype._wrap`).\n * However, it uses a different technique to support wrapping properties that\n * are only available via a getter (i.e. their property descriptor is `.writable\n * === false`).\n *\n * For example:\n * var os = propwrap(require('os'), 'platform', (orig) => {\n * return function wrappedPlatform () {\n * return orig().toUpperCase()\n * }\n * })\n * console.log(os.platform()) // => DARWIN\n *\n * The subpath can indicate a nested property. Each property in that subpath,\n * except the last, must identify an *Object*.\n *\n * Limitations:\n * - This doesn't handle possible Symbol properties on the copied object(s).\n * - This cannot wrap a property of a function, because we cannot create a\n * copy of the function.\n *\n * @param {object} obj\n * @param {string} subpath - The property subpath on `obj` to wrap. This may\n * point to a nested property by using a '.' to separate levels. For example:\n * var fs = wrap(fs, 'promises.sync', (orig) => { ... })\n * @param {Function} wrapper - A function of the form `function (orig)`, where\n * `orig` is the original property value. This must synchronously return the\n * new property value.\n * @returns {object} A new object with the wrapped property.\n * @throws {TypeError} if the subpath points to a non-existent property, or if\n * any but the last subpath part points to a non-Object.\n */\nexport const propwrap = (obj: any, subpath: string, wrapper: Function): any => {\n const parts = subpath.split('.');\n const namespaces = [obj];\n let namespace = obj;\n let key;\n let val;\n\n // 1. Traverse the subpath parts to sanity check and get references to the\n // Objects that we will be copying.\n for (let i = 0; i < parts.length; i++) {\n key = parts[i];\n val = namespace[key];\n if (!val) {\n throw new TypeError(\n `cannot wrap \"${subpath}\": \"<obj>.${parts\n .slice(0, i)\n .join('.')}\" is ${typeof val}`\n );\n } else if (i < parts.length - 1) {\n if (typeof val !== 'object') {\n throw new TypeError(\n `cannot wrap \"${subpath}\": \"<obj>.${parts\n .slice(0, i)\n .join('.')}\" is not an Object`\n );\n }\n namespace = val;\n namespaces.push(namespace);\n }\n }\n\n // 2. Now work backwards, wrapping each namespace with a new object that has a\n // copy of all the properties, except the one that we've wrapped.\n for (let i = parts.length - 1; i >= 0; i--) {\n key = parts[i];\n namespace = namespaces[i];\n if (i === parts.length - 1) {\n const orig = namespace[key];\n val = wrapper(orig);\n } else {\n val = namespaces[i + 1];\n }\n const desc = __getOwnPropDesc(namespace, key);\n const wrappedNamespace = __defProp({}, key, {\n value: val,\n enumerable: !desc || desc.enumerable,\n });\n __copyProps(wrappedNamespace, namespace, key);\n namespaces[i] = wrappedNamespace;\n }\n\n return namespaces[0];\n};\n"]}
|
|
@@ -23,7 +23,7 @@ const MessageAttributes_1 = require("./MessageAttributes");
|
|
|
23
23
|
class SqsServiceExtension {
|
|
24
24
|
constructor() {
|
|
25
25
|
this.requestPostSpanHook = (request) => {
|
|
26
|
-
var _a, _b
|
|
26
|
+
var _a, _b;
|
|
27
27
|
switch (request.commandName) {
|
|
28
28
|
case 'SendMessage':
|
|
29
29
|
{
|
|
@@ -36,10 +36,13 @@ class SqsServiceExtension {
|
|
|
36
36
|
break;
|
|
37
37
|
case 'SendMessageBatch':
|
|
38
38
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
const entries = (_b = request.commandInput) === null || _b === void 0 ? void 0 : _b.Entries;
|
|
40
|
+
if (Array.isArray(entries)) {
|
|
41
|
+
entries.forEach((messageParams) => {
|
|
42
|
+
var _a;
|
|
43
|
+
messageParams.MessageAttributes = (0, MessageAttributes_1.injectPropagationContext)((_a = messageParams.MessageAttributes) !== null && _a !== void 0 ? _a : {});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
43
46
|
}
|
|
44
47
|
break;
|
|
45
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqs.js","sourceRoot":"","sources":["../../../src/services/sqs.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,4CAS4B;AAC5B,wEAAqE;AAQrE,8EAI6C;AAC7C,2DAK6B;AAE7B,MAAa,mBAAmB;IAAhC;QAoDE,wBAAmB,GAAG,CAAC,OAA0B,EAAE,EAAE;;YACnD,QAAQ,OAAO,CAAC,WAAW,EAAE;gBAC3B,KAAK,aAAa;oBAChB;wBACE,MAAM,qBAAqB,GACzB,MAAA,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC,mCAAI,EAAE,CAAC;wBAClD,IAAI,qBAAqB,EAAE;4BACzB,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC;gCACvC,IAAA,4CAAwB,EAAC,qBAAqB,CAAC,CAAC;yBACnD;qBACF;oBACD,MAAM;gBAER,KAAK,kBAAkB;oBACrB;wBACE,MAAA,MAAA,OAAO,CAAC,YAAY,0CAAE,OAAO,0CAAE,OAAO,CACpC,CAAC,aAA+C,EAAE,EAAE;;4BAClD,aAAa,CAAC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*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Tracer,\n SpanKind,\n Span,\n propagation,\n trace,\n context,\n ROOT_CONTEXT,\n SpanAttributes,\n} from '@opentelemetry/api';\nimport { pubsubPropagation } from '@opentelemetry/propagation-utils';\nimport { RequestMetadata, ServiceExtension } from './ServiceExtension';\nimport type { SQS } from 'aws-sdk';\nimport {\n AwsSdkInstrumentationConfig,\n NormalizedRequest,\n NormalizedResponse,\n} from '../types';\nimport {\n MessagingDestinationKindValues,\n MessagingOperationValues,\n SemanticAttributes,\n} from '@opentelemetry/semantic-conventions';\nimport {\n contextGetter,\n extractPropagationContext,\n injectPropagationContext,\n addPropagationFieldsToAttributeNames,\n} from './MessageAttributes';\n\nexport class SqsServiceExtension implements ServiceExtension {\n requestPreSpanHook(\n request: NormalizedRequest,\n _config: AwsSdkInstrumentationConfig\n ): RequestMetadata {\n const queueUrl = this.extractQueueUrl(request.commandInput);\n const queueName = this.extractQueueNameFromUrl(queueUrl);\n let spanKind: SpanKind = SpanKind.CLIENT;\n let spanName: string | undefined;\n\n const spanAttributes: SpanAttributes = {\n [SemanticAttributes.MESSAGING_SYSTEM]: 'aws.sqs',\n [SemanticAttributes.MESSAGING_DESTINATION_KIND]:\n MessagingDestinationKindValues.QUEUE,\n [SemanticAttributes.MESSAGING_DESTINATION]: queueName,\n [SemanticAttributes.MESSAGING_URL]: queueUrl,\n };\n\n let isIncoming = false;\n\n switch (request.commandName) {\n case 'ReceiveMessage':\n {\n isIncoming = true;\n spanKind = SpanKind.CONSUMER;\n spanName = `${queueName} receive`;\n spanAttributes[SemanticAttributes.MESSAGING_OPERATION] =\n MessagingOperationValues.RECEIVE;\n\n request.commandInput.MessageAttributeNames =\n addPropagationFieldsToAttributeNames(\n request.commandInput.MessageAttributeNames,\n propagation.fields()\n );\n }\n break;\n\n case 'SendMessage':\n case 'SendMessageBatch':\n spanKind = SpanKind.PRODUCER;\n spanName = `${queueName} send`;\n break;\n }\n\n return {\n isIncoming,\n spanAttributes,\n spanKind,\n spanName,\n };\n }\n\n requestPostSpanHook = (request: NormalizedRequest) => {\n switch (request.commandName) {\n case 'SendMessage':\n {\n const origMessageAttributes =\n request.commandInput['MessageAttributes'] ?? {};\n if (origMessageAttributes) {\n request.commandInput['MessageAttributes'] =\n injectPropagationContext(origMessageAttributes);\n }\n }\n break;\n\n case 'SendMessageBatch':\n {\n request.commandInput?.Entries?.forEach(\n (messageParams: SQS.SendMessageBatchRequestEntry) => {\n messageParams.MessageAttributes = injectPropagationContext(\n messageParams.MessageAttributes ?? {}\n );\n }\n );\n }\n break;\n }\n };\n\n responseHook = (\n response: NormalizedResponse,\n span: Span,\n tracer: Tracer,\n config: AwsSdkInstrumentationConfig\n ) => {\n switch (response.request.commandName) {\n case 'SendMessage':\n span.setAttribute(\n SemanticAttributes.MESSAGING_MESSAGE_ID,\n response?.data?.MessageId\n );\n break;\n\n case 'SendMessageBatch':\n // TODO: How should this be handled?\n break;\n\n case 'ReceiveMessage': {\n const messages: SQS.Message[] = response?.data?.Messages;\n if (messages) {\n const queueUrl = this.extractQueueUrl(response.request.commandInput);\n const queueName = this.extractQueueNameFromUrl(queueUrl);\n\n pubsubPropagation.patchMessagesArrayToStartProcessSpans<SQS.Message>({\n messages,\n parentContext: trace.setSpan(context.active(), span),\n tracer,\n messageToSpanDetails: (message: SQS.Message) => ({\n name: queueName ?? 'unknown',\n parentContext: propagation.extract(\n ROOT_CONTEXT,\n extractPropagationContext(\n message,\n config.sqsExtractContextPropagationFromPayload\n ),\n contextGetter\n ),\n attributes: {\n [SemanticAttributes.MESSAGING_SYSTEM]: 'aws.sqs',\n [SemanticAttributes.MESSAGING_DESTINATION]: queueName,\n [SemanticAttributes.MESSAGING_DESTINATION_KIND]:\n MessagingDestinationKindValues.QUEUE,\n [SemanticAttributes.MESSAGING_MESSAGE_ID]: message.MessageId,\n [SemanticAttributes.MESSAGING_URL]: queueUrl,\n [SemanticAttributes.MESSAGING_OPERATION]:\n MessagingOperationValues.PROCESS,\n },\n }),\n processHook: (span: Span, message: SQS.Message) =>\n config.sqsProcessHook?.(span, { message }),\n });\n\n pubsubPropagation.patchArrayForProcessSpans(\n messages,\n tracer,\n context.active()\n );\n }\n break;\n }\n }\n };\n\n extractQueueUrl = (commandInput: Record<string, any>): string => {\n return commandInput?.QueueUrl;\n };\n\n extractQueueNameFromUrl = (queueUrl: string): string | undefined => {\n if (!queueUrl) return undefined;\n\n const segments = queueUrl.split('/');\n if (segments.length === 0) return undefined;\n\n return segments[segments.length - 1];\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sqs.js","sourceRoot":"","sources":["../../../src/services/sqs.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,4CAS4B;AAC5B,wEAAqE;AAQrE,8EAI6C;AAC7C,2DAK6B;AAE7B,MAAa,mBAAmB;IAAhC;QAoDE,wBAAmB,GAAG,CAAC,OAA0B,EAAE,EAAE;;YACnD,QAAQ,OAAO,CAAC,WAAW,EAAE;gBAC3B,KAAK,aAAa;oBAChB;wBACE,MAAM,qBAAqB,GACzB,MAAA,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC,mCAAI,EAAE,CAAC;wBAClD,IAAI,qBAAqB,EAAE;4BACzB,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC;gCACvC,IAAA,4CAAwB,EAAC,qBAAqB,CAAC,CAAC;yBACnD;qBACF;oBACD,MAAM;gBAER,KAAK,kBAAkB;oBACrB;wBACE,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,YAAY,0CAAE,OAAO,CAAC;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CAAC;gBAC/B,MAAM;SACT;QAED,OAAO;YACL,UAAU;YACV,cAAc;YACd,QAAQ;YACR,QAAQ;SACT,CAAC;IACJ,CAAC;CA4GF;AA9JD,kDA8JC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Tracer,\n SpanKind,\n Span,\n propagation,\n trace,\n context,\n ROOT_CONTEXT,\n SpanAttributes,\n} from '@opentelemetry/api';\nimport { pubsubPropagation } from '@opentelemetry/propagation-utils';\nimport { RequestMetadata, ServiceExtension } from './ServiceExtension';\nimport type { SQS } from 'aws-sdk';\nimport {\n AwsSdkInstrumentationConfig,\n NormalizedRequest,\n NormalizedResponse,\n} from '../types';\nimport {\n MessagingDestinationKindValues,\n MessagingOperationValues,\n SemanticAttributes,\n} from '@opentelemetry/semantic-conventions';\nimport {\n contextGetter,\n extractPropagationContext,\n injectPropagationContext,\n addPropagationFieldsToAttributeNames,\n} from './MessageAttributes';\n\nexport class SqsServiceExtension implements ServiceExtension {\n requestPreSpanHook(\n request: NormalizedRequest,\n _config: AwsSdkInstrumentationConfig\n ): RequestMetadata {\n const queueUrl = this.extractQueueUrl(request.commandInput);\n const queueName = this.extractQueueNameFromUrl(queueUrl);\n let spanKind: SpanKind = SpanKind.CLIENT;\n let spanName: string | undefined;\n\n const spanAttributes: SpanAttributes = {\n [SemanticAttributes.MESSAGING_SYSTEM]: 'aws.sqs',\n [SemanticAttributes.MESSAGING_DESTINATION_KIND]:\n MessagingDestinationKindValues.QUEUE,\n [SemanticAttributes.MESSAGING_DESTINATION]: queueName,\n [SemanticAttributes.MESSAGING_URL]: queueUrl,\n };\n\n let isIncoming = false;\n\n switch (request.commandName) {\n case 'ReceiveMessage':\n {\n isIncoming = true;\n spanKind = SpanKind.CONSUMER;\n spanName = `${queueName} receive`;\n spanAttributes[SemanticAttributes.MESSAGING_OPERATION] =\n MessagingOperationValues.RECEIVE;\n\n request.commandInput.MessageAttributeNames =\n addPropagationFieldsToAttributeNames(\n request.commandInput.MessageAttributeNames,\n propagation.fields()\n );\n }\n break;\n\n case 'SendMessage':\n case 'SendMessageBatch':\n spanKind = SpanKind.PRODUCER;\n spanName = `${queueName} send`;\n break;\n }\n\n return {\n isIncoming,\n spanAttributes,\n spanKind,\n spanName,\n };\n }\n\n requestPostSpanHook = (request: NormalizedRequest) => {\n switch (request.commandName) {\n case 'SendMessage':\n {\n const origMessageAttributes =\n request.commandInput['MessageAttributes'] ?? {};\n if (origMessageAttributes) {\n request.commandInput['MessageAttributes'] =\n injectPropagationContext(origMessageAttributes);\n }\n }\n break;\n\n case 'SendMessageBatch':\n {\n const entries = request.commandInput?.Entries;\n if (Array.isArray(entries)) {\n entries.forEach(\n (messageParams: SQS.SendMessageBatchRequestEntry) => {\n messageParams.MessageAttributes = injectPropagationContext(\n messageParams.MessageAttributes ?? {}\n );\n }\n );\n }\n }\n break;\n }\n };\n\n responseHook = (\n response: NormalizedResponse,\n span: Span,\n tracer: Tracer,\n config: AwsSdkInstrumentationConfig\n ) => {\n switch (response.request.commandName) {\n case 'SendMessage':\n span.setAttribute(\n SemanticAttributes.MESSAGING_MESSAGE_ID,\n response?.data?.MessageId\n );\n break;\n\n case 'SendMessageBatch':\n // TODO: How should this be handled?\n break;\n\n case 'ReceiveMessage': {\n const messages: SQS.Message[] = response?.data?.Messages;\n if (messages) {\n const queueUrl = this.extractQueueUrl(response.request.commandInput);\n const queueName = this.extractQueueNameFromUrl(queueUrl);\n\n pubsubPropagation.patchMessagesArrayToStartProcessSpans<SQS.Message>({\n messages,\n parentContext: trace.setSpan(context.active(), span),\n tracer,\n messageToSpanDetails: (message: SQS.Message) => ({\n name: queueName ?? 'unknown',\n parentContext: propagation.extract(\n ROOT_CONTEXT,\n extractPropagationContext(\n message,\n config.sqsExtractContextPropagationFromPayload\n ),\n contextGetter\n ),\n attributes: {\n [SemanticAttributes.MESSAGING_SYSTEM]: 'aws.sqs',\n [SemanticAttributes.MESSAGING_DESTINATION]: queueName,\n [SemanticAttributes.MESSAGING_DESTINATION_KIND]:\n MessagingDestinationKindValues.QUEUE,\n [SemanticAttributes.MESSAGING_MESSAGE_ID]: message.MessageId,\n [SemanticAttributes.MESSAGING_URL]: queueUrl,\n [SemanticAttributes.MESSAGING_OPERATION]:\n MessagingOperationValues.PROCESS,\n },\n }),\n processHook: (span: Span, message: SQS.Message) =>\n config.sqsProcessHook?.(span, { message }),\n });\n\n pubsubPropagation.patchArrayForProcessSpans(\n messages,\n tracer,\n context.active()\n );\n }\n break;\n }\n }\n };\n\n extractQueueUrl = (commandInput: Record<string, any>): string => {\n return commandInput?.QueueUrl;\n };\n\n extractQueueNameFromUrl = (queueUrl: string): string | undefined => {\n if (!queueUrl) return undefined;\n\n const segments = queueUrl.split('/');\n if (segments.length === 0) return undefined;\n\n return segments[segments.length - 1];\n };\n}\n"]}
|
package/build/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.40.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/src/version.js
CHANGED
package/build/src/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.40.0';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentelemetry/instrumentation-aws-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"description": "OpenTelemetry automatic instrumentation for the `aws-sdk` package",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@opentelemetry/core": "^1.8.0",
|
|
48
|
-
"@opentelemetry/instrumentation": "^0.
|
|
49
|
-
"@opentelemetry/propagation-utils": "^0.30.
|
|
48
|
+
"@opentelemetry/instrumentation": "^0.50.0",
|
|
49
|
+
"@opentelemetry/propagation-utils": "^0.30.8",
|
|
50
50
|
"@opentelemetry/semantic-conventions": "^1.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@aws-sdk/client-sqs": "3.85.0",
|
|
58
58
|
"@aws-sdk/types": "3.78.0",
|
|
59
59
|
"@opentelemetry/api": "^1.3.0",
|
|
60
|
-
"@opentelemetry/contrib-test-utils": "^0.
|
|
60
|
+
"@opentelemetry/contrib-test-utils": "^0.38.0",
|
|
61
61
|
"@opentelemetry/sdk-trace-base": "^1.8.0",
|
|
62
62
|
"@types/mocha": "8.2.3",
|
|
63
63
|
"@types/node": "18.6.5",
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
"nyc": "15.1.0",
|
|
71
71
|
"rimraf": "5.0.5",
|
|
72
72
|
"sinon": "15.2.0",
|
|
73
|
-
"test-all-versions": "6.
|
|
73
|
+
"test-all-versions": "6.1.0",
|
|
74
74
|
"ts-mocha": "10.0.0",
|
|
75
75
|
"typescript": "4.4.4"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|
|
78
78
|
"node": ">=14"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "17a0bc1da3baa472ba9b867eee3c60730cc130fb"
|
|
81
81
|
}
|