fix: None does not implement middleware when there are no middlewares (#1766)

This commit is contained in:
mshebeko-twist 2023-04-19 20:23:21 +03:00 committed by GitHub
parent d01c96fb42
commit 2d4e6c9ac7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -22,7 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix `AttributeError` when AWS Lambda handler receives a list event
([#1738](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1738))
- Fix `None does not implement middleware` error when there are no middlewares registered
([#1766](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1766))
## Version 1.17.0/0.38b0 (2023-03-22)

View File

@ -245,6 +245,9 @@ class _InstrumentedFalconAPI(getattr(falcon, _instrument_app)):
# inject trace middleware
self._middlewares_list = kwargs.pop("middleware", [])
if self._middlewares_list is None:
self._middlewares_list = []
tracer_provider = otel_opts.pop("tracer_provider", None)
meter_provider = otel_opts.pop("meter_provider", None)
if not isinstance(self._middlewares_list, (list, tuple)):