You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 31, 2024. It is now read-only.
|"aws.operation"| string | The method name for the request. | for `SQS.sendMessage(...)` the operation is "sendMessage" |
47
-
|"aws.signature.version"| string |Aws version of authentication signature on the request. | "v4" |
48
-
|"aws.region"| string | Region name for the request | "eu-west-1" |
49
-
|"aws.service.api"| string | The sdk class name for the service | "SQS" |
50
-
|"aws.service.identifier"| string | Identifier for the service in the sdk | "sqs" |
51
-
|"aws.service.name"| string | Abbreviation name for the service | "Amazon SQS" |
52
-
|"aws.request.id"| uuid | Request unique id, as returned from aws on response | "01234567-89ab-cdef-0123-456789abcdef" |
53
-
|"aws.error"| string | information about a service or networking error, as returned from aws| "UriParameterError: Expected uri parameter to have length >= 1, but found "" for params.Bucket" |
|`aws.operation`| string | The method name for the request. | for `SQS.sendMessage(...)` the operation is "sendMessage" |
48
+
|`aws.signature.version`| string |AWS version of authentication signature on the request. | "v4" |
49
+
|`aws.region`| string | Region name for the request | "eu-west-1" |
50
+
|`aws.service.api`| string | The sdk class name for the service | "SQS" |
51
+
|`aws.service.identifier`| string | Identifier for the service in the sdk | "sqs" |
52
+
|`aws.service.name`| string | Abbreviation name for the service | "Amazon SQS" |
53
+
|`aws.request.id`| uuid | Request unique id, as returned from aws on response | "01234567-89ab-cdef-0123-456789abcdef" |
54
+
|`aws.error`| string | information about a service or networking error, as returned from AWS| "UriParameterError: Expected uri parameter to have length >= 1, but found "" for params.Bucket" |
54
55
55
56
### Custom User Attributes
56
-
The plugin user can configure a hook function which will be called before each request, with the request object and the relevant span. This hook can be used to add custom attributes to the span with any logic. For example, user can add interesting attributes from the `request.params`, and write custom logic based on the service and operation.
57
+
The plugin user can configure a `preRequestHook` function which will be called before each request, with the request object and the corrosponding span.
58
+
This hook can be used to add custom attributes to the span with any logic.
59
+
For example, user can add interesting attributes from the `request.params`, and write custom logic based on the service and operation.
AWS contains dozens of services accessible with the JS SDK. For many services, the default attributes specified above are enough, but other services have specific [trace semantic conventions](https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/trace/semantic_conventions), or need to inject/extract intra-process context, or set intra-process context correctly.
60
75
76
+
Specific service logic currently implemented for:
77
+
*[SQS](./docs/sqs.md)
78
+
79
+
---
80
+
61
81
This plugin 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.
Copy file name to clipboardExpand all lines: packages/plugin-aws-sdk/docs/sqs.md
+18-11Lines changed: 18 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,22 +2,29 @@
2
2
SQS is amazon's managed message queue. Thus, it should follow the [Open Telemetry specification for Messaging systems](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md).
3
3
4
4
## Specific trace semantic
5
-
Following methods needs specific attention:
5
+
The following methods are automatically enhanced:
6
6
7
7
### sendMessage / sendMessageBatch
8
-
-Add [message attributes](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#messaging-attributes)to span in addition to the default attributes. These attributes are covered by the library according to the spec.
9
-
- Inject trace context as SQS MessageAttributes, so the service receiving the message can link cascading spans to the trace which created the message. This is not implemented yet.
8
+
-[Message Attributes](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#messaging-attributes) are added by this plugin according to the spec.
9
+
-TODO: Inject trace context as SQS MessageAttributes, so the service receiving the message can link cascading spans to the trace which created the message.
10
10
11
11
### receiveMessage
12
-
- Add [message attributes](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#messaging-attributes) to span in addition to the default attributes. These attributes are covered by the library according to the spec.
13
-
- Create additional "processing spans" for each message received by the application. So if an application called `receiveMessage`, and got back 10 messages, a single `messaging.operation` = `receive` span will be created for the `receiveMessage` operation, and 10 `messaging.operation` = `process` spans will be created, one for each message. Those processing spans are created by the library. This behavior is partially implemented, [See discussion below](#processing-spans).
14
-
- Set the inter process context correctly, so that additional spans created from message receiving and message processing will be linked to parent spans correctly. This behavior is partially implemented, [See discussion below](#processing-spans).
15
-
- Extract trace context from SQS MessageAttributes, and set span's `parent` and `links` correctly according to the spec. This is not implemented yet.
12
+
-[Message Attributes](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#messaging-attributes) are added by this plugin according to the spec.
13
+
- Additional "processing spans" are created for each message received by the application.
14
+
If an application invoked `receiveMessage`, and received a 10 messages batch, a single `messaging.operation` = `receive` span will be created for the `receiveMessage` operation, and 10 `messaging.operation` = `process` spans will be created, one for each message.
15
+
Those processing spans are created by the library. This behavior is partially implemented, [See discussion below](#processing-spans).
16
+
- Sets the inter process context correctly, so that additional spans created through the process will be linked to parent spans correctly.
17
+
This behavior is partially implemented, [See discussion below](#processing-spans).
18
+
- TODO: Extract trace context from SQS MessageAttributes, and set span's `parent` and `links` correctly according to the spec.
16
19
17
-
#### Processing spans
18
-
According to open telemetry specification (and to reasonable expectation for trace structure), user of this library would expect to see one span for the operation of receiving messages batch from sqs, and then, for each message, a span with it's own sub-tree for the processing of this specific message.
20
+
#### Processing Spans
21
+
According to open telemetry specification (and to reasonable expectation for trace structure), user of this library would expect to see one span for the operation of receiving messages batch from SQS, and then, for each message, a span with it's own sub-tree for the processing of this specific message.
19
22
20
-
For example, if a `receiveMessages` returned 2 messages: msg1 is storing something to a DB, and msg2 is calling an external http endpoint, we should link the db span under msg1, and the http span under msg2, instead of mixing all those operations under the single `receive` span, or start a new trace for each of them.
23
+
For example, if a `receiveMessages` returned 2 messages:
24
+
*`msg1` resulting in storing something to a DB.
25
+
*`msg2` resulting in calling an external HTTP endpoint.
26
+
27
+
This will result in a creating a DB span that would be linked under `msg1` process, and an HTTP span that would be under `msg2` (in opposed to mixing all those operations under the single `receive` span, or start a new trace for each of them).
21
28
22
29
Unfortunately, this is not so easy to implement in JS:
23
30
1. The SDK is calling a single callback for the messages batch, and it's not straight forward to understand when each individual message processing starts and ends (and set the context correctly for cascading spans).
@@ -36,4 +43,4 @@ async function poll() {
36
43
}
37
44
```
38
45
39
-
Current implementation partially solves this issue by patching the `map` \ `forEach` functions on the `Messages` array of `receiveMessage` result. This handles issues like the one above, but will not handle situations where the processing is done in other patterns (multiple map\forEach calls, index access to the array, other array operations, etc). This is currently an open issue in the plugin.
46
+
Current implementation partially solves this issue by patching the `map` \ `forEach` functions on the `Messages` array of `receiveMessage` result. This handles issues like the one above, but will not handle situations where the processing is done in other patterns (multiple map\forEach calls, index access to the array, other array operations, etc). This is currently an open issue in the plugin.
0 commit comments