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
|`producerHook`|`KafkaProducerCustomAttributeFunction`| Function called before a producer message is sent. Allows for adding custom attributes to the span.|
48
-
|`consumerHook`|`KafkaConsumerCustomAttributeFunction`| Function called before a consumer message is processed. Allows for adding custom attributes to the span.|
|`producerHook`|`KafkaProducerCustomAttributeFunction`| Function called before a producer message is sent. Allows for adding custom attributes to the span. |
50
+
|`consumerHook`|`KafkaConsumerCustomAttributeFunction`| Function called before a consumer message is processed. Allows for adding custom attributes to the span. |
49
51
50
52
## Semantic Conventions
51
53
52
-
This package uses `@opentelemetry/semantic-conventions` version `1.24+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md)
54
+
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)
**[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 |
| 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.
|`messaging.system`| An identifier for the messaging system being used (i.e. `"kafka"`). |
84
+
|`messaging.destination.name`| The message destination name. |
85
+
|`messaging.operation.type`| A string identifying the type of messaging operation. |
86
+
|`messaging.operation.name`| The system-specific name of the messaging operation. |
87
+
|`messaging.operation.name`| The system-specific name of the messaging operation. |
88
+
|`messaging.kafka.message.key`| A stringified value representing the key of the Kafka message (if present). |
89
+
|`messaging.kafka.message.tombstone`| A boolean that is true if the message is a tombstone. |
90
+
|`messaging.kafka.offset`| The offset of a record in the corresponding Kafka partition. |
91
+
|`messaging.destination.partition.id`| The identifier of the partition messages are sent to or received from, unique within the `messaging.destination.name`. **Note:** only available on producer spans. |
0 commit comments