diff --git a/semantic_conventions/trace/rpc.yaml b/semantic_conventions/trace/rpc.yaml new file mode 100644 index 00000000000..8461f9934fe --- /dev/null +++ b/semantic_conventions/trace/rpc.yaml @@ -0,0 +1,35 @@ +groups: + - id: rpc + prefix: rpc + brief: 'This document defines semantic conventions for remote procedure calls.' + attributes: + - id: system + type: string + required: always + brief: 'A string identifying the remoting system.' + examples: ["grpc", "java_rmi", "wcf"] + - id: service + type: string + required: + conditional: "No, but recommended" + brief: 'The full name of the service being called, including its package name, if applicable.' + examples: "myservice.EchoService" + - id: method + type: string + required: + conditional: "No, but recommended" + brief: 'The name of the method being called, must be equal to the $method part in the span name.' + examples: "exampleMethod" + - ref: net.peer.ip + - ref: net.peer.name + - ref: net.peer.port + required: + conditional: "See below" + - ref: net.transport + required: + conditional: "See below" + constraints: + - any_of: + - net.peer.ip + - net.peer.name + - include: network diff --git a/specification/trace/semantic_conventions/rpc.md b/specification/trace/semantic_conventions/rpc.md index 62df39f334e..0bbd1b5b2d6 100644 --- a/specification/trace/semantic_conventions/rpc.md +++ b/specification/trace/semantic_conventions/rpc.md @@ -48,17 +48,23 @@ Examples of span names: ### Attributes -| Attribute name | Notes and examples | Required? | -| -------------- | ---------------------------------------------------------------------- | --------- | -| `rpc.system` | A string identifying the remoting system, e.g., `"grpc"`, `"java_rmi"` or `"wcf"`. | Yes | -| `rpc.service` | The full name of the service being called, including its package name, if applicable. | No, but recommended | -| `rpc.method` | The name of the method being called, must be equal to the $method part in the span name. | No, but recommended | -| `net.peer.ip` | See [network attributes][]. | See below | -| `net.peer.name` | See [network attributes][]. | See below | -| `net.peer.port` | See [network attributes][]. | See below | -| `net.transport` | See [network attributes][]. | See below | - -At least one of [network attributes][] `net.peer.name` or `net.peer.ip` is required. + +| Attribute | Type | Description | Example | Required | +|---|---|---|---|---| +| `rpc.system` | string | A string identifying the remoting system. | `grpc`
`java_rmi`
`wcf` | Yes | +| `rpc.service` | string | The full name of the service being called, including its package name, if applicable. | `myservice.EchoService` | Conditional
No, but recommended | +| `rpc.method` | string | The name of the method being called, must be equal to the $method part in the span name. | `exampleMethod` | Conditional
No, but recommended | +| [`net.peer.ip`](span-general.md) | string | Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6) | `127.0.0.1` | See below | +| [`net.peer.name`](span-general.md) | string | Remote hostname or similar, see note below. | `example.com` | See below | +| [`net.peer.port`](span-general.md) | number | Remote port number. | `80`
`8080`
`443` | Conditional
See below | +| [`net.transport`](span-general.md) | string enum | Transport protocol used. See note below. | `IP.TCP` | Conditional
See below | + +**Additional attribute requirements:** At least one of the following sets of attributes is required: + +* [`net.peer.ip`](span-general.md) +* [`net.peer.name`](span-general.md) + + For client-side spans `net.peer.port` is required if the connection is IP-based and the port is available (it describes the server port they are connecting to). For server-side spans `net.peer.port` is optional (it describes the port the client is connecting from). Furthermore, setting [net.transport][] is required for non-IP connection like named pipe bindings.