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 conditional calling of unary_unary etc functions in _InterceptorChannel #2484

Merged
Merged
Show file tree
Hide file tree
Changes from 12 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#2553](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2553))
- `opentelemetry-util-http` Preserve brackets around literal IPv6 hosts ([#2552](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2552))
- `opentelemetry-util-redis` Fix net peer attribute for unix socket connection ([#2493](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2493))
- `opentelemetry-instrumentation-grpc` Fixes the issue with the gRPC instrumentation not working with the 1.63.0 and higher version of gRPC
VamsiKrishna1211 marked this conversation as resolved.
Show resolved Hide resolved
([#2483](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2484))

## Version 1.24.0/0.45b0 (2024-03-28)

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:
xrmx marked this conversation as resolved.
Show resolved Hide resolved
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:
xrmx marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -239,8 +239,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}-test-instrumentation-grpc-{0,1}
VamsiKrishna1211 marked this conversation as resolved.
Show resolved Hide resolved
pypy3-test-instrumentation-grpc-{0,1}
lint-instrumentation-grpc

; opentelemetry-instrumentation-sqlalchemy
Expand Down Expand Up @@ -442,7 +446,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