Skip to main content

Tracability for HMLR applications

Project description

Tracability for Python applications

Convienience Flask extension for retrieving trace IDs from incoming requests.

This package depends on:

  • Flask (Version 2.2.2 or higher)
  • Python 3.9 or higher

Usage

Instantiate it like a normal flask extension:

from landregistry.trace_id import TraceID
from <somewhere> import app

# ...

trace_id_extn = TraceID()
trace_id_extn.init_app(app)

# retrieve the current trace ID
trace_id = trace_id_extn.current_trace_id

Properties

TraceID.current_trace_id

If the application is serving a request, and the value in the request header X-Trace-ID is present and is a valid trace ID, then returns the header value.

If the application is serving a request, and the request header X-Trace-ID is absent or contains an invalid trace ID, returns a new trace ID. A new trace ID generated this way will be the same for all calls to current_trace_id for a given request.

If the application is not serving a request, returns N/A.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

landregistry-trace-id-2.0.1.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

landregistry_trace_id-2.0.1-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page