Skip to content

Commit 846c978

Browse files
committed
Add a "Process" operation for messaging
1 parent e39dcb5 commit 846c978

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

docs/messaging/messaging-metrics.md

+27
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,33 @@ _Note: The need to report `messaging.deliver.messages` depends on the messaging
179179
| `messaging.deliver.messages` | Counter | `{message}` | Measures the number of delivered messages. |
180180
<!-- endsemconv -->
181181

182+
### Metric: `messaging.process.duration`
183+
184+
This metric is [recommended][MetricRecommended] for processing operations that are initiated by application code.
185+
186+
When this metric is reported alongside a messaging process span, the metric value SHOULD be the same as the corresponding span duration.
187+
188+
This metric SHOULD be specified with
189+
[`ExplicitBucketBoundaries`](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.26.0/specification/metrics/api.md#instrument-advice)
190+
of `[ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ]`.
191+
192+
<!-- semconv metric.messaging.process.duration(metric_table) -->
193+
| Name | Instrument Type | Unit (UCUM) | Description |
194+
| -------- | --------------- | ----------- | -------------- |
195+
| `messaging.process.duration` | Histogram | `s` | Measures the duration of process operation. |
196+
<!-- endsemconv -->
197+
198+
### Metric: `messaging.process.messages`
199+
200+
This metric is [recommended][MetricRecommended] for batch process operations.
201+
202+
<!-- semconv metric.messaging.process.messages(metric_table) -->
203+
| Name | Instrument Type | Unit (UCUM) | Description |
204+
| -------- | --------------- | ----------- | -------------- |
205+
| `messaging.process.messages` | Counter | `{message}` | Measures the number of processed messages. |
206+
<!-- endsemconv -->
207+
182208
[DocumentStatus]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/document-status.md
183209
[MetricRequired]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/metrics/metric-requirement-level.md#required
210+
[MetricRequired]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/metrics/metric-requirement-level.md#recommended
184211
[MetricOptIn]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/metrics/metric-requirement-level.md#opt-in

docs/messaging/messaging-spans.md

+6
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ The following operations related to messages are defined for these semantic conv
207207
| `create` | A message is created. "Create" spans always refer to a single message and are used to provide a unique creation context for messages in batch publishing scenarios. |
208208
| `receive` | One or more messages are requested by a consumer. This operation refers to pull-based scenarios, where consumers explicitly call methods of messaging SDKs to receive messages. |
209209
| `deliver` | One or more messages are passed to a consumer. This operation refers to push-based scenarios, where consumer register callbacks which get called by messaging SDKs. |
210+
| `process` | One or more messages are processed by consumer. |
210211
| `settle` | One or more messages are settled. |
211212

212213
### Span kind
@@ -271,6 +272,11 @@ batch of messages, or for no message at all (if it is signalled that no
271272
messages were received). For each message it accounts for, the "Deliver" or
272273
"Receive" span SHOULD link to the message's creation context.
273274

275+
"Process" spans MAY be created in addition to "Deliver" and "Receive" spans,
276+
for operations of processing a single message or a batch of messages. For each
277+
message it accounts for, the "Process" span MAY link to the creation context of
278+
the message.
279+
274280
"Settle" spans SHOULD be created for every manually or automatically triggered
275281
settlement operation. A single "Settle" span can account for a single message
276282
or for multiple messages (in case messages are passed for settling as batches).

model/metrics/messaging.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ groups:
3636
unit: "s"
3737
extends: metric.messaging.attributes
3838

39+
- id: metric.messaging.process.duration
40+
type: metric
41+
metric_name: messaging.process.duration
42+
brief: "Measures the duration of process operation."
43+
instrument: histogram
44+
unit: "s"
45+
extends: metric.messaging.attributes
46+
3947
# counters
4048
- id: metric.messaging.publish.messages
4149
type: metric
@@ -60,3 +68,11 @@ groups:
6068
instrument: counter
6169
unit: "{message}"
6270
extends: metric.messaging.attributes
71+
72+
- id: metric.messaging.process.messages
73+
type: metric
74+
metric_name: messaging.process.messages
75+
brief: "Measures the number of processed messages."
76+
instrument: counter
77+
unit: "{message}"
78+
extends: metric.messaging.attributes

0 commit comments

Comments
 (0)