Skip to content

omniviser/omniray

omniray logo

Coverage Tests Lint CodeQL Quality Gate
PyPI Python Docs License

Stop guessing! Debug effortlessly!
You and your AI can now see anything.

Meet omniray β€” OMNIVISER's X-RAY

Built and battle-tested at OMNIVISER.


How it works

Demo app built to show omniray in action β€” every function call traced live with timing and I/O.

omniray demo

  • Live function, error, I/O and performance tracing in clear logs.
  • Full context for you and your AI.
  • No decorators, no config files β€” just one call.

Quick Setup

Install:

pip install omniray              # console tracing
pip install omniray[otel]        # + OpenTelemetry spans
pip install omniwrap             # wrapping engine only (custom wrappers)

Requires Python >= 3.12. omniray is built on omniwrap β€” installing omniray installs both.

Add to your code:

from omniwrap import wrap_all
from omniray import create_trace_wrapper

wrap_all(create_trace_wrapper())

Run your app:

OMNIRAY_LOG=true python app.py

Output:

13:44  INFO: β”Œβ”€ BigRedButton.press
13:44  INFO: β”œβ”€ β”Œβ”€ BigRedButton.pre_launch_check
13:44  INFO: β”‚  β”œβ”€ β”Œβ”€ MissileLauncher.authenticate
13:44  INFO: β”‚  β”‚  └─ (52.80ms) MissileLauncher.authenticate
13:44  INFO: β”‚  └─ (53.34ms) BigRedButton.pre_launch_check
13:44  INFO: β”œβ”€ β”Œβ”€ BigRedButton.launch_sequence
13:44  INFO: β”‚  β”œβ”€ β”Œβ”€ MissileLauncher.arm_warhead
13:44  INFO: β”‚  β”‚  └─ (124.97ms) MissileLauncher.arm_warhead
13:44  INFO: β”‚  β”œβ”€ β”Œβ”€ MissileLauncher.select_target
13:44  INFO: β”‚  β”‚  IN: {
13:44  INFO: β”‚  β”‚    "coordinates": "51.5074Β° N, 0.1278Β° W"
13:44  INFO: β”‚  β”‚  }
13:44  INFO: β”‚  β”‚  └─ (34.74ms) MissileLauncher.select_target
13:44  INFO: β”‚  β”œβ”€ β”Œβ”€ MissileLauncher.fire
13:44  INFO: β”‚  β”‚  └─ (202.05ms) MissileLauncher.fire [SLOW]
13:44  INFO: β”‚  β”‚  OUT: {
13:44  INFO: β”‚  β”‚    "status": "BOOM!",
13:44  INFO: β”‚  β”‚    "impact": true,
13:44  INFO: β”‚  β”‚    "debris_radius_km": 4.2
13:44  INFO: β”‚  β”‚  }
13:44  INFO: β”‚  └─ (363.92ms) BigRedButton.launch_sequence [SLOW]
13:44  INFO: └─ (418.23ms) BigRedButton.press [SLOW]

Why omniray?

  • Zero-touch instrumentation β€” One call wraps every function and method in your codebase. No @decorator on each function, no manual setup per module.
  • Live call tree β€” See the full call hierarchy in your terminal as it happens, with color-coded timing (green/yellow/red) and [SLOW] tags on bottlenecks. Unlike cProfile or py-spy, there's no post-mortem step.
  • OpenTelemetry bridge β€” Flip one flag to export spans to Jaeger, Datadog, or any OTel-compatible backend. Cherry-pick which functions get spans.
  • Production-safe β€” Never masks exceptions, never wraps dunders or properties, skips already-wrapped functions. Designed to be safe even if accidentally left on.

Features

  • @trace decorator β€” Per-function control over logging, I/O capture, and OTel spans
  • I/O logging β€” Log function arguments and return values for selected functions
  • Conditional skip β€” Skip tracing for health checks or noisy functions via skip_if
  • Selective OpenTelemetry β€” Enable OTel spans on specific functions without global overhead
  • Custom wrappers β€” Build your own wrappers with the omniwrap engine
  • Configuration β€” Control paths, exclusions, and behavior via pyproject.toml and env vars

Performance

~250 ns per wrapped call (omniwrap). ~17 us per traced call with console output (omniray). A typical request tracing 50 functions adds under 1 ms.

Safety

omniray never wraps: dunder methods, properties, exception classes, already-wrapped functions, imported objects, functions decorated with @trace, or its own package. Exceptions are never masked β€” if your function raises, the exception propagates unchanged.

Environment Variables

Variable Type Default Description
OMNIWRAP bool false Enable/disable wrapping when enabled=None is passed to wrap_all()

The remaining omniray flags use a tri-state system:

  • true β€” enabled
  • false β€” kill switch (overrides all decorator parameters, cannot be turned back on per-function)
  • unset β€” local decides (decorator parameters or defaults apply)
Variable Type Default Description
OMNIRAY_LOG bool unset Console tree output
OMNIRAY_LOG_INPUT bool unset Log function arguments (requires OMNIRAY_LOG)
OMNIRAY_LOG_OUTPUT bool unset Log function return values (requires OMNIRAY_LOG)
OMNIRAY_LOG_COLOR bool true ANSI colors in console output
OMNIRAY_LOG_STYLE str auto Box-drawing style: unicode, ascii, or auto
OMNIRAY_OTEL bool unset OpenTelemetry span creation

Documentation

Read the full docs β€” configuration, API reference, performance benchmarks, examples, and more.

Contributing

See CONTRIBUTING.md for development setup and guidelines.

License

Apache 2.0 β€” see LICENSE for details.

About

Stop guessing! You and your AI can now see live what's happening inside your Python code with one call! 🩻 πŸ•΅

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors

Languages