Skip to content

Commit 586981d

Browse files
committed
Change rpc.*.duration unit from ms to sec, clarify duration in case of streaming
1 parent 1f5ad6b commit 586981d

File tree

5 files changed

+54
-22
lines changed

5 files changed

+54
-22
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
change_type: breaking
2+
component: rpc
3+
note: Change RPC duration metrics from milliseconds to seconds, clarify metric and span duration semantics for streaming.
4+
issues: [383]

docs/rpc/rpc-metrics.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ Below is a list of RPC server metric instruments.
6767

6868
This metric is [recommended][MetricRecommended].
6969

70+
This metric SHOULD be specified with
71+
[`ExplicitBucketBoundaries`](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.50.0/specification/metrics/api.md#instrument-advisory-parameters)
72+
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 ]`.
73+
7074
<!-- semconv metric.rpc.server.duration -->
7175
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
7276
<!-- see templates/registry/markdown/snippet.md.j2 -->
@@ -76,12 +80,10 @@ This metric is [recommended][MetricRecommended].
7680

7781
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
7882
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
79-
| `rpc.server.duration` | Histogram | `ms` | Measures the duration of inbound RPC. [1] | ![Development](https://img.shields.io/badge/-development-blue) | |
80-
81-
**[1]:** While streaming RPCs may record this metric as start-of-batch
82-
to end-of-batch, it's hard to interpret in practice.
83+
| `rpc.server.duration` | Histogram | `s` | Measures the duration of inbound remote procedure calls (RPC). [1] | ![Development](https://img.shields.io/badge/-development-blue) | |
8384

84-
**Streaming**: N/A.
85+
**[1]:** When this metric is reported alongside an RPC server span, the metric value
86+
SHOULD be the same as the RPC server span duration.
8587

8688
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
8789
|---|---|---|---|---|---|
@@ -363,12 +365,15 @@ different processes could be listening on TCP port 12345 and UDP port 12345.
363365
### RPC client
364366

365367
Below is a list of RPC client metric instruments.
366-
These apply to traditional RPC usage, not streaming RPCs.
367368

368369
#### Metric: `rpc.client.duration`
369370

370371
This metric is [recommended][MetricRecommended].
371372

373+
This metric SHOULD be specified with
374+
[`ExplicitBucketBoundaries`](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.50.0/specification/metrics/api.md#instrument-advisory-parameters)
375+
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 ]`.
376+
372377
<!-- semconv metric.rpc.client.duration -->
373378
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
374379
<!-- see templates/registry/markdown/snippet.md.j2 -->
@@ -378,12 +383,10 @@ This metric is [recommended][MetricRecommended].
378383

379384
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
380385
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
381-
| `rpc.client.duration` | Histogram | `ms` | Measures the duration of outbound RPC. [1] | ![Development](https://img.shields.io/badge/-development-blue) | |
382-
383-
**[1]:** While streaming RPCs may record this metric as start-of-batch
384-
to end-of-batch, it's hard to interpret in practice.
386+
| `rpc.client.duration` | Histogram | `s` | Measures the duration of outbound remote procedure calls (RPC). [1] | ![Development](https://img.shields.io/badge/-development-blue) | |
385387

386-
**Streaming**: N/A.
388+
**[1]:** When this metric is reported alongside an RPC client span, the metric value
389+
SHOULD be the same as the RPC client span duration.
387390

388391
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
389392
|---|---|---|---|---|---|

docs/rpc/rpc-spans.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ Generally, a user SHOULD NOT set `peer.service` to a fully qualified RPC service
9797

9898
This span represents an outgoing Remote Procedure Call (RPC).
9999

100+
RPC client spans SHOULD cover the entire client-side lifecycle of an RPC,
101+
starting when the RPC is initiated and ending when the response is received
102+
or the RPC is terminated due to an error or cancellation.
103+
104+
For streaming RPCs, the span covers the full lifetime of the request and/or
105+
response streams until they are closed or terminated.
106+
100107
**Span name:** refer to the [Span Name](/docs/rpc/rpc-spans.md#span-name) section.
101108

102109
**Span kind** MUST be `CLIENT`.
@@ -221,6 +228,13 @@ different processes could be listening on TCP port 12345 and UDP port 12345.
221228

222229
This span represents an incoming Remote Procedure Call (RPC).
223230

231+
RPC server spans SHOULD cover the entire server-side lifecycle of an RPC,
232+
starting when the request is received and ending when the response is sent
233+
or the RPC is terminated due to an error or cancellation.
234+
235+
For streaming RPCs, the span SHOULD cover the full lifetime of the request
236+
and/or response streams until they are closed or terminated.
237+
224238
**Span name:** refer to the [Span Name](/docs/rpc/rpc-spans.md#span-name) section.
225239

226240
**Span kind** MUST be `SERVER`.

model/rpc/metrics.yaml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ groups:
77
code_generation:
88
metric_value_type: double
99
stability: development
10-
brief: Measures the duration of inbound RPC.
10+
brief: Measures the duration of inbound remote procedure calls (RPC).
1111
instrument: histogram
12-
unit: "ms"
12+
unit: "s"
1313
note: |
14-
While streaming RPCs may record this metric as start-of-batch
15-
to end-of-batch, it's hard to interpret in practice.
14+
When this metric is reported alongside an RPC server span, the metric value
15+
SHOULD be the same as the RPC server span duration.
1616
17-
**Streaming**: N/A.
1817
extends: attributes.metrics.rpc.server
1918

2019
- id: metric.rpc.server.request.size
@@ -54,14 +53,12 @@ groups:
5453
code_generation:
5554
metric_value_type: double
5655
stability: development
57-
brief: Measures the duration of outbound RPC.
56+
brief: Measures the duration of outbound remote procedure calls (RPC).
5857
instrument: histogram
59-
unit: "ms"
58+
unit: "s"
6059
note: |
61-
While streaming RPCs may record this metric as start-of-batch
62-
to end-of-batch, it's hard to interpret in practice.
63-
64-
**Streaming**: N/A.
60+
When this metric is reported alongside an RPC client span, the metric value
61+
SHOULD be the same as the RPC client span duration.
6562
extends: attributes.metrics.rpc.client
6663

6764
- id: metric.rpc.client.request.size

model/rpc/spans.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ groups:
44
stability: development
55
brief: This span represents an outgoing Remote Procedure Call (RPC).
66
note: |
7+
RPC client spans SHOULD cover the entire client-side lifecycle of an RPC,
8+
starting when the RPC is initiated and ending when the response is received
9+
or the RPC is terminated due to an error or cancellation.
10+
11+
For streaming RPCs, the span covers the full lifetime of the request and/or
12+
response streams until they are closed or terminated.
13+
714
**Span name:** refer to the [Span Name](/docs/rpc/rpc-spans.md#span-name) section.
815
916
**Span kind** MUST be `CLIENT`.
@@ -22,6 +29,13 @@ groups:
2229
brief: This span represents an incoming Remote Procedure Call (RPC).
2330
events: [rpc.message]
2431
note: |
32+
RPC server spans SHOULD cover the entire server-side lifecycle of an RPC,
33+
starting when the request is received and ending when the response is sent
34+
or the RPC is terminated due to an error or cancellation.
35+
36+
For streaming RPCs, the span SHOULD cover the full lifetime of the request
37+
and/or response streams until they are closed or terminated.
38+
2539
**Span name:** refer to the [Span Name](/docs/rpc/rpc-spans.md#span-name) section.
2640
2741
**Span kind** MUST be `SERVER`.

0 commit comments

Comments
 (0)