Skip to main content

Function tracing and observability with console output and optional OpenTelemetry.

Project description

omniray

A live tracing tool for Python -- console profiling with optional OpenTelemetry tracing for omniwrap.

See the main README for full documentation.

Installation

pip install omniray

Quick Start

from omniwrap import wrap_all
from omniray import create_trace_wrapper, trace

# Auto-instrument with console profiling (OTel spans off by default)
wrap_all(create_trace_wrapper())

# Selectively enable OTel on high-value functions
@trace(otel=True)
def process_payment(order_id: str) -> bool: ...

@trace(otel=True)
async def execute_sql(query: str) -> list[dict]: ...

# Regular functions get profiling only — no OTel cost
@trace()
def validate_input(data: dict) -> bool: ...

Environment Variables

Variable Default Description
OMNIRAY_OTEL false Generate OpenTelemetry spans globally (use @trace(otel=True) for selective opt-in)
OMNIRAY_LOG false Enable colored console tree output
OMNIRAY_LOG_INPUT false Log function arguments
OMNIRAY_LOG_OUTPUT false Log function return values
OMNIRAY_LOG_INPUT_SIZE false Append deep input size (MB) to the timing line. Uses pympler.asizeof — opt-in, can be slow on very large object graphs.
OMNIRAY_LOG_OUTPUT_SIZE false Append deep return-value size (MB) to the timing line. Uses pympler.asizeof — opt-in, can be slow on very large object graphs.
OMNIRAY_LOG_RSS false Append process RSS (current MB, delta before→after, peak since process start) to the timing line. Current RSS uses psutil; peak uses resource.getrusage (Unix). ~5–20µs per call.
OMNIRAY_LOG_COLOR true Enable ANSI colors in console output
OMNIRAY_LOG_STYLE auto Box-drawing style: unicode, ascii, or auto (detect from terminal)

Configuration via pyproject.toml

Color thresholds for the per-segment coloring of the timing line live under [tool.omniray] in the host project's pyproject.toml. Each list defines the DIM → GREEN → YELLOW → RED boundaries for its value class.

[tool.omniray]
size = [0.1, 1, 10]              # MB: in/out payload (DIM < 0.1, GREEN < 1, YELLOW < 10, RED ≥ 10)
rss = [100, 500, 1000]           # MB: rss current / peak
rss_delta = [1, 10, 100]         # MB: RSS delta (negative / near-zero → DIM)
duration_ms = [1, 10, 100]       # ms: span duration color boundaries
size_big_tag_mb = 10             # MB: in/out size at/above which the `[BIG]` tag is appended
duration_slow_tag_ms = 200       # ms: duration at/above which the `[SLOW]` tag is appended

All keys are optional — omitted ones fall back to defaults shown above. The file is resolved by walking up from the current working directory until the first pyproject.toml is found; missing/malformed files cause silent fallback to defaults. Thresholds are loaded once at import time; restart the process to pick up changes.

License

Apache 2.0

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

omniray-1.1.0.tar.gz (39.3 kB view details)

Uploaded Source

Built Distribution

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

omniray-1.1.0-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: omniray-1.1.0.tar.gz
  • Upload date:
  • Size: 39.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for omniray-1.1.0.tar.gz
Algorithm Hash digest
SHA256 06dcececca6aee53362c85b04ed4794f11ebfe0706fb9b8a118d313abfda9fcc
MD5 b693b5212e7e6f719a49d36f948d3f52
BLAKE2b-256 55ab3af3accb85bb6b5e026485a568eb330e3f36b4c75134216e2b04a44e9e76

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on omniviser/omniray

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

File details

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

File metadata

  • Download URL: omniray-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for omniray-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 800ced83fe285f9a4698c0d93d66159215c978dd3a920e0c2dea70bb40025ab7
MD5 2f275e059c7898945129225f32f0de96
BLAKE2b-256 b94114405c52a580088cfd5c70eb185d4c79d6ca6d8b45b475dd34345e107b66

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on omniviser/omniray

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