diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c09183b198..1c508a1fec3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,8 @@ release. ([#2290](https://github.com/open-telemetry/opentelemetry-specification/pull/2290)) - Add semantic conventions for [CloudEvents](https://cloudevents.io). ([#1978](https://github.com/open-telemetry/opentelemetry-specification/pull/1978)) +- Add `net.host.name` and `net.host.ip` conventions for rpc server spans. + ([#2447](https://github.com/open-telemetry/opentelemetry-specification/pull/2447)) ### Compatibility diff --git a/semantic_conventions/trace/rpc.yaml b/semantic_conventions/trace/rpc.yaml index f87b5b29e53..9f3d72825fc 100644 --- a/semantic_conventions/trace/rpc.yaml +++ b/semantic_conventions/trace/rpc.yaml @@ -57,6 +57,16 @@ groups: - net.peer.ip - net.peer.name - include: network + + - id: rpc.server + prefix: rpc + extends: rpc + span_kind: server + brief: 'Semantic Convention for RPC Server' + attributes: + - ref: net.host.name + - ref: net.host.ip + - id: rpc.grpc prefix: rpc.grpc extends: rpc @@ -118,6 +128,7 @@ groups: value: 16 required: always brief: "The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request." + - id: rpc.jsonrpc prefix: rpc.jsonrpc extends: rpc @@ -152,6 +163,7 @@ groups: note: > This is always required for jsonrpc. See the note in the general RPC conventions for more information. + - id: rpc.message prefix: "message" # TODO: Change the prefix to rpc.message? type: event diff --git a/specification/trace/semantic_conventions/rpc.md b/specification/trace/semantic_conventions/rpc.md index 1f99f6d0050..611a0ff078c 100644 --- a/specification/trace/semantic_conventions/rpc.md +++ b/specification/trace/semantic_conventions/rpc.md @@ -11,8 +11,9 @@ This document defines how to describe remote procedure calls - [Common remote procedure call conventions](#common-remote-procedure-call-conventions) * [Span name](#span-name) - * [Attributes](#attributes) + * [Common attributes](#common-attributes) + [Service name](#service-name) + * [Server attributes](#server-attributes) * [Events](#events) * [Distinction from HTTP spans](#distinction-from-http-spans) - [gRPC](#grpc) @@ -51,7 +52,7 @@ Examples of span names: `MyServiceReference.ICalculator/Add` reported by the client for .NET WCF calls - `MyServiceWithNoPackage/theMethod` -### Attributes +### Common attributes | Attribute | Type | Description | Examples | Required | @@ -102,6 +103,15 @@ Generally, a user SHOULD NOT set `peer.service` to a fully qualified RPC service [`service.name`]: ../../resource/semantic_conventions/README.md#service [`peer.service`]: span-general.md#general-remote-service-attributes +### Server attributes + + +| Attribute | Type | Description | Examples | Required | +|---|---|---|---|---| +| [`net.host.ip`](span-general.md) | string | Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host. | `192.168.0.1` | No | +| [`net.host.name`](span-general.md) | string | Local hostname or similar, see note below. | `localhost` | No | + + ### Events In the lifetime of an RPC stream, an event for each message sent/received on