Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added JSON RPC specific attributes #1643

Merged
merged 18 commits into from
May 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ release.
- Add details for filling semantic conventions for AWS Lambda ([#1442](https://github.com/open-telemetry/opentelemetry-specification/pull/1442))
- Update semantic conventions to distinguish between int and double ([#1550](https://github.com/open-telemetry/opentelemetry-specification/pull/1550))
- Add semantic convention for AWS ECS task revision ([#1581](https://github.com/open-telemetry/opentelemetry-specification/pull/1581))
- Add JSON RPC specific conventions ([#1643](https://github.com/open-telemetry/opentelemetry-specification/pull/1643)).

### Compatibility

Expand Down
30 changes: 30 additions & 0 deletions semantic_conventions/trace/rpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,33 @@ groups:
required: always
brief: "The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request."
examples: [0, 1, 16]
- id: rpc.jsonrpc
arminru marked this conversation as resolved.
Show resolved Hide resolved
Rast1234 marked this conversation as resolved.
Show resolved Hide resolved
prefix: rpc.jsonrpc
extends: rpc
brief: 'Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/).'
attributes:
- id: version
type: string
required:
conditional: 'If missing, it is assumed to be "1.0".'
brief: "Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 does not specify this, the value can be omitted."
examples: ['2.0', '1.0']
- id: method
type: string
required: always
brief: "`method` property from request. Unlike `rpc.method`, this may not relate to the actual method being called. Useful for client-side traces since client does not know what will be called on the server."
examples: ['users.create', 'get_users']
- id: request_id
type: string
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: error_code
type: int
required:
conditional: 'If missing, response is assumed to be successful.'
brief: "`error.code` property of response if it is an error response."
examples: [-32700, 100]
- id: error_message
type: string
brief: "`error.message` property of response if it is an error response."
examples: ['Parse error', 'User already exists']
Rast1234 marked this conversation as resolved.
Show resolved Hide resolved
39 changes: 30 additions & 9 deletions specification/trace/semantic_conventions/rpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ This document defines how to describe remote procedure calls

<!-- toc -->

- [Common remote procedure call conventions](#common-remote-procedure-call-conventions)
* [Span name](#span-name)
* [Attributes](#attributes)
+ [Service name](#service-name)
* [Distinction from HTTP spans](#distinction-from-http-spans)
- [gRPC](#grpc)
* [gRPC Attributes](#grpc-attributes)
* [gRPC Status](#grpc-status)
* [Events](#events)
- [Semantic conventions for RPC spans](#semantic-conventions-for-rpc-spans)
- [Common remote procedure call conventions](#common-remote-procedure-call-conventions)
- [Span name](#span-name)
- [Attributes](#attributes)
- [Service name](#service-name)
- [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)

<!-- tocstop -->

Expand Down Expand Up @@ -164,3 +167,21 @@ one for sent messages and one for received message. This way we guarantee that
the values will be consistent between different implementations. In case of
unary calls only one sent and one received message will be recorded for both
client and server spans.

## JSON RPC

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

`rpc.system` MUST be set to `"jsonrpc"`.

### JSON RPC Attributes

<!-- semconv rpc.jsonrpc -->
| Attribute | Type | Description | Examples | Required |
|---|---|---|---|---|
| `rpc.jsonrpc.version` | string | Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 does not specify this, the value can be omitted. | `2.0`; `1.0` | If missing, it is assumed to be "1.0". |
| `rpc.jsonrpc.method` | string | `method` property from request. Unlike `rpc.method`, this may not relate to the actual method being called. Useful for client-side traces since client does not know what will be called on the server. | `users.create`; `get_users` | Yes |
| `rpc.jsonrpc.request_id` | string | `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. | `10`; `request-7`; `` | No |
| `rpc.jsonrpc.error_code` | int | `error.code` property of response if it is an error response. | `-32700`; `100` | If missing, response is assumed to be successful. |
| `rpc.jsonrpc.error_message` | string | `error.message` property of response if it is an error response. | `Parse error`; `User already exists` | No |
<!-- endsemconv -->