Skip to content

Commit

Permalink
Avoid using gRPC when generic RPC systems have same properties (#1914)
Browse files Browse the repository at this point in the history
* Avoid using gRPC when generic RPC systems have same properties

The concept of "streaming" is supported by multiple protocols including gRPC, but also others.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Update specification/trace/semantic_conventions/rpc.md

Co-authored-by: Armin Ruech <armin.ruech@dynatrace.com>

Co-authored-by: Armin Ruech <armin.ruech@dynatrace.com>
  • Loading branch information
bogdandrutu and arminru authored Sep 28, 2021
1 parent 613bf2c commit 2031369
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 32 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ release.

- Prefer global user defined limits over model-sepcific default values.
([#1893](https://github.com/open-telemetry/opentelemetry-specification/pull/1893))
- Add InstrumentationLibrary to Sampler.ShouldSample.
([#1850](https://github.com/open-telemetry/opentelemetry-specification/pull/1850))
- Generalize the "message" event to apply to all RPC systems not just gRPC
([#1914](https://github.com/open-telemetry/opentelemetry-specification/pull/1914))

### Metrics

Expand Down
8 changes: 4 additions & 4 deletions semantic_conventions/trace/rpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ groups:
- id: rpc
prefix: rpc
brief: 'This document defines semantic conventions for remote procedure calls.'
events: [rpc.grpc.message]
events: [rpc.message]
attributes:
- id: system
type: string
Expand Down Expand Up @@ -142,10 +142,10 @@ groups:
note: >
This is always required for jsonrpc. See the note in the general
RPC conventions for more information.
- id: rpc.grpc.message
prefix: "message" # TODO: Change the prefix to rpc.grpc.message?
- id: rpc.message
prefix: "message" # TODO: Change the prefix to rpc.message?
type: event
brief: "gRPC received/sent message."
brief: "RPC received/sent message."
attributes:
- id: type
type:
Expand Down
55 changes: 27 additions & 28 deletions specification/trace/semantic_conventions/rpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ This document defines how to describe remote procedure calls
- [Span name](#span-name)
- [Attributes](#attributes)
- [Service name](#service-name)
- [Events](#events)
- [Distinction from HTTP spans](#distinction-from-http-spans)
- [gRPC](#grpc)
- [gRPC Attributes](#grpc-attributes)
- [gRPC Status](#grpc-status)
- [Events](#events)
- [JSON RPC](#json-rpc)
- [JSON RPC Attributes](#json-rpc-attributes)

Expand Down Expand Up @@ -95,6 +95,32 @@ 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

### Events

In the lifetime of an RPC stream, an event for each message sent/received on
client and server spans SHOULD be created. In case of unary calls only one sent
and one received message will be recorded for both client and server spans.

The event name MUST be `"message"`.

<!-- semconv rpc.message -->
| Attribute | Type | Description | Examples | Required |
|---|---|---|---|---|
| `message.type` | string | Whether this is a received or sent message. | `SENT` | No |
| `message.id` | int | MUST be calculated as two different counters starting from `1` one for sent messages and one for received message. [1] | | No |
| `message.compressed_size` | int | Compressed size of the message in bytes. | | No |
| `message.uncompressed_size` | int | Uncompressed size of the message in bytes. | | No |

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

`message.type` MUST be one of the following:

| Value | Description |
|---|---|
| `SENT` | sent |
| `RECEIVED` | received |
<!-- endsemconv -->

### Distinction from HTTP spans

HTTP calls can generally be represented using just [HTTP spans](./http.md).
Expand Down Expand Up @@ -143,33 +169,6 @@ For remote procedure calls via [gRPC][], additional conventions are described in

The [Span Status](../api.md#set-status) MUST be left unset for an `OK` gRPC status code, and set to `Error` for all others.

### Events

In the lifetime of a gRPC stream, an event for each message sent/received on
client and server spans SHOULD be created. In case of
unary calls only one sent and one received message will be recorded for both
client and server spans.

The event name MUST be `"message"`.

<!-- semconv rpc.grpc.message -->
| Attribute | Type | Description | Examples | Required |
|---|---|---|---|---|
| `message.type` | string | Whether this is a received or sent message. | `SENT` | No |
| `message.id` | int | MUST be calculated as two different counters starting from `1` one for sent messages and one for received message. [1] | | No |
| `message.compressed_size` | int | Compressed size of the message in bytes. | | No |
| `message.uncompressed_size` | int | Uncompressed size of the message in bytes. | | No |

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

`message.type` MUST be one of the following:

| Value | Description |
|---|---|
| `SENT` | sent |
| `RECEIVED` | received |
<!-- endsemconv -->

## JSON RPC

Conventions specific to [JSON RPC](https://www.jsonrpc.org/).
Expand Down

0 comments on commit 2031369

Please sign in to comment.