@opentelemetry/instrumentation-aws-sdk 0.1.0 → 0.4.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/CHANGELOG.md +35 -0
- package/README.md +2 -4
- package/build/src/services/MessageAttributes.d.ts +22 -0
- package/build/src/services/MessageAttributes.js +70 -0
- package/build/src/services/MessageAttributes.js.map +1 -0
- package/build/src/services/ServicesExtensions.js +2 -0
- package/build/src/services/ServicesExtensions.js.map +1 -1
- package/build/src/services/sns.d.ts +10 -0
- package/build/src/services/sns.js +74 -0
- package/build/src/services/sns.js.map +1 -0
- package/build/src/services/sqs.d.ts +0 -4
- package/build/src/services/sqs.js +5 -37
- package/build/src/services/sqs.js.map +1 -1
- package/build/src/types.d.ts +10 -0
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/doc/sns.md +28 -0
- package/package.json +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.0](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-aws-sdk-v0.3.1...instrumentation-aws-sdk-v0.4.0) (2021-11-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* use latest instrumentation base ([#769](https://www.github.com/open-telemetry/opentelemetry-js-contrib/issues/769)) ([7aff23e](https://www.github.com/open-telemetry/opentelemetry-js-contrib/commit/7aff23ebebbe209fa3b78c2e7f513c9cd2231be4))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* devDependencies
|
|
15
|
+
* @opentelemetry/contrib-test-utils bumped from ^0.27.0 to ^0.28.0
|
|
16
|
+
|
|
17
|
+
### [0.3.1](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-aws-sdk-v0.3.0...instrumentation-aws-sdk-v0.3.1) (2021-11-30)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **aws-sdk:** sns-sqs extract the correct context key from message payload ([#761](https://www.github.com/open-telemetry/opentelemetry-js-contrib/issues/761)) ([e5cae76](https://www.github.com/open-telemetry/opentelemetry-js-contrib/commit/e5cae76d90b5e6d2eb9c6cd5da984a07cdd5048c))
|
|
23
|
+
|
|
24
|
+
## [0.3.0](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-aws-sdk-v0.2.0...instrumentation-aws-sdk-v0.3.0) (2021-11-19)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* config option to extract sqs context from message payload ([#737](https://www.github.com/open-telemetry/opentelemetry-js-contrib/issues/737)) ([28e2113](https://www.github.com/open-telemetry/opentelemetry-js-contrib/commit/28e2113ec1091e73a1d1b62b48fee8c01c72afee))
|
|
30
|
+
|
|
31
|
+
## [0.2.0](https://www.github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-aws-sdk-v0.1.0...instrumentation-aws-sdk-v0.2.0) (2021-11-12)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* AWS-SDK SNS Context propagation ([#728](https://www.github.com/open-telemetry/opentelemetry-js-contrib/issues/728)) ([78cd4e1](https://www.github.com/open-telemetry/opentelemetry-js-contrib/commit/78cd4e118e5a41107d84dfd1ae8c4c28e885b27e))
|
|
37
|
+
|
|
3
38
|
## 0.1.0 (2021-10-22)
|
|
4
39
|
|
|
5
40
|
|
package/README.md
CHANGED
|
@@ -48,6 +48,7 @@ aws-sdk instrumentation has few options available to choose from. You can set th
|
|
|
48
48
|
| `responseHook` | `AwsSdkResponseCustomAttributeFunction` | Hook for adding custom attributes when response is received from aws. |
|
|
49
49
|
| `sqsProcessHook` | `AwsSdkSqsProcessCustomAttributeFunction` | Hook called after starting sqs `process` span (for each sqs received message), which allow to add custom attributes to it. |
|
|
50
50
|
| `suppressInternalInstrumentation` | `boolean` | Most aws operation use http requests under the hood. Set this to `true` to hide all underlying http spans. |
|
|
51
|
+
| `sqsExtractContextPropagationFromPayload` | `boolean` | Will parse and extract context propagation headers from SQS Payload, false by default. [When should it be used?](./doc/sns.md#integration-with-sqs)|
|
|
51
52
|
|
|
52
53
|
## Span Attributes
|
|
53
54
|
|
|
@@ -96,12 +97,9 @@ AWS contains dozens of services accessible with the JS SDK. For many services, t
|
|
|
96
97
|
Specific service logic currently implemented for:
|
|
97
98
|
|
|
98
99
|
- [SQS](./docs/sqs.md)
|
|
100
|
+
- [SNS](./docs/sns.md)
|
|
99
101
|
- DynamoDb
|
|
100
102
|
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
This instrumentation is a work in progress. We implemented some of the specific trace semantics for some of the services, and strive to support more services and extend the already supported services in the future. You can [Open an Issue](https://github.com/aspecto-io/opentelemetry-ext-js/issues), or [Submit a Pull Request](https://github.com/aspecto-io/opentelemetry-ext-js/pulls) if you want to contribute.
|
|
104
|
-
|
|
105
103
|
## Potential Side Effects
|
|
106
104
|
|
|
107
105
|
The instrumentation is doing best effort to support the trace specification of OpenTelemetry. For SQS, it involves defining new attributes on the `Messages` array, as well as on the manipulated types generated from this array (to set correct trace context for a single SQS message operation). Those properties are defined as [non-enumerable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties) properties, so they have minimum side effect on the app. They will, however, show when using the `Object.getOwnPropertyDescriptors` and `Reflect.ownKeys` functions on SQS `Messages` array and for each `Message` in the array.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TextMapGetter, TextMapSetter } from '@opentelemetry/api';
|
|
2
|
+
import type { SQS, SNS } from 'aws-sdk';
|
|
3
|
+
export declare const MAX_MESSAGE_ATTRIBUTES = 10;
|
|
4
|
+
declare class ContextSetter implements TextMapSetter<SQS.MessageBodyAttributeMap | SNS.MessageAttributeMap> {
|
|
5
|
+
set(carrier: SQS.MessageBodyAttributeMap | SNS.MessageAttributeMap, key: string, value: string): void;
|
|
6
|
+
}
|
|
7
|
+
export declare const contextSetter: ContextSetter;
|
|
8
|
+
export interface AwsSdkContextObject {
|
|
9
|
+
[key: string]: {
|
|
10
|
+
StringValue?: string;
|
|
11
|
+
Value?: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
declare class ContextGetter implements TextMapGetter<SQS.MessageBodyAttributeMap | SNS.MessageAttributeMap> {
|
|
15
|
+
keys(carrier: SQS.MessageBodyAttributeMap | SNS.MessageAttributeMap): string[];
|
|
16
|
+
get(carrier: AwsSdkContextObject, key: string): undefined | string | string[];
|
|
17
|
+
}
|
|
18
|
+
export declare const contextGetter: ContextGetter;
|
|
19
|
+
export declare const injectPropagationContext: (attributesMap?: SNS.MessageAttributeMap | SQS.MessageBodyAttributeMap | undefined) => SQS.MessageBodyAttributeMap | SNS.MessageAttributeMap;
|
|
20
|
+
export declare const extractPropagationContext: (message: SQS.Message, sqsExtractContextPropagationFromPayload: boolean | undefined) => AwsSdkContextObject | undefined;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=MessageAttributes.d.ts.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractPropagationContext = exports.injectPropagationContext = exports.contextGetter = exports.contextSetter = exports.MAX_MESSAGE_ATTRIBUTES = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright The OpenTelemetry Authors
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
const api_1 = require("@opentelemetry/api");
|
|
20
|
+
// https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-quotas.html
|
|
21
|
+
exports.MAX_MESSAGE_ATTRIBUTES = 10;
|
|
22
|
+
class ContextSetter {
|
|
23
|
+
set(carrier, key, value) {
|
|
24
|
+
carrier[key] = {
|
|
25
|
+
DataType: 'String',
|
|
26
|
+
StringValue: value,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.contextSetter = new ContextSetter();
|
|
31
|
+
class ContextGetter {
|
|
32
|
+
keys(carrier) {
|
|
33
|
+
return Object.keys(carrier);
|
|
34
|
+
}
|
|
35
|
+
get(carrier, key) {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
return ((_a = carrier === null || carrier === void 0 ? void 0 : carrier[key]) === null || _a === void 0 ? void 0 : _a.StringValue) || ((_b = carrier === null || carrier === void 0 ? void 0 : carrier[key]) === null || _b === void 0 ? void 0 : _b.Value);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.contextGetter = new ContextGetter();
|
|
41
|
+
const injectPropagationContext = (attributesMap) => {
|
|
42
|
+
const attributes = attributesMap !== null && attributesMap !== void 0 ? attributesMap : {};
|
|
43
|
+
if (Object.keys(attributes).length < exports.MAX_MESSAGE_ATTRIBUTES) {
|
|
44
|
+
api_1.propagation.inject(api_1.context.active(), attributes, exports.contextSetter);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
api_1.diag.warn('aws-sdk instrumentation: cannot set context propagation on SQS/SNS message due to maximum amount of MessageAttributes');
|
|
48
|
+
}
|
|
49
|
+
return attributes;
|
|
50
|
+
};
|
|
51
|
+
exports.injectPropagationContext = injectPropagationContext;
|
|
52
|
+
const extractPropagationContext = (message, sqsExtractContextPropagationFromPayload) => {
|
|
53
|
+
const propagationFields = api_1.propagation.fields();
|
|
54
|
+
const hasPropagationFields = Object.keys(message.MessageAttributes || []).some(attr => propagationFields.includes(attr));
|
|
55
|
+
if (hasPropagationFields) {
|
|
56
|
+
return message.MessageAttributes;
|
|
57
|
+
}
|
|
58
|
+
else if (sqsExtractContextPropagationFromPayload && message.Body) {
|
|
59
|
+
try {
|
|
60
|
+
const payload = JSON.parse(message.Body);
|
|
61
|
+
return payload.MessageAttributes;
|
|
62
|
+
}
|
|
63
|
+
catch (_a) {
|
|
64
|
+
api_1.diag.debug('failed to parse SQS payload to extract context propagation, trace might be incomplete.');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
};
|
|
69
|
+
exports.extractPropagationContext = extractPropagationContext;
|
|
70
|
+
//# sourceMappingURL=MessageAttributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageAttributes.js","sourceRoot":"","sources":["../../../src/services/MessageAttributes.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,4CAM4B;AAG5B,6FAA6F;AAChF,QAAA,sBAAsB,GAAG,EAAE,CAAC;AACzC,MAAM,aAAa;IAIjB,GAAG,CACD,OAA8D,EAC9D,GAAW,EACX,KAAa;QAEb,OAAO,CAAC,GAAG,CAAC,GAAG;YACb,QAAQ,EAAE,QAAQ;YAClB,WAAW,EAAE,KAAe;SAC7B,CAAC;IACJ,CAAC;CACF;AACY,QAAA,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;AASjD,MAAM,aAAa;IAIjB,IAAI,CACF,OAA8D;QAE9D,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,GAAG,CACD,OAA4B,EAC5B,GAAW;;QAEX,OAAO,CAAA,MAAA,OAAO,aAAP,OAA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ACR,wFAAwF,CACzF,CAAC;SACH;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AArBW,QAAA,yBAAyB,6BAqBpC"}
|
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ServicesExtensions = void 0;
|
|
4
4
|
const sqs_1 = require("./sqs");
|
|
5
5
|
const dynamodb_1 = require("./dynamodb");
|
|
6
|
+
const sns_1 = require("./sns");
|
|
6
7
|
class ServicesExtensions {
|
|
7
8
|
constructor() {
|
|
8
9
|
this.services = new Map();
|
|
9
10
|
this.services.set('SQS', new sqs_1.SqsServiceExtension());
|
|
11
|
+
this.services.set('SNS', new sns_1.SnsServiceExtension());
|
|
10
12
|
this.services.set('DynamoDB', new dynamodb_1.DynamodbServiceExtension());
|
|
11
13
|
}
|
|
12
14
|
requestPreSpanHook(request) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServicesExtensions.js","sourceRoot":"","sources":["../../../src/services/ServicesExtensions.ts"],"names":[],"mappings":";;;AAiBA,+BAA4C;AAM5C,yCAAsD;
|
|
1
|
+
{"version":3,"file":"ServicesExtensions.js","sourceRoot":"","sources":["../../../src/services/ServicesExtensions.ts"],"names":[],"mappings":";;;AAiBA,+BAA4C;AAM5C,yCAAsD;AACtD,+BAA4C;AAE5C,MAAa,kBAAkB;IAG7B;QAFA,aAAQ,GAAkC,IAAI,GAAG,EAAE,CAAC;QAGlD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,yBAAmB,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,yBAAmB,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,mCAAwB,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,kBAAkB,CAAC,OAA0B;QAC3C,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChE,IAAI,CAAC,gBAAgB;YACnB,OAAO;gBACL,UAAU,EAAE,KAAK;aAClB,CAAC;QACJ,OAAO,gBAAgB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;IAED,mBAAmB,CAAC,OAA0B;QAC5C,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChE,IAAI,CAAC,CAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,mBAAmB,CAAA;YAAE,OAAO;QACnD,OAAO,gBAAgB,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,YAAY,CACV,QAA4B,EAC5B,IAAU,EACV,MAAc,EACd,MAAmC;;QAEnC,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACzE,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,YAAY,+CAA9B,gBAAgB,EAAiB,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnE,CAAC;CACF;AAjCD,gDAiCC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Span, Tracer } from '@opentelemetry/api';
|
|
2
|
+
import { NormalizedRequest, NormalizedResponse, AwsSdkInstrumentationConfig } from '../types';
|
|
3
|
+
import { RequestMetadata, ServiceExtension } from './ServiceExtension';
|
|
4
|
+
export declare class SnsServiceExtension implements ServiceExtension {
|
|
5
|
+
requestPreSpanHook(request: NormalizedRequest): RequestMetadata;
|
|
6
|
+
requestPostSpanHook(request: NormalizedRequest): void;
|
|
7
|
+
responseHook(response: NormalizedResponse, span: Span, tracer: Tracer, config: AwsSdkInstrumentationConfig): void;
|
|
8
|
+
extractDestinationName(topicArn: string, targetArn: string, phoneNumber: string): string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=sns.d.ts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SnsServiceExtension = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright The OpenTelemetry Authors
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
const api_1 = require("@opentelemetry/api");
|
|
20
|
+
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
21
|
+
const MessageAttributes_1 = require("./MessageAttributes");
|
|
22
|
+
class SnsServiceExtension {
|
|
23
|
+
requestPreSpanHook(request) {
|
|
24
|
+
let spanKind = api_1.SpanKind.CLIENT;
|
|
25
|
+
let spanName = `SNS ${request.commandName}`;
|
|
26
|
+
const spanAttributes = {
|
|
27
|
+
[semantic_conventions_1.SemanticAttributes.MESSAGING_SYSTEM]: 'aws.sns',
|
|
28
|
+
};
|
|
29
|
+
if (request.commandName === 'Publish') {
|
|
30
|
+
spanKind = api_1.SpanKind.PRODUCER;
|
|
31
|
+
spanAttributes[semantic_conventions_1.SemanticAttributes.MESSAGING_DESTINATION_KIND] =
|
|
32
|
+
semantic_conventions_1.MessagingDestinationKindValues.TOPIC;
|
|
33
|
+
const { TopicArn, TargetArn, PhoneNumber } = request.commandInput;
|
|
34
|
+
spanAttributes[semantic_conventions_1.SemanticAttributes.MESSAGING_DESTINATION] =
|
|
35
|
+
this.extractDestinationName(TopicArn, TargetArn, PhoneNumber);
|
|
36
|
+
spanName = `${spanAttributes[semantic_conventions_1.SemanticAttributes.MESSAGING_DESTINATION]} send`;
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
isIncoming: false,
|
|
40
|
+
spanAttributes,
|
|
41
|
+
spanKind,
|
|
42
|
+
spanName,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
requestPostSpanHook(request) {
|
|
46
|
+
var _a;
|
|
47
|
+
if (request.commandName === 'Publish') {
|
|
48
|
+
const origMessageAttributes = (_a = request.commandInput['MessageAttributes']) !== null && _a !== void 0 ? _a : {};
|
|
49
|
+
if (origMessageAttributes) {
|
|
50
|
+
request.commandInput['MessageAttributes'] = MessageAttributes_1.injectPropagationContext(origMessageAttributes);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
responseHook(response, span, tracer, config) { }
|
|
55
|
+
extractDestinationName(topicArn, targetArn, phoneNumber) {
|
|
56
|
+
if (topicArn || targetArn) {
|
|
57
|
+
const arn = topicArn !== null && topicArn !== void 0 ? topicArn : targetArn;
|
|
58
|
+
try {
|
|
59
|
+
return arn.substr(arn.lastIndexOf(':') + 1);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
return arn;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else if (phoneNumber) {
|
|
66
|
+
return phoneNumber;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return 'unknown';
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.SnsServiceExtension = SnsServiceExtension;
|
|
74
|
+
//# sourceMappingURL=sns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sns.js","sourceRoot":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,YAAY,CACV,QAA4B,EAC5B,IAAU,EACV,MAAc,EACd,MAAmC,IAC5B,CAAC;IAEV,sBAAsB,CACpB,QAAgB,EAChB,SAAiB,EACjB,WAAmB;QAEnB,IAAI,QAAQ,IAAI,SAAS,EAAE;YACzB,MAAM,GAAG,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,SAAS,CAAC;YAClC,IAAI;gBACF,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;aAC7C;YAAC,OAAO,GAAG,EAAE;gBACZ,OAAO,GAAG,CAAC;aACZ;SACF;aAAM,IAAI,WAAW,EAAE;YACtB,OAAO,WAAW,CAAC;SACpB;aAAM;YACL,OAAO,SAAS,CAAC;SAClB;IACH,CAAC;CACF;AAnED,kDAmEC"}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { Tracer, Span } from '@opentelemetry/api';
|
|
2
2
|
import { RequestMetadata, ServiceExtension } from './ServiceExtension';
|
|
3
|
-
import type { SQS } from 'aws-sdk';
|
|
4
3
|
import { AwsSdkInstrumentationConfig, NormalizedRequest, NormalizedResponse } from '../types';
|
|
5
|
-
export declare const START_SPAN_FUNCTION: unique symbol;
|
|
6
|
-
export declare const END_SPAN_FUNCTION: unique symbol;
|
|
7
4
|
export declare class SqsServiceExtension implements ServiceExtension {
|
|
8
5
|
requestPreSpanHook(request: NormalizedRequest): RequestMetadata;
|
|
9
6
|
requestPostSpanHook: (request: NormalizedRequest) => void;
|
|
10
7
|
responseHook: (response: NormalizedResponse, span: Span, tracer: Tracer, config: AwsSdkInstrumentationConfig) => void;
|
|
11
8
|
extractQueueUrl: (commandInput: Record<string, any>) => string;
|
|
12
9
|
extractQueueNameFromUrl: (queueUrl: string) => string | undefined;
|
|
13
|
-
InjectPropagationContext(attributesMap?: SQS.MessageBodyAttributeMap): SQS.MessageBodyAttributeMap;
|
|
14
10
|
}
|
|
15
11
|
//# sourceMappingURL=sqs.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SqsServiceExtension =
|
|
3
|
+
exports.SqsServiceExtension = void 0;
|
|
4
4
|
/*
|
|
5
5
|
* Copyright The OpenTelemetry Authors
|
|
6
6
|
*
|
|
@@ -19,29 +19,7 @@ exports.SqsServiceExtension = exports.END_SPAN_FUNCTION = exports.START_SPAN_FUN
|
|
|
19
19
|
const api_1 = require("@opentelemetry/api");
|
|
20
20
|
const propagation_utils_1 = require("@opentelemetry/propagation-utils");
|
|
21
21
|
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
22
|
-
|
|
23
|
-
exports.END_SPAN_FUNCTION = Symbol('opentelemetry.instrumentation.aws-sdk.sqs.end_span');
|
|
24
|
-
// https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-quotas.html
|
|
25
|
-
const SQS_MAX_MESSAGE_ATTRIBUTES = 10;
|
|
26
|
-
class SqsContextSetter {
|
|
27
|
-
set(carrier, key, value) {
|
|
28
|
-
carrier[key] = {
|
|
29
|
-
DataType: 'String',
|
|
30
|
-
StringValue: value,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const sqsContextSetter = new SqsContextSetter();
|
|
35
|
-
class SqsContextGetter {
|
|
36
|
-
keys(carrier) {
|
|
37
|
-
return Object.keys(carrier);
|
|
38
|
-
}
|
|
39
|
-
get(carrier, key) {
|
|
40
|
-
var _a;
|
|
41
|
-
return (_a = carrier === null || carrier === void 0 ? void 0 : carrier[key]) === null || _a === void 0 ? void 0 : _a.StringValue;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
const sqsContextGetter = new SqsContextGetter();
|
|
22
|
+
const MessageAttributes_1 = require("./MessageAttributes");
|
|
45
23
|
class SqsServiceExtension {
|
|
46
24
|
constructor() {
|
|
47
25
|
this.requestPostSpanHook = (request) => {
|
|
@@ -52,7 +30,7 @@ class SqsServiceExtension {
|
|
|
52
30
|
const origMessageAttributes = (_a = request.commandInput['MessageAttributes']) !== null && _a !== void 0 ? _a : {};
|
|
53
31
|
if (origMessageAttributes) {
|
|
54
32
|
request.commandInput['MessageAttributes'] =
|
|
55
|
-
|
|
33
|
+
MessageAttributes_1.injectPropagationContext(origMessageAttributes);
|
|
56
34
|
}
|
|
57
35
|
}
|
|
58
36
|
break;
|
|
@@ -60,7 +38,7 @@ class SqsServiceExtension {
|
|
|
60
38
|
{
|
|
61
39
|
(_c = (_b = request.commandInput) === null || _b === void 0 ? void 0 : _b.Entries) === null || _c === void 0 ? void 0 : _c.forEach((messageParams) => {
|
|
62
40
|
var _a;
|
|
63
|
-
messageParams.MessageAttributes =
|
|
41
|
+
messageParams.MessageAttributes = MessageAttributes_1.injectPropagationContext((_a = messageParams.MessageAttributes) !== null && _a !== void 0 ? _a : {});
|
|
64
42
|
});
|
|
65
43
|
}
|
|
66
44
|
break;
|
|
@@ -78,7 +56,7 @@ class SqsServiceExtension {
|
|
|
78
56
|
tracer,
|
|
79
57
|
messageToSpanDetails: (message) => ({
|
|
80
58
|
name: queueName !== null && queueName !== void 0 ? queueName : 'unknown',
|
|
81
|
-
parentContext: api_1.propagation.extract(api_1.ROOT_CONTEXT, message.
|
|
59
|
+
parentContext: api_1.propagation.extract(api_1.ROOT_CONTEXT, MessageAttributes_1.extractPropagationContext(message, config.sqsExtractContextPropagationFromPayload), MessageAttributes_1.contextGetter),
|
|
82
60
|
attributes: {
|
|
83
61
|
[semantic_conventions_1.SemanticAttributes.MESSAGING_SYSTEM]: 'aws.sqs',
|
|
84
62
|
[semantic_conventions_1.SemanticAttributes.MESSAGING_DESTINATION]: queueName,
|
|
@@ -141,16 +119,6 @@ class SqsServiceExtension {
|
|
|
141
119
|
spanName,
|
|
142
120
|
};
|
|
143
121
|
}
|
|
144
|
-
InjectPropagationContext(attributesMap) {
|
|
145
|
-
const attributes = attributesMap !== null && attributesMap !== void 0 ? attributesMap : {};
|
|
146
|
-
if (Object.keys(attributes).length < SQS_MAX_MESSAGE_ATTRIBUTES) {
|
|
147
|
-
api_1.propagation.inject(api_1.context.active(), attributes, sqsContextSetter);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
api_1.diag.warn('aws-sdk instrumentation: cannot set context propagation on SQS message due to maximum amount of MessageAttributes');
|
|
151
|
-
}
|
|
152
|
-
return attributes;
|
|
153
|
-
}
|
|
154
122
|
}
|
|
155
123
|
exports.SqsServiceExtension = SqsServiceExtension;
|
|
156
124
|
//# sourceMappingURL=sqs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqs.js","sourceRoot":"","sources":["../../../src/services/sqs.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,
|
|
1
|
+
{"version":3,"file":"sqs.js","sourceRoot":"","sources":["../../../src/services/sqs.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,4CAQ4B;AAC5B,wEAAqE;AAQrE,8EAG6C;AAC7C,2DAI6B;AAE7B,MAAa,mBAAmB;IAAhC;QA8CE,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,4CAAwB,CAAC,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,iBAAiB,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,CAAC,yCAAkB,CAAC,qBAAqB,CAAC,EAAE,SAAS;YACrD,CAAC,yCAAkB,CAAC,aAAa,CAAC,EAAE,QAAQ;SAC7C,CAAC;QAEF,IAAI,UAAU,GAAG,KAAK,CAAC;QAEvB,QAAQ,OAAO,CAAC,WAAW,EAAE;YAC3B,KAAK,gBAAgB;gBACnB;oBACE,UAAU,GAAG,IAAI,CAAC;oBAClB,QAAQ,GAAG,cAAQ,CAAC,QAAQ,CAAC;oBAC7B,QAAQ,GAAG,GAAG,SAAS,UAAU,CAAC;oBAClC,cAAc,CAAC,yCAAkB,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC;oBAEnE,OAAO,CAAC,YAAY,CAAC,qBAAqB,GAAG,CAC3C,MAAA,OAAO,CAAC,YAAY,CAAC,qBAAqB,mCAAI,EAAE,CACjD,CAAC,MAAM,CAAC,iBAAW,CAAC,MAAM,EAAE,CAAC,CAAC;iBAChC;gBACD,MAAM;YAER,KAAK,aAAa,CAAC;YACnB,KAAK,kBAAkB;gBACrB,QAAQ,GAAG,cAAQ,CAAC,QAAQ,CAAC;gBAC7B,QAAQ,GAAG,GAAG,SAAS,OAAO,CAAC;gBAC/B,MAAM;SACT;QAED,OAAO;YACL,UAAU;YACV,cAAc;YACd,QAAQ;YACR,QAAQ;SACT,CAAC;IACJ,CAAC;CAwFF;AApID,kDAoIC"}
|
package/build/src/types.d.ts
CHANGED
|
@@ -57,5 +57,15 @@ export interface AwsSdkInstrumentationConfig extends InstrumentationConfig {
|
|
|
57
57
|
* effectively causing those http spans to be non-recordable.
|
|
58
58
|
*/
|
|
59
59
|
suppressInternalInstrumentation?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* In some cases the context propagation headers may be found in the message payload
|
|
62
|
+
* rather than the message attribute.
|
|
63
|
+
* When this field is turned on the instrumentation will parse the payload and extract the
|
|
64
|
+
* context from there.
|
|
65
|
+
* Even if the field is on and MessageAttribute contains context propagation field are present,
|
|
66
|
+
* the MessageAttribute will get priority.
|
|
67
|
+
* By default it is off.
|
|
68
|
+
*/
|
|
69
|
+
sqsExtractContextPropagationFromPayload?: boolean;
|
|
60
70
|
}
|
|
61
71
|
//# sourceMappingURL=types.d.ts.map
|
package/build/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.4.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/src/version.js
CHANGED
package/doc/sns.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# SNS
|
|
2
|
+
|
|
3
|
+
SNS is amazon's managed pub/sub system. Thus, it should follow the [OpenTelemetry specification for Messaging systems](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md).
|
|
4
|
+
|
|
5
|
+
## Specific trace semantic
|
|
6
|
+
|
|
7
|
+
The following methods are automatically enhanced:
|
|
8
|
+
|
|
9
|
+
### Publish messages
|
|
10
|
+
|
|
11
|
+
- [Messaging Attributes](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#messaging-attributes) are added by this instrumentation according to the spec.
|
|
12
|
+
- OpenTelemetry trace context is injected as SNS MessageAttributes, so the service receiving the message can link cascading spans to the trace which created the message.
|
|
13
|
+
|
|
14
|
+
### Consumers
|
|
15
|
+
|
|
16
|
+
There are many potential consumers: SQS, Lambda, HTTP/S, Email, SMS, mobile notifications. each one of them will received the propagated context in its own way.
|
|
17
|
+
|
|
18
|
+
## Integration with SQS
|
|
19
|
+
|
|
20
|
+
AWS provide two ways of integrating SNS and SQS, one sends the message "as is" and one being parsed, this is called raw message delivery.
|
|
21
|
+
|
|
22
|
+
When it is turn off (by default) message attributes (sent in SNS) will appear in the payload of SQS, if it turned on the payload will be parsed before sent to SQS and the SNS attributes will be mapped to SQS Message attribute which allow this instrumentation to have propagated context works out-of-the-box.
|
|
23
|
+
|
|
24
|
+
If raw message delivery is turned off, you can solve it by enabling `sqsExtractContextPropagationFromPayload`, it will extract the context from the payload. It does have some performance affect as the instrumentation will run `JSON.parse` to get the data.
|
|
25
|
+
|
|
26
|
+
More details about raw message deliver can be found in [AWS docs](https://docs.aws.amazon.com/sns/latest/dg/sns-large-payload-raw-message-delivery.html)
|
|
27
|
+
|
|
28
|
+
>If you see partial / broken traces when integrating SNS with SQS this might be the reason
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentelemetry/instrumentation-aws-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "OpenTelemetry automatic instrumentation for the `aws-sdk` package",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@opentelemetry/core": "^1.0.0",
|
|
50
|
-
"@opentelemetry/instrumentation": "^0.
|
|
50
|
+
"@opentelemetry/instrumentation": "^0.27.0",
|
|
51
51
|
"@opentelemetry/propagation-utils": "^0.26.0",
|
|
52
52
|
"@opentelemetry/semantic-conventions": "^1.0.0"
|
|
53
53
|
},
|
|
@@ -57,18 +57,20 @@
|
|
|
57
57
|
"@aws-sdk/client-sqs": "3.37.0",
|
|
58
58
|
"@aws-sdk/types": "3.37.0",
|
|
59
59
|
"@opentelemetry/api": "1.0.1",
|
|
60
|
-
"@opentelemetry/contrib-test-utils": "^0.
|
|
61
|
-
"@opentelemetry/sdk-trace-base": "1.0.
|
|
60
|
+
"@opentelemetry/contrib-test-utils": "^0.28.0",
|
|
61
|
+
"@opentelemetry/sdk-trace-base": "1.0.1",
|
|
62
62
|
"@types/mocha": "^8.2.2",
|
|
63
63
|
"@types/node": "^14.0.0",
|
|
64
|
+
"@types/sinon": "^10.0.6",
|
|
64
65
|
"aws-sdk": "2.1008.0",
|
|
65
66
|
"eslint": "^7.32.0",
|
|
66
|
-
"expect": "
|
|
67
|
+
"expect": "27.4.2",
|
|
67
68
|
"gts": "3.1.0",
|
|
68
69
|
"mocha": "7.2.0",
|
|
69
70
|
"nock": "^13.0.11",
|
|
70
71
|
"nyc": "^15.1.0",
|
|
71
72
|
"rimraf": "^3.0.2",
|
|
73
|
+
"sinon": "^12.0.0",
|
|
72
74
|
"test-all-versions": "^5.0.1",
|
|
73
75
|
"ts-mocha": "8.0.0",
|
|
74
76
|
"ts-node": "^9.1.1",
|
|
@@ -77,5 +79,5 @@
|
|
|
77
79
|
"engines": {
|
|
78
80
|
"node": ">=8.5.0"
|
|
79
81
|
},
|
|
80
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "45f84dcd2fe01db242fd0efed293db685b9fd9f3"
|
|
81
83
|
}
|