horao

Telemetry

HORAO is telemetrised using OpenTelemetry. Telemetry is switched on by default, but can be configured turned off by explicitly setting the environment variable TELEMETRY to OFF (useful for automated tests).

TELEMETRY=OFF

The following sections describe telemetry configuration for HORAO.

Logging level

The logging level can be changed using the DEBUG environment variable. The default is INFO. The logging level can be set in the .env file as follows:

DEBUG=True

Be aware that setting the logging level to DEBUG will generate a lot of output.

Sending telemetry to a collector

The telemetry is sent using OLTP exporter. The default protocol is grpc this can be switched to http by setting the environment variable OLTP_HTTP to True.

OLTP_HTTP=True

The default mechanism is to send telemetry securely, this can be switched to insecure by setting the environment variable OLTP_INSECURE to True.

OLTP_INSECURE=True

A specific collector URL needs to be specified, otherwise the Telemetry will not be sent.

OLTP_COLLECTOR_URL=http://localhost:4317

Various environment variables that can be set to configure telemetry

To exclude certain URLs from tracking

OTEL_PYTHON_STARLETTE_EXCLUDED_URLS="client/.*/info,health"

will exclude requests such as https://site/client/123/info and https://site/health from being traced.

To capture HTTP request headers as span attributes

OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_REQUEST="content-type,custom_request_header"

will extract content-type and custom_request_header from the request headers and add them as span attributes.

To capture HTTP response headers as span attributes

OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_RESPONSE="content-type,custom_response_header"

will extract content-type and custom_response_header from the response headers and add them as span attributes.

In order to prevent storing sensitive data such as personally identifiable information (PII), session keys, passwords, etc.

OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SANITIZE_FIELDS=".*session.*,set-cookie"

will replace the value of headers such as session-id and set-cookie with [REDACTED] in the span.