Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bmwant/spoor
Track invocations of methods and functions
https://github.com/bmwant/spoor
ab-testing apm data-collection debugging library-tools metrics metrics-gathering performance profiling python statistics summary tools tracing tracking utility
Last synced: 13 days ago
JSON representation
Track invocations of methods and functions
- Host: GitHub
- URL: https://github.com/bmwant/spoor
- Owner: bmwant
- Created: 2022-12-23T11:14:40.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-24T11:16:48.000Z (almost 2 years ago)
- Last Synced: 2024-11-23T05:12:07.602Z (about 1 month ago)
- Topics: ab-testing, apm, data-collection, debugging, library-tools, metrics, metrics-gathering, performance, profiling, python, statistics, summary, tools, tracing, tracking, utility
- Language: Python
- Homepage:
- Size: 134 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
## spoor
![Tests](https://github.com/bmwant/spoor/actions/workflows/tests.yml/badge.svg)
[![PyPI](https://img.shields.io/pypi/v/spoor)](https://pypi.org/project/spoor/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/spoor)[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![EditorConfig](https://img.shields.io/badge/-EditorConfig-grey?logo=editorconfig)](https://editorconfig.org/)
[![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)Track invocation of your functions and methods; display collected statistics for the invocations; export data gathered to external services.
```bash
$ pip install spoor
```### Usage
```python
from spoor import Spoors = Spoor()
@s.track
def func(a: int, b: int) -> int:
return a + bfunc(5, 10)
func(23, 42)assert s.called(func)
assert s.call_count(func) == 2
```### Configuration
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `attach` | `bool` | `False` | Expose `called`/`call_count` attributes directly on a function/method object. |
|`distinct_instances` | `bool` | `False` | Separate metrics collection for each instance of a class. Has no effect if tracking only functions. |
|`skip_dunder` | `bool` | `True` | Do not track double underscore method calls (like `__str__`) for class instances. Has no effect if tracking only functions. |
| `disabled` | `bool` | `False` | Initialize as inactive and ignore metrics collection until enabled explicitly. Can be controlled via `enable()`/`disable()` methods later. |### Exporters
* [statsd](#)
* [DataDog](#)### Limitations
* No support for `staticmethod` tracking yet
* No support for `classmethod` tracking yet### See also
* π [podmena](https://github.com/bmwant/podmena) for nice commits emoji
* π [rich](https://github.com/Textualize/rich) for beautiful terminal output
* πΊπ¦ [United 24](https://u24.gov.ua/) to support Ukraine in the war