Skip to main content

Shared PolicyEngine observability runtime for logs, timings, metrics, and OpenTelemetry.

Project description

policyengine-observability

Shared PolicyEngine observability runtime for fail-open local timings, structured logs, OpenTelemetry traces, and OpenTelemetry metrics.

The package intentionally keeps framework support in adapters:

  • policyengine_observability.adapters.flask
  • policyengine_observability.adapters.fastapi
  • policyengine_observability.integrations.httpx

OpenTelemetry support is installed and enabled by default. Timing and structured logging run even without an OTLP collector; when no endpoint is configured, spans and metrics stay in-process while logs still receive trace context. Set OTEL_ENABLED=false to opt out. Configure OTEL_EXPORTER_OTLP_ENDPOINT to export traces and metrics.

Structured logs write to stdout by default:

OBSERVABILITY_LOG_DESTINATIONS=stdout

Cloud Run captures stdout and stderr into Google Cloud Logging, so stdout is usually the right destination for Cloud Run services. Non-GCP runtimes such as Modal can write directly to Google Cloud Logging by installing the google extra and enabling the Google destination:

OBSERVABILITY_LOG_DESTINATIONS=google_cloud_logging
OBSERVABILITY_GOOGLE_CLOUD_PROJECT=policyengine-observability
OBSERVABILITY_GOOGLE_CLOUD_LOG_NAME=policyengine-observability

Multiple destinations can be enabled with a comma-separated list, for example OBSERVABILITY_LOG_DESTINATIONS=stdout,google_cloud_logging. Google Cloud Logging uses Application Default Credentials and requires permission to create log entries, typically through roles/logging.logWriter.

Release workflow

Changes should include a Towncrier fragment in changelog.d/. Pull requests run changelog, Ruff, and coverage checks. Pushes to main run the same gates, then publish a versioning commit that builds the changelog and bumps pyproject.toml. That versioning commit publishes the package to PyPI through trusted publishing, creates a matching git tag, and opens a GitHub release.

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

policyengine_observability-1.1.0.tar.gz (99.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

policyengine_observability-1.1.0-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file policyengine_observability-1.1.0.tar.gz.

File metadata

File hashes

Hashes for policyengine_observability-1.1.0.tar.gz
Algorithm Hash digest
SHA256 9ccf6c63d5ed713931e1fab89b29251252d90587833d2673d2f6400189662939
MD5 18c86391306a1982d7a9ce30b5f9840c
BLAKE2b-256 3b93ffd9db667793d22b1e6d33c880ad3f7e701626e90a33677ba309e3e51c32

See more details on using hashes here.

Provenance

The following attestation bundles were made for policyengine_observability-1.1.0.tar.gz:

Publisher: push.yml on PolicyEngine/policyengine-observability

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file policyengine_observability-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for policyengine_observability-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 946781000bbad81654e56f13bb4789c4e4ed9c0e5342340239562a83fd01e713
MD5 2fd87d836b283e6f761597dff5f05a6d
BLAKE2b-256 15df45144b364bc00023a6297f07dc6d2141df33dfc1d5c8bfc75016fbf6dcf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for policyengine_observability-1.1.0-py3-none-any.whl:

Publisher: push.yml on PolicyEngine/policyengine-observability

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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