Skip to content

Commit 45047b4

Browse files
committed
feat(instrumentation-kafkajs): add metrics from messaging semantic conventions
1 parent 996a607 commit 45047b4

File tree

5 files changed

+681
-83
lines changed

5 files changed

+681
-83
lines changed

plugins/node/instrumentation-kafkajs/README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,30 @@ You can set the following:
5353

5454
This package uses `@opentelemetry/semantic-conventions` version `1.30+`, which implements Semantic Convention [Version 1.30.0](https://github.com/open-telemetry/semantic-conventions/blob/v1.30.0/docs/README.md)
5555

56-
Attributes collected:
56+
### Spans Emitted
57+
58+
| KafkaJS Object | Action | Span Kind | Span Name | Operation Type / Name |
59+
| -------------- | -------------------------- | --------- | -------------------------- | --------------------- |
60+
| Consumer | `eachBatch` | Client | `poll <topic-name>` | `receive` / `poll` |
61+
| Consumer | `eachBatch`, `eachMessage` | Consumer | `process <topic-name>` [1] | `process` / `process` |
62+
| Producer | `send` | Producer | `send <topic-name>` | `send` / `send` |
63+
64+
**[1] `process <topic-name>`:** In the context of `eachBatch`, this span will be emitted for each message in the batch but the timing (start, end, duration) will reflect the timing of the batch.
65+
66+
### Metrics Emitted
67+
68+
| KafkaJS Object | Metric Name | Short Description |
69+
| --------------------- | ------------------------------------- | ------------------------------------------------------------ |
70+
| Consumer | `messaging.process.duration` | Duration of processing operation. [1] |
71+
| Consumer | `messaging.client.consumed.messages` | Number of messages that were delivered to the application. |
72+
| Consumer and Producer | `messaging.client.operation.duration` | Number of messages that were delivered to the application. |
73+
| Producer | `messaging.client.sent.messages` | Number of messages producer attempted to send to the broker. |
74+
75+
**[1] `messaging.process.duration`:** In the context of `eachBatch`, this metric will be emitted once for each message but the value reflects the duration of the entire batch.
76+
77+
### Attributes Collected
78+
79+
These attributes are added to both spans and metrics, where possible.
5780

5881
| Attribute | Short Description |
5982
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

0 commit comments

Comments
 (0)