From 976f870cb72f4975ea01928b91165378bf91cf17 Mon Sep 17 00:00:00 2001 From: Sami Musallam Date: Wed, 12 Oct 2022 15:47:52 +0300 Subject: [PATCH 1/2] feat(grpc-metadata): add gRPC request/response metadata as span attributes --- specification/trace/semantic_conventions/rpc.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/specification/trace/semantic_conventions/rpc.md b/specification/trace/semantic_conventions/rpc.md index d800f0c5b59..6d066c3ea2d 100644 --- a/specification/trace/semantic_conventions/rpc.md +++ b/specification/trace/semantic_conventions/rpc.md @@ -19,6 +19,7 @@ This document defines how to describe remote procedure calls - [gRPC](#grpc) * [gRPC Attributes](#grpc-attributes) * [gRPC Status](#grpc-status) + * [gRPC Request and Response Metadata](#grpc-request-and-response-metadata) - [JSON RPC](#json-rpc) * [JSON RPC Attributes](#json-rpc-attributes) @@ -202,6 +203,16 @@ 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. +### gRPC Request and Response Metadata + +| Attribute | Type | Description | Examples | Requirement Level | +|-------------------------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|-------------------| +| `rpc.request.metadata.` | string[] | gRPC request metadata, `` being the normalized gRPC Metadata key (lowercase, with `-` characters replaced by `_`), the value being the metadata values. [1] | `rpc.request.metadata.my_custom_metadata_attribute=["1.2.3.4", "1.2.3.5"]` | Optional | +| `rpc.response.metadata.` | string[] | gRPC response metadata, `` being the normalized gRPC Metadata key (lowercase, with `-` characters replaced by `_`), the value being the metadata values. [1] | `rpc.response.metadata.my_custom_metadata_attribute=["attribute_value"]` | Optional | + +**[1]:** Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured. +Including all request/response metadata values can be a security risk - explicit configuration helps avoid leaking sensitive information. + ## JSON RPC Conventions specific to [JSON RPC](https://www.jsonrpc.org/). From f6e2cf0e590db1623a2260d052e6ce3c864b9507 Mon Sep 17 00:00:00 2001 From: Sami Musallam Date: Wed, 12 Oct 2022 15:56:19 +0300 Subject: [PATCH 2/2] feat(grpc-metadata): updated CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87b719942ec..1ef61b106f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ release. ### Semantic Conventions +- Add gRPC request and response metadata semantic conventions. + ([#2874](https://github.com/open-telemetry/opentelemetry-specification/pull/2874)) + ### Compatibility ### OpenTelemetry Protocol