Skip to content

Django Instrumentation should apply middleware first vs last #659

@toumorokoshi

Description

@toumorokoshi

This is a discussion issue around this code:

https://github.com/open-telemetry/opentelemetry-python/blob/master/ext/opentelemetry-ext-django/src/opentelemetry/ext/django/__init__.py#L53

That currently appends middleware, which results in instrumentation for only the user code. This comes with two caveats:

  1. latency does not truly represent the most accurate value, as it does not consider time taken by middlewares.
  2. some requests will be omitted entirely, due to middleware rejecting the request before the instrumentation middleware can execute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions