From 04792123a78cfca3642d980a2fb72617eaf97e88 Mon Sep 17 00:00:00 2001 From: Jonathan Braswell <10187286+jbraswell@users.noreply.github.com> Date: Thu, 20 Jan 2022 12:35:34 -0500 Subject: [PATCH] add trailing_metadata to _OpenTelemetryServicerContext The trailing_metadata method was added to grpc._server.ServicerContext in gRPC v1.38.0. --- CHANGELOG.md | 2 ++ .../src/opentelemetry/instrumentation/grpc/_server.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64405acd89..3e68ae33d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- `opentelemetry-instrumentation-grpc` added `trailing_metadata` to _OpenTelemetryServicerContext. + ([#871](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/871)) - `opentelemetry-instrumentation-asgi` now returns a `traceresponse` response header. ([#817](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/817)) - `opentelemetry-instrumentation-kafka-python` added kafka-python module instrumentation. diff --git a/instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/_server.py b/instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/_server.py index b67b1571b5..82e192622c 100644 --- a/instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/_server.py +++ b/instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/_server.py @@ -114,6 +114,9 @@ def send_initial_metadata(self, *args, **kwargs): def set_trailing_metadata(self, *args, **kwargs): return self._servicer_context.set_trailing_metadata(*args, **kwargs) + def trailing_metadata(self): + return self._servicer_context.trailing_metadata() + def abort(self, code, details): self.code = code self.details = details