Skip to content

Commit

Permalink
Add net.host.name and net.host.ip to rpc server
Browse files Browse the repository at this point in the history
  • Loading branch information
trask committed Mar 25, 2022
1 parent 8cf1c75 commit ec03f07
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 12 additions & 0 deletions semantic_conventions/trace/rpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions specification/trace/semantic_conventions/rpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -51,7 +52,7 @@ Examples of span names:
`MyServiceReference.ICalculator/Add` reported by the client for .NET WCF calls
- `MyServiceWithNoPackage/theMethod`

### Attributes
### Common attributes

<!-- semconv rpc -->
| Attribute | Type | Description | Examples | Required |
Expand Down Expand Up @@ -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

<!-- semconv rpc.server -->
| 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 |
<!-- endsemconv -->

### Events

In the lifetime of an RPC stream, an event for each message sent/received on
Expand Down

0 comments on commit ec03f07

Please sign in to comment.