diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a602e64fee..b80e5863765 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,8 @@ release. - Remove `direction` dimension, instead creating metrics with names reflecting those dimensions. ([#2617](https://github.com/open-telemetry/opentelemetry-specification/pull/2617)) +- Add `rpc.grpc.status_code` to RPC metric semantic conventions + ([#2604](https://github.com/open-telemetry/opentelemetry-specification/pull/2604)). ### Compatibility diff --git a/specification/metrics/semantic_conventions/rpc.md b/specification/metrics/semantic_conventions/rpc.md index 28e84218f3e..486f453aed2 100644 --- a/specification/metrics/semantic_conventions/rpc.md +++ b/specification/metrics/semantic_conventions/rpc.md @@ -7,9 +7,10 @@ linkTitle: RPC **Status**: [Experimental](../../document-status.md) The conventions described in this section are RPC specific. When RPC operations -occur, metric events about those operations will be generated and reported to -provide insight into those operations. By adding RPC properties as attributes -on metric events it allows for finely tuned filtering. +occur, measurements about those operations are recorded to instruments. The +measurements are aggregated and exported as metrics, which provide insight into +those operations. By including RPC properties as attributes on measurements, the +metrics can be filtered for finer grain analysis. @@ -21,6 +22,7 @@ on metric events it allows for finely tuned filtering. - [Attributes](#attributes) * [Service name](#service-name) - [gRPC conventions](#grpc-conventions) + * [gRPC Attributes](#grpc-attributes) @@ -58,8 +60,8 @@ RPC usage, not streaming RPCs. ## Attributes -Below is a table of attributes that SHOULD be included on metric events and whether -or not they should be on the server, client or both. +Below is a table of attributes that SHOULD be included on client and server RPC +measurements. | Attribute | Type | Description | Examples | Requirement Level | @@ -116,4 +118,36 @@ For remote procedure calls via [gRPC][], additional conventions are described in `rpc.system` MUST be set to `"grpc"`. +### gRPC Attributes + +Below is a table of attributes that SHOULD be included on client and server RPC measurements when `rpc.system` is `"grpc"`. + + +| Attribute | Type | Description | Examples | Requirement Level | +|---|---|---|---|---| +| [`rpc.grpc.status_code`](../../trace/semantic_conventions/rpc.md) | int | The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. | `0` | Required | + +`rpc.grpc.status_code` MUST be one of the following: + +| Value | Description | +|---|---| +| `0` | OK | +| `1` | CANCELLED | +| `2` | UNKNOWN | +| `3` | INVALID_ARGUMENT | +| `4` | DEADLINE_EXCEEDED | +| `5` | NOT_FOUND | +| `6` | ALREADY_EXISTS | +| `7` | PERMISSION_DENIED | +| `8` | RESOURCE_EXHAUSTED | +| `9` | FAILED_PRECONDITION | +| `10` | ABORTED | +| `11` | OUT_OF_RANGE | +| `12` | UNIMPLEMENTED | +| `13` | INTERNAL | +| `14` | UNAVAILABLE | +| `15` | DATA_LOSS | +| `16` | UNAUTHENTICATED | + + [gRPC]: https://grpc.io/