Skip to content

[py] Support request-stack context metadata #399

Open
@gabe-l-hart

Description

@gabe-l-hart

Is your feature request related to a problem? Please describe.

In cloud services, it's common practice to attach a trace ID to each request that is processed. When logging with alog, this id should be included as a field in the metadata of every log line during the request's scope.

Describe the solution you'd like

The metadata be attached to the call stack (and not a local thread ID) so that all log lines made within a call stack will have the ID included as a field.

Describe alternatives you've considered

Attaching a trace ID to a thread using threading.local is a simple solution, but insufficient to properly handle several cases:

  1. Threads that spawn other threads
  2. Requests handled with long-lived threads from a pool

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