Use trees, traces, and spans and never read a log message again!
Project description
span-trace
- see context info in Github Repo
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
- exit_error: if something fails without
- 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
span_tree-0.0.4-py3-none-any.whl
(13.8 kB
view details)
File details
Details for the file span_tree-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: span_tree-0.0.4-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc34c5fd41dbbc31980c34ff27d9b64e1ed6384d71cccdb9adb292de7b9d58d0 |
|
MD5 | 3bac11ccd2018eb1ddb50beb9eb3f440 |
|
BLAKE2b-256 | cee3cb8e9f946dbb64ba7d528bf7d17280e130d2171f5bdd621ba223e3b0bc14 |