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: 8 months 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 (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-24T11:16:48.000Z (over 3 years ago)
- Last Synced: 2025-09-06T21:41:32.045Z (10 months 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

[](https://pypi.org/project/spoor/)

[](https://github.com/pre-commit/pre-commit)
[](https://github.com/psf/black)
[](https://editorconfig.org/)
[](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 Spoor
s = Spoor()
@s.track
def func(a: int, b: int) -> int:
return a + b
func(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