From fa356f2825ba2fdf42701bc96dd50ffbe663b4c4 Mon Sep 17 00:00:00 2001 From: Corvin Lasogga Date: Thu, 28 Jul 2022 19:11:00 +0200 Subject: [PATCH] Added types for typing --- .../instrumentation/grpc/_types.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/_types.py diff --git a/instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/_types.py b/instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/_types.py new file mode 100644 index 0000000000..81f12ba943 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/_types.py @@ -0,0 +1,29 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Internal types.""" + +from typing import Dict, Iterator, TypeVar, Union + +import grpc + + +Metadata = Dict[str, Union[str, bytes]] +"""Metadata type.""" + +ProtoMessage = TypeVar("ProtoMessage") +"""Protobuf message type.""" + +ProtoMessageOrIterator = Union[ProtoMessage, Iterator[ProtoMessage]] +"""Type for a protobuf message or a iterator of protobuf messages."""