groups:
  - id: registry.rpc
    type: attribute_group
    display_name: Remote Procedure Call (RPC) Attributes
    brief: 'This document defines attributes for remote procedure calls.'
    attributes:
      - id: rpc.connect_rpc.error_code
        type:
          members:
            - id: cancelled
              value: cancelled
              stability: development
            - id: unknown
              value: unknown
              stability: development
            - id: invalid_argument
              value: invalid_argument
              stability: development
            - id: deadline_exceeded
              value: deadline_exceeded
              stability: development
            - id: not_found
              value: not_found
              stability: development
            - id: already_exists
              value: already_exists
              stability: development
            - id: permission_denied
              value: permission_denied
              stability: development
            - id: resource_exhausted
              value: resource_exhausted
              stability: development
            - id: failed_precondition
              value: failed_precondition
              stability: development
            - id: aborted
              value: aborted
              stability: development
            - id: out_of_range
              value: out_of_range
              stability: development
            - id: unimplemented
              value: unimplemented
              stability: development
            - id: internal
              value: internal
              stability: development
            - id: unavailable
              value: unavailable
              stability: development
            - id: data_loss
              value: data_loss
              stability: development
            - id: unauthenticated
              value: unauthenticated
              stability: development
        stability: development
        brief: "The [error codes](https://connectrpc.com//docs/protocol/#error-codes) of the Connect request. Error codes are always string values."
      - id: rpc.connect_rpc.request.metadata
        type: template[string[]]
        stability: development
        brief: >
          Connect request metadata, `<key>` being the normalized Connect Metadata key (lowercase), the value being the metadata values.
        note: |
          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.

          For example, a property `my-custom-key` with value `["1.2.3.4", "1.2.3.5"]` SHOULD be recorded as
          the `rpc.connect_rpc.request.metadata.my-custom-key` attribute with value `["1.2.3.4", "1.2.3.5"]`
        examples: [["1.2.3.4", "1.2.3.5"]]
      - id: rpc.connect_rpc.response.metadata
        type: template[string[]]
        stability: development
        brief: >
          Connect response metadata, `<key>` being the normalized Connect Metadata key (lowercase), the value being the metadata values.
        note: |
          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.

          For example, a property `my-custom-key` with value `"attribute_value"` SHOULD be recorded as
          the `rpc.connect_rpc.response.metadata.my-custom-key` attribute with value `["attribute_value"]`
        examples: [["attribute_value"]]
      - id: rpc.grpc.status_code
        type:
          members:
            - id: ok
              brief: OK
              stability: development
              value: 0
            - id: cancelled
              brief: CANCELLED
              stability: development
              value: 1
            - id: unknown
              brief: UNKNOWN
              stability: development
              value: 2
            - id: invalid_argument
              brief: INVALID_ARGUMENT
              stability: development
              value: 3
            - id: deadline_exceeded
              brief: DEADLINE_EXCEEDED
              stability: development
              value: 4
            - id: not_found
              brief: NOT_FOUND
              stability: development
              value: 5
            - id: already_exists
              brief: ALREADY_EXISTS
              stability: development
              value: 6
            - id: permission_denied
              brief: PERMISSION_DENIED
              stability: development
              value: 7
            - id: resource_exhausted
              brief: RESOURCE_EXHAUSTED
              stability: development
              value: 8
            - id: failed_precondition
              brief: FAILED_PRECONDITION
              stability: development
              value: 9
            - id: aborted
              brief: ABORTED
              stability: development
              value: 10
            - id: out_of_range
              brief: OUT_OF_RANGE
              stability: development
              value: 11
            - id: unimplemented
              brief: UNIMPLEMENTED
              stability: development
              value: 12
            - id: internal
              brief: INTERNAL
              stability: development
              value: 13
            - id: unavailable
              brief: UNAVAILABLE
              stability: development
              value: 14
            - id: data_loss
              brief: DATA_LOSS
              stability: development
              value: 15
            - id: unauthenticated
              brief: UNAUTHENTICATED
              stability: development
              value: 16
        stability: development
        brief: "The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request."
      - id: rpc.grpc.request.metadata
        type: template[string[]]
        stability: development
        brief: >
          gRPC request metadata, `<key>` being the normalized gRPC Metadata key (lowercase), the value being the metadata values.
        note: |
          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.

          For example, a property `my-custom-key` with value `["1.2.3.4", "1.2.3.5"]` SHOULD be recorded as
          `rpc.grpc.request.metadata.my-custom-key` attribute with value `["1.2.3.4", "1.2.3.5"]`
        examples: [["1.2.3.4", "1.2.3.5"]]
      - id: rpc.grpc.response.metadata
        type: template[string[]]
        stability: development
        brief: >
          gRPC response metadata, `<key>` being the normalized gRPC Metadata key (lowercase), the value being the metadata values.
        note: |
          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.

          For example, a property `my-custom-key` with value `["attribute_value"]` SHOULD be recorded as
          the `rpc.grpc.response.metadata.my-custom-key` attribute with value `["attribute_value"]`
        examples: [["attribute_value"]]
      - id: rpc.jsonrpc.error_code
        type: int
        stability: development
        brief: "`error.code` property of response if it is an error response."
        examples: [-32700, 100]
      - id: rpc.jsonrpc.error_message
        type: string
        stability: development
        brief: "`error.message` property of response if it is an error response."
        examples: ['Parse error', 'User already exists']
      - id: rpc.jsonrpc.request_id
        type: string
        stability: development
        brief: >
          `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.
        examples: ['10', 'request-7', '']
      - id: rpc.jsonrpc.version
        type: string
        stability: development
        brief: "Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 doesn't specify this, the value can be omitted."
        examples: ['2.0', '1.0']
      - id: rpc.method
        type: string
        stability: development
        brief: 'The name of the (logical) method being called, must be equal to the $method part in the span name.'
        note: >
          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.name` 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).
        examples: "exampleMethod"
      - id: rpc.service
        type: string
        stability: development
        brief: 'The full (logical) name of the service being called, including its package name, if applicable.'
        note: >
          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).
        examples: "myservice.EchoService"
      - id: rpc.system
        brief: 'A string identifying the remoting system. See below for a list of well-known identifiers.'
        type:
          members:
            - id: grpc
              value: 'grpc'
              brief: 'gRPC'
              stability: development
            - id: java_rmi
              value: 'java_rmi'
              brief: 'Java RMI'
              stability: development
            - id: dotnet_wcf
              value: 'dotnet_wcf'
              brief: '.NET WCF'
              stability: development
            - id: apache_dubbo
              value: 'apache_dubbo'
              brief: 'Apache Dubbo'
              stability: development
            - id: connect_rpc
              value: 'connect_rpc'
              brief: 'Connect RPC'
              stability: development
        stability: development
      - id: rpc.message.type
        type:
          members:
            - id: sent
              value: "SENT"
              stability: development
            - id: received
              value: "RECEIVED"
              stability: development
        stability: development
        brief: "Whether this is a received or sent message."
      - id: rpc.message.id
        type: int
        stability: development
        brief: "MUST be calculated as two different counters starting from `1` one for sent messages and one for received message."
        note: "This way we guarantee that the values will be consistent between different implementations."
      - id: rpc.message.compressed_size
        type: int
        stability: development
        brief: "Compressed size of the message in bytes."
      - id: rpc.message.uncompressed_size
        type: int
        stability: development
        brief: "Uncompressed size of the message in bytes."
