Skip to main content

span-trace

Installation

pip install span-tree

Goals

  • Never have to look at log files again!
  • Make error debugging easy by capturing context around errors and traces instead of only a traceback and locals
  • Make health monitoring happening automatically
  • Make performance monitoring easy by automatically tracking and report slow spans
  • Support see once, annotate, and forget about it (instead of re-labeling the same error over and over...)

Features in library

  • trace-traces instead of flat log messages
    • a trace trace can have multiple "spans" as nodes
    • on each "node"
      • file_location
      • start and end timestamps
      • status: started|succeeded|failed
      • optional fields:
        • exit_error: if something fails without except
        • handled_errors: if we have errors caught with except and logged
        • level
    • each trace use a ksuid to ensure it is unique
    • each span has a name which is explicitly set or based on function name/call-context
    • traces are linked together when a new thread/task is started from an existing trace
  • Smart printing
    • to terminal when running on localhost
    • only json when running on cloud/only normal logging no stdout/stderr?
    • smart at grouping together tasks and flushing before exit
  • "test-mode": record all traces instead of just printing

How to use the library

Basically, an Enhanced stdlib logger:

from span_tree import get_logger

logger = get_logger(__name__)
logger.log(level,
           msg)  # level=debug|info|warning|error|critical, can also use `logger.info` logs will be attached to current span
logger(name: str, force_new_trace: bool = False, ** kwargs) -> `ContextManager[Span]`  # to start a new span/trace
logger.log_extra(msg: str = "", level: int = INFO, ** kwargs)  # to add attributes to span

Metadata

Release files for span-tree 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for span-tree 0.0.4
File Interpreter ABI Platform
span_tree-0.0.4-py3-none-any.whl Python 3 none any Details

Release files / span_tree-0.0.4-py3-none-any.whl

Download URL span_tree-0.0.4-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc34c5fd41dbbc31980c34ff27d9b64e1ed6384d71cccdb9adb292de7b9d58d0
BLAKE2b-256 checksum
How to use checksums
cee3cb8e9f946dbb64ba7d528bf7d17280e130d2171f5bdd621ba223e3b0bc14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.0.4 This release

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page