Skip to content

Commit

Permalink
added conditional calling of unary_unary etc functions in `_Interce…
Browse files Browse the repository at this point in the history
…ptorChannel` (open-telemetry#2484)
  • Loading branch information
VamsiKrishna1211 authored Jul 30, 2024
1 parent b65f67d commit 1c8d8ef
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 20 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- `opentelemetry-instrumentation-django` Fix regression - `http.target` re-added back to old semconv duration metrics
([#2746](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2746))
- `opentelemetry-instrumentation-grpc` Fixes the issue with the gRPC instrumentation not working with the 1.63.0 and higher version of gRPC
([#2483](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2484))

## Version 1.26.0/0.47b0 (2024-07-23)

Expand Down Expand Up @@ -104,7 +106,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `opentelemetry-instrumentation-asgi` Bugfix: Middleware did not set status code attribute on duration metrics for non-recording spans.
([#2627](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2627))


## Version 1.25.0/0.46b0 (2024-05-31)

### Breaking changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,47 +272,95 @@ def unsubscribe(self, *args, **kwargs):
self._channel.unsubscribe(*args, **kwargs)

def unary_unary(
self, method, request_serializer=None, response_deserializer=None
self,
method,
request_serializer=None,
response_deserializer=None,
_registered_method=False,
):
base_callable = self._channel.unary_unary(
method, request_serializer, response_deserializer
)
if _registered_method:
base_callable = self._channel.unary_unary(
method,
request_serializer,
response_deserializer,
_registered_method,
)
else:
base_callable = self._channel.unary_unary(
method, request_serializer, response_deserializer
)
if isinstance(self._interceptor, grpcext.UnaryClientInterceptor):
return _InterceptorUnaryUnaryMultiCallable(
method, base_callable, self._interceptor
)
return base_callable

def unary_stream(
self, method, request_serializer=None, response_deserializer=None
self,
method,
request_serializer=None,
response_deserializer=None,
_registered_method=False,
):
base_callable = self._channel.unary_stream(
method, request_serializer, response_deserializer
)
if _registered_method:
base_callable = self._channel.unary_stream(
method,
request_serializer,
response_deserializer,
_registered_method,
)
else:
base_callable = self._channel.unary_stream(
method, request_serializer, response_deserializer
)
if isinstance(self._interceptor, grpcext.StreamClientInterceptor):
return _InterceptorUnaryStreamMultiCallable(
method, base_callable, self._interceptor
)
return base_callable

def stream_unary(
self, method, request_serializer=None, response_deserializer=None
self,
method,
request_serializer=None,
response_deserializer=None,
_registered_method=False,
):
base_callable = self._channel.stream_unary(
method, request_serializer, response_deserializer
)
if _registered_method:
base_callable = self._channel.stream_unary(
method,
request_serializer,
response_deserializer,
_registered_method,
)
else:
base_callable = self._channel.stream_unary(
method, request_serializer, response_deserializer
)
if isinstance(self._interceptor, grpcext.StreamClientInterceptor):
return _InterceptorStreamUnaryMultiCallable(
method, base_callable, self._interceptor
)
return base_callable

def stream_stream(
self, method, request_serializer=None, response_deserializer=None
self,
method,
request_serializer=None,
response_deserializer=None,
_registered_method=False,
):
base_callable = self._channel.stream_stream(
method, request_serializer, response_deserializer
)
if _registered_method:
base_callable = self._channel.stream_stream(
method,
request_serializer,
response_deserializer,
_registered_method,
)
else:
base_callable = self._channel.stream_stream(
method, request_serializer, response_deserializer
)
if isinstance(self._interceptor, grpcext.StreamClientInterceptor):
return _InterceptorStreamStreamMultiCallable(
method, base_callable, self._interceptor
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
asgiref==3.7.2
attrs==23.2.0
Deprecated==1.2.14
grpcio==1.63.0
importlib-metadata==6.11.0
iniconfig==2.0.0
packaging==23.2
pluggy==1.4.0
protobuf==3.20.3
py==1.11.0
py-cpuinfo==9.0.0
pytest==7.1.3
pytest-asyncio==0.23.5
pytest-benchmark==4.0.0
tomli==2.0.1
typing_extensions==4.9.0
wrapt==1.16.0
zipp==3.17.0
-e opentelemetry-instrumentation
-e instrumentation/opentelemetry-instrumentation-grpc
12 changes: 9 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,12 @@ envlist =
lint-instrumentation-wsgi

; opentelemetry-instrumentation-grpc
py3{8,9,10,11,12}-test-instrumentation-grpc
pypy3-test-instrumentation-grpc
; The numbers at the end of the environment names
; below mean these dependencies are being used:
; 0: grpcio==1.62.0
; 1: grpcio==1.63.0
py3{8,9,10,11,12}-test-instrumentation-grpc-{0,1}
pypy3-test-instrumentation-grpc-{0,1}
lint-instrumentation-grpc

; opentelemetry-instrumentation-sqlalchemy
Expand Down Expand Up @@ -446,7 +450,9 @@ commands_pre =
grpc: pip install opentelemetry-semantic-conventions@{env:CORE_REPO}\#egg=opentelemetry-semantic-conventions&subdirectory=opentelemetry-semantic-conventions
grpc: pip install opentelemetry-sdk@{env:CORE_REPO}\#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk
grpc: pip install opentelemetry-test-utils@{env:CORE_REPO}\#egg=opentelemetry-test-utils&subdirectory=tests/opentelemetry-test-utils
grpc: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc/test-requirements.txt
grpc-0: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc/test-requirements-0.txt
grpc-1: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc/test-requirements-1.txt
lint-instrumentation-grpc: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc/test-requirements-1.txt

wsgi: pip install opentelemetry-api@{env:CORE_REPO}\#egg=opentelemetry-api&subdirectory=opentelemetry-api
wsgi: pip install opentelemetry-semantic-conventions@{env:CORE_REPO}\#egg=opentelemetry-semantic-conventions&subdirectory=opentelemetry-semantic-conventions
Expand Down

0 comments on commit 1c8d8ef

Please sign in to comment.