<!--- Hugo front matter used to generate the website version of this page:
--->

<!-- NOTE: THIS FILE IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/attribute_namespace.md.j2 -->

# RPC

- [Rpc](#rpc-attributes)
- [Rpc Deprecated](#rpc-deprecated-attributes)

## RPC Attributes

This document defines attributes for remote procedure calls.

| Attribute                                 | Type     | Description                                                                                                                                                                                                                                                        | Examples                                                                        | Stability                                                        |
| ----------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| `rpc.connect_rpc.error_code`              | string   | The [error codes](https://connect.build/docs/protocol/#error-codes) of the Connect request. Error codes are always string values.                                                                                                                                  | `cancelled`; `unknown`; `invalid_argument`                                      | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.connect_rpc.request.metadata.<key>`  | string[] | Connect request metadata, `<key>` being the normalized Connect Metadata key (lowercase), the value being the metadata values. [1]                                                                                                                                  | `rpc.request.metadata.my-custom-metadata-attribute=["1.2.3.4", "1.2.3.5"]`      | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.connect_rpc.response.metadata.<key>` | string[] | Connect response metadata, `<key>` being the normalized Connect Metadata key (lowercase), the value being the metadata values. [2]                                                                                                                                 | `rpc.response.metadata.my-custom-metadata-attribute=["attribute_value"]`        | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.grpc.request.metadata.<key>`         | string[] | gRPC request metadata, `<key>` being the normalized gRPC Metadata key (lowercase), the value being the metadata values. [3]                                                                                                                                        | `rpc.grpc.request.metadata.my-custom-metadata-attribute=["1.2.3.4", "1.2.3.5"]` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.grpc.response.metadata.<key>`        | string[] | gRPC response metadata, `<key>` being the normalized gRPC Metadata key (lowercase), the value being the metadata values. [4]                                                                                                                                       | `rpc.grpc.response.metadata.my-custom-metadata-attribute=["attribute_value"]`   | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.grpc.status_code`                    | int      | The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request.                                                                                                                                                       | `0`; `1`; `2`                                                                   | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.jsonrpc.error_code`                  | int      | `error.code` property of response if it is an error response.                                                                                                                                                                                                      | `-32700`; `100`                                                                 | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.jsonrpc.error_message`               | string   | `error.message` property of response if it is an error response.                                                                                                                                                                                                   | `Parse error`; `User already exists`                                            | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.jsonrpc.request_id`                  | string   | `id` property of request or response. Since protocol allows id to be int, string, `null` or missing (for notifications), value is expected to be cast to string for simplicity. Use empty string in case of `null` value. Omit entirely if this is a notification. | `10`; `request-7`; ``                                                           | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.jsonrpc.version`                     | string   | Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 doesn't specify this, the value can be omitted.                                                                                                                                  | `2.0`; `1.0`                                                                    | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.message.compressed_size`             | int      | Compressed size of the message in bytes.                                                                                                                                                                                                                           |                                                                                 | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.message.id`                          | int      | MUST be calculated as two different counters starting from `1` one for sent messages and one for received message. [5]                                                                                                                                             |                                                                                 | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.message.type`                        | string   | Whether this is a received or sent message.                                                                                                                                                                                                                        | `SENT`; `RECEIVED`                                                              | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.message.uncompressed_size`           | int      | Uncompressed size of the message in bytes.                                                                                                                                                                                                                         |                                                                                 | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.method`                              | string   | The name of the (logical) method being called, must be equal to the $method part in the span name. [6]                                                                                                                                                             | `exampleMethod`                                                                 | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.service`                             | string   | The full (logical) name of the service being called, including its package name, if applicable. [7]                                                                                                                                                                | `myservice.EchoService`                                                         | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `rpc.system`                              | string   | A string identifying the remoting system. See below for a list of well-known identifiers.                                                                                                                                                                          | `grpc`; `java_rmi`; `dotnet_wcf`                                                | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

**[1]:** Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured. Including all request metadata values can be a security risk - explicit configuration helps avoid leaking sensitive information.

**[2]:** Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured. Including all response metadata values can be a security risk - explicit configuration helps avoid leaking sensitive information.

**[3]:** Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured. Including all request metadata values can be a security risk - explicit configuration helps avoid leaking sensitive information.

**[4]:** Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured. Including all response metadata values can be a security risk - explicit configuration helps avoid leaking sensitive information.

**[5]:** This way we guarantee that the values will be consistent between different implementations.

**[6]:** This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side).

**[7]:** This is the logical name of the service from the RPC interface perspective, which can be different from the name of any implementing class. The `code.namespace` attribute may be used to store the latter (despite the attribute name, it may include a class name; e.g., class with method actually executing the call on the server side, RPC client stub class on the client side).

`rpc.connect_rpc.error_code` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value                 | Description         | Stability                                                        |
| --------------------- | ------------------- | ---------------------------------------------------------------- |
| `aborted`             | aborted             | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `already_exists`      | already_exists      | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `cancelled`           | cancelled           | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `data_loss`           | data_loss           | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `deadline_exceeded`   | deadline_exceeded   | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `failed_precondition` | failed_precondition | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `internal`            | internal            | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `invalid_argument`    | invalid_argument    | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `not_found`           | not_found           | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `out_of_range`        | out_of_range        | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `permission_denied`   | permission_denied   | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `resource_exhausted`  | resource_exhausted  | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `unauthenticated`     | unauthenticated     | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `unavailable`         | unavailable         | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `unimplemented`       | unimplemented       | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `unknown`             | unknown             | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

`rpc.grpc.status_code` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description         | Stability                                                        |
| ----- | ------------------- | ---------------------------------------------------------------- |
| `0`   | OK                  | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `1`   | CANCELLED           | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `2`   | UNKNOWN             | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `3`   | INVALID_ARGUMENT    | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `4`   | DEADLINE_EXCEEDED   | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `5`   | NOT_FOUND           | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `6`   | ALREADY_EXISTS      | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `7`   | PERMISSION_DENIED   | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `8`   | RESOURCE_EXHAUSTED  | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `9`   | FAILED_PRECONDITION | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `10`  | ABORTED             | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `11`  | OUT_OF_RANGE        | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `12`  | UNIMPLEMENTED       | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `13`  | INTERNAL            | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `14`  | UNAVAILABLE         | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `15`  | DATA_LOSS           | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `16`  | UNAUTHENTICATED     | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

`rpc.message.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value      | Description | Stability                                                        |
| ---------- | ----------- | ---------------------------------------------------------------- |
| `RECEIVED` | received    | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `SENT`     | sent        | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

`rpc.system` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value          | Description  | Stability                                                        |
| -------------- | ------------ | ---------------------------------------------------------------- |
| `apache_dubbo` | Apache Dubbo | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `connect_rpc`  | Connect RPC  | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `dotnet_wcf`   | .NET WCF     | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `grpc`         | gRPC         | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `java_rmi`     | Java RMI     | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

## RPC Deprecated Attributes

Deprecated rpc message attributes.

| Attribute                   | Type   | Description                                              | Examples           | Stability                                                                                                   |
| --------------------------- | ------ | -------------------------------------------------------- | ------------------ | ----------------------------------------------------------------------------------------------------------- |
| `message.compressed_size`   | int    | Deprecated, use `rpc.message.compressed_size` instead.   |                    | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `rpc.message.compressed_size`.   |
| `message.id`                | int    | Deprecated, use `rpc.message.id` instead.                |                    | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `rpc.message.id`.                |
| `message.type`              | string | Deprecated, use `rpc.message.type` instead.              | `SENT`; `RECEIVED` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `rpc.message.type`.              |
| `message.uncompressed_size` | int    | Deprecated, use `rpc.message.uncompressed_size` instead. |                    | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `rpc.message.uncompressed_size`. |

`message.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value      | Description | Stability                                                        |
| ---------- | ----------- | ---------------------------------------------------------------- |
| `RECEIVED` | received    | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `SENT`     | sent        | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
