Fix AttributeError: `ResolverMatch` object has no attribute `route` (#581)
This commit is contained in:
parent
2ccf12055e
commit
df0ca3b604
|
|
@ -41,6 +41,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- `opentelemetry-instrumentation-requests` Fix potential `AttributeError` when `requests`
|
||||
is used with a custom transport adapter.
|
||||
([#562](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/562))
|
||||
- `opentelemetry-instrumentation-django` Fix AttributeError: ResolverMatch object has no attribute route
|
||||
([#581](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/581))
|
||||
|
||||
### Added
|
||||
- `opentelemetry-instrumentation-httpx` Add `httpx` instrumentation
|
||||
|
|
|
|||
|
|
@ -191,9 +191,9 @@ class _DjangoMiddleware(MiddlewareMixin):
|
|||
span = request.META[self._environ_span_key]
|
||||
|
||||
if span.is_recording():
|
||||
match = getattr(request, "resolver_match")
|
||||
match = getattr(request, "resolver_match", None)
|
||||
if match:
|
||||
route = getattr(match, "route")
|
||||
route = getattr(match, "route", None)
|
||||
if route:
|
||||
span.set_attribute(SpanAttributes.HTTP_ROUTE, route)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue