Skip to content

Commit 494eb91

Browse files
authored
Rename rpc.client|server.duration to rpc.client|server.call.duratio, change unit from ms to sec, clarify duration in case of streaming (#2961)
1 parent 717831e commit 494eb91

File tree

9 files changed

+128
-48
lines changed

9 files changed

+128
-48
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
change_type: breaking
2+
component: rpc
3+
note: Rename `rpc.client|server.duration` to `rpc.client|server.call.duration`,
4+
change RPC duration metrics from milliseconds to seconds,
5+
and clarify metric and span duration semantics for streaming.
6+
issues: [383, 2961]

docs/rpc/connect-rpc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ described on this page.
1212

1313
## Client Span
1414

15-
<!-- semconv span.rpc.connect_rpc.client -->
15+
<!-- semconv span.rpc.connect_rpc.call.client -->
1616
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
1717
<!-- see templates/registry/markdown/snippet.md.j2 -->
1818
<!-- prettier-ignore-start -->
@@ -148,7 +148,7 @@ the `rpc.connect_rpc.response.metadata.my-custom-key` attribute with value `["at
148148

149149
## Server Span
150150

151-
<!-- semconv span.rpc.connect_rpc.server -->
151+
<!-- semconv span.rpc.connect_rpc.call.server -->
152152
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
153153
<!-- see templates/registry/markdown/snippet.md.j2 -->
154154
<!-- prettier-ignore-start -->

docs/rpc/grpc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ described on this page.
1212

1313
## Client Span
1414

15-
<!-- semconv span.rpc.grpc.client -->
15+
<!-- semconv span.rpc.grpc.call.client -->
1616
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
1717
<!-- see templates/registry/markdown/snippet.md.j2 -->
1818
<!-- prettier-ignore-start -->
@@ -149,7 +149,7 @@ the `rpc.grpc.response.metadata.my-custom-key` attribute with value `["attribute
149149

150150
## Server Span
151151

152-
<!-- semconv span.rpc.grpc.server -->
152+
<!-- semconv span.rpc.grpc.call.server -->
153153
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
154154
<!-- see templates/registry/markdown/snippet.md.j2 -->
155155
<!-- prettier-ignore-start -->

docs/rpc/json-rpc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ described on this page.
1212

1313
## Client Span
1414

15-
<!-- semconv span.rpc.jsonrpc.client -->
15+
<!-- semconv span.rpc.jsonrpc.call.client -->
1616
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
1717
<!-- see templates/registry/markdown/snippet.md.j2 -->
1818
<!-- prettier-ignore-start -->
@@ -111,7 +111,7 @@ different processes could be listening on TCP port 12345 and UDP port 12345.
111111

112112
## Server Span
113113

114-
<!-- semconv span.rpc.jsonrpc.server -->
114+
<!-- semconv span.rpc.jsonrpc.call.server -->
115115
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
116116
<!-- see templates/registry/markdown/snippet.md.j2 -->
117117
<!-- prettier-ignore-start -->

docs/rpc/rpc-metrics.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ metrics can be filtered for finer grain analysis.
1616

1717
- [Metric instruments](#metric-instruments)
1818
- [RPC server](#rpc-server)
19-
- [Metric: `rpc.server.duration`](#metric-rpcserverduration)
19+
- [Metric: `rpc.server.call.duration`](#metric-rpcservercallduration)
2020
- [Metric: `rpc.server.request.size`](#metric-rpcserverrequestsize)
2121
- [Metric: `rpc.server.response.size`](#metric-rpcserverresponsesize)
2222
- [RPC client](#rpc-client)
23-
- [Metric: `rpc.client.duration`](#metric-rpcclientduration)
23+
- [Metric: `rpc.client.call.duration`](#metric-rpcclientcallduration)
2424
- [Metric: `rpc.client.request.size`](#metric-rpcclientrequestsize)
2525
- [Metric: `rpc.client.response.size`](#metric-rpcclientresponsesize)
2626
- [Semantic Conventions for specific RPC technologies](#semantic-conventions-for-specific-rpc-technologies)
@@ -63,23 +63,25 @@ MUST be of the specified type and units.
6363

6464
Below is a list of RPC server metric instruments.
6565

66-
#### Metric: `rpc.server.duration`
66+
#### Metric: `rpc.server.call.duration`
6767

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

70-
<!-- semconv metric.rpc.server.duration -->
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+
74+
<!-- semconv metric.rpc.server.call.duration -->
7175
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
7276
<!-- see templates/registry/markdown/snippet.md.j2 -->
7377
<!-- prettier-ignore-start -->
7478

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

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

8486
**Attributes:**
8587

@@ -360,25 +362,26 @@ different processes could be listening on TCP port 12345 and UDP port 12345.
360362
### RPC client
361363

362364
Below is a list of RPC client metric instruments.
363-
These apply to traditional RPC usage, not streaming RPCs.
364365

365-
#### Metric: `rpc.client.duration`
366+
#### Metric: `rpc.client.call.duration`
366367

367368
This metric is [recommended][MetricRecommended].
368369

369-
<!-- semconv metric.rpc.client.duration -->
370+
This metric SHOULD be specified with
371+
[`ExplicitBucketBoundaries`](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.50.0/specification/metrics/api.md#instrument-advisory-parameters)
372+
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 ]`.
373+
374+
<!-- semconv metric.rpc.client.call.duration -->
370375
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
371376
<!-- see templates/registry/markdown/snippet.md.j2 -->
372377
<!-- prettier-ignore-start -->
373378

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

381-
**Streaming**: N/A.
383+
**[1]:** When this metric is reported alongside an RPC client span, the metric value
384+
SHOULD be the same as the RPC client span duration.
382385

383386
**Attributes:**
384387

docs/rpc/rpc-spans.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Generally, a user SHOULD NOT set `peer.service` to a fully qualified RPC service
8686

8787
### RPC client span
8888

89-
<!-- semconv span.rpc.client -->
89+
<!-- semconv span.rpc.call.client -->
9090
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
9191
<!-- see templates/registry/markdown/snippet.md.j2 -->
9292
<!-- prettier-ignore-start -->
@@ -95,6 +95,16 @@ Generally, a user SHOULD NOT set `peer.service` to a fully qualified RPC service
9595

9696
This span represents an outgoing Remote Procedure Call (RPC).
9797

98+
RPC client spans SHOULD cover the entire client-side lifecycle of an RPC,
99+
starting when the RPC is initiated and ending when the response is received
100+
or the RPC is terminated due to an error or cancellation.
101+
102+
For streaming RPCs, the span covers the full lifetime of the request and/or
103+
response streams until they are closed or terminated.
104+
105+
If a transient issue happened and was retried within this RPC, the corresponding
106+
span SHOULD cover the duration of the logical call with all retries.
107+
98108
**Span name:** refer to the [Span Name](/docs/rpc/rpc-spans.md#span-name) section.
99109

100110
**Span kind** MUST be `CLIENT`.
@@ -197,7 +207,7 @@ different processes could be listening on TCP port 12345 and UDP port 12345.
197207

198208
### RPC server span
199209

200-
<!-- semconv span.rpc.server -->
210+
<!-- semconv span.rpc.call.server -->
201211
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
202212
<!-- see templates/registry/markdown/snippet.md.j2 -->
203213
<!-- prettier-ignore-start -->
@@ -206,6 +216,13 @@ different processes could be listening on TCP port 12345 and UDP port 12345.
206216

207217
This span represents an incoming Remote Procedure Call (RPC).
208218

219+
RPC server spans SHOULD cover the entire server-side lifecycle of an RPC,
220+
starting when the request is received and ending when the response is sent
221+
or the RPC is terminated due to an error or cancellation.
222+
223+
For streaming RPCs, the span SHOULD cover the full lifetime of the request
224+
and/or response streams until they are closed or terminated.
225+
209226
**Span name:** refer to the [Span Name](/docs/rpc/rpc-spans.md#span-name) section.
210227

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

model/rpc/deprecated/metrics-deprecated.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,43 @@ groups:
7474
deprecated:
7575
reason: obsoleted
7676
note: Removed, no replacement at this time.
77+
78+
- id: metric.rpc.server.duration
79+
type: metric
80+
metric_name: rpc.server.duration
81+
annotations:
82+
code_generation:
83+
metric_value_type: double
84+
stability: development
85+
instrument: histogram
86+
unit: "ms"
87+
note: |
88+
While streaming RPCs may record this metric as start-of-batch
89+
to end-of-batch, it's hard to interpret in practice.
90+
91+
**Streaming**: N/A.
92+
extends: attributes.metrics.rpc.server
93+
deprecated:
94+
reason: uncategorized
95+
note: Replaced by `rpc.server.call.duration` with unit `s`.
96+
brief: "Deprecated, use `rpc.server.call.duration` instead. Note: the unit also changed from `ms` to `s`."
97+
98+
- id: metric.rpc.client.duration
99+
type: metric
100+
metric_name: rpc.client.duration
101+
annotations:
102+
code_generation:
103+
metric_value_type: double
104+
stability: development
105+
instrument: histogram
106+
unit: "ms"
107+
note: |
108+
While streaming RPCs may record this metric as start-of-batch
109+
to end-of-batch, it's hard to interpret in practice.
110+
111+
**Streaming**: N/A.
112+
extends: attributes.metrics.rpc.client
113+
deprecated:
114+
reason: uncategorized
115+
note: Replaced by `rpc.client.call.duration` with unit `s`.
116+
brief: "Deprecated, use `rpc.client.call.duration` instead. Note: the unit also changed from `ms` to `s`."

model/rpc/metrics.yaml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
groups:
22
# RPC Server metrics
3-
- id: metric.rpc.server.duration
3+
- id: metric.rpc.server.call.duration
44
type: metric
5-
metric_name: rpc.server.duration
5+
metric_name: rpc.server.call.duration
66
annotations:
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
@@ -47,21 +46,19 @@ groups:
4746

4847

4948
# RPC Client metrics
50-
- id: metric.rpc.client.duration
49+
- id: metric.rpc.client.call.duration
5150
type: metric
52-
metric_name: rpc.client.duration
51+
metric_name: rpc.client.call.duration
5352
annotations:
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: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
groups:
2-
- id: span.rpc.client
2+
- id: span.rpc.call.client
33
type: span
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+
14+
If a transient issue happened and was retried within this RPC, the corresponding
15+
span SHOULD cover the duration of the logical call with all retries.
16+
717
**Span name:** refer to the [Span Name](/docs/rpc/rpc-spans.md#span-name) section.
818
919
**Span kind** MUST be `CLIENT`.
@@ -14,22 +24,29 @@ groups:
1424
- ref: rpc.system
1525
requirement_level: required
1626

17-
- id: span.rpc.server
27+
- id: span.rpc.call.server
1828
type: span
1929
stability: development
2030
extends: rpc_service.server
2131
span_kind: server
2232
brief: This span represents an incoming Remote Procedure Call (RPC).
2333
events: [rpc.message]
2434
note: |
35+
RPC server spans SHOULD cover the entire server-side lifecycle of an RPC,
36+
starting when the request is received and ending when the response is sent
37+
or the RPC is terminated due to an error or cancellation.
38+
39+
For streaming RPCs, the span SHOULD cover the full lifetime of the request
40+
and/or response streams until they are closed or terminated.
41+
2542
**Span name:** refer to the [Span Name](/docs/rpc/rpc-spans.md#span-name) section.
2643
2744
**Span kind** MUST be `SERVER`.
2845
attributes:
2946
- ref: rpc.system
3047
requirement_level: required
3148

32-
- id: span.rpc.connect_rpc.client
49+
- id: span.rpc.connect_rpc.call.client
3350
type: span
3451
stability: development
3552
brief: This span represents an outgoing Remote Procedure Call (RPC).
@@ -50,7 +67,7 @@ groups:
5067
- ref: rpc.connect_rpc.response.metadata
5168
requirement_level: opt_in
5269

53-
- id: span.rpc.connect_rpc.server
70+
- id: span.rpc.connect_rpc.call.server
5471
type: span
5572
stability: development
5673
extends: rpc_service.server
@@ -71,7 +88,7 @@ groups:
7188
- ref: rpc.connect_rpc.response.metadata
7289
requirement_level: opt_in
7390

74-
- id: span.rpc.grpc.client
91+
- id: span.rpc.grpc.call.client
7592
type: span
7693
stability: development
7794
brief: This span represents an outgoing Remote Procedure Call (RPC).
@@ -97,7 +114,7 @@ groups:
97114
- ref: rpc.grpc.response.metadata
98115
requirement_level: opt_in
99116

100-
- id: span.rpc.grpc.server
117+
- id: span.rpc.grpc.call.server
101118
type: span
102119
stability: development
103120
extends: rpc_service.server
@@ -119,7 +136,7 @@ groups:
119136
- ref: rpc.grpc.response.metadata
120137
requirement_level: opt_in
121138

122-
- id: span.rpc.jsonrpc.client
139+
- id: span.rpc.jsonrpc.call.client
123140
type: span
124141
stability: development
125142
brief: This span represents an outgoing Remote Procedure Call (RPC).
@@ -145,7 +162,7 @@ groups:
145162
- ref: rpc.jsonrpc.error_message
146163
requirement_level: recommended
147164

148-
- id: span.rpc.jsonrpc.server
165+
- id: span.rpc.jsonrpc.call.server
149166
type: span
150167
stability: development
151168
extends: rpc.server

0 commit comments

Comments
 (0)