Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryansb/otelme
A low-friction OpenTelemetry wrapper for Python apps. It comes with sugar over basic spanning and the `tell` magic receiver
https://github.com/ryansb/otelme
Last synced: 3 months ago
JSON representation
A low-friction OpenTelemetry wrapper for Python apps. It comes with sugar over basic spanning and the `tell` magic receiver
- Host: GitHub
- URL: https://github.com/ryansb/otelme
- Owner: ryansb
- License: mit
- Created: 2021-08-26T19:57:07.000Z (over 3 years ago)
- Default Branch: dev
- Last Pushed: 2021-08-30T13:30:58.000Z (over 3 years ago)
- Last Synced: 2024-04-26T10:05:31.093Z (10 months ago)
- Language: Python
- Size: 23.4 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-repos - ryansb/otelme - A low-friction OpenTelemetry wrapper for Python apps. It comes with sugar over basic spanning and the `tell` magic receiver (Python)
README
# otelme - pronounced "Oh, tell me"
A low-friction OpenTelemetry wrapper for Python apps. It comes with sugar over basic spanning and the `tell` magic receiver.
## Usage
Use context managers or decorators to automatically create scoped spans:
```python
with telme.tell('update_user_record'):
telme.tell('a') | 'b'
...@telme.tell
def myfunc():
...@telme.tell('different_name')
def myfunc():
...
```Save the user friend count before adding to it and saving it to a variable
```python
new_count = telme.tell('friends') @ len(user.friends) + 1
```Save the result of `count + 1` as the attribute 'newcount' on the current span
```python
telme.tell('newcount') + count
new_count = telme.tell('newcount') + 1
```Use a splat (`*`) operator to add a whole dict a JSON attribute on the current trace
```python
telme.tell('explosion') * {'bang': 'loud', 'flame': 'big'}
# adds span attr: {'explosion': '{"bang": "loud", "flame": "big"}'
```Use double-splat (`**`) operator to hoist a dict by its keys on the current trace
```python
telme.tell('explosion') ** {'bang': 'loud', 'flame': 'big'}
# adds span attrs: {'explosion.bang': 'loud', 'explosion.flame': 'big'}
```Use `notify` with the splat (`*`) operator to add a dict as an event on the current trace
```python
telme.notify('explosion') ** {'bang': 'loud', 'flame': 'big'}
# adds new event `explosion` with attrs: {'bang': 'loud', 'flame': 'big'}
```Inspired by [pipe](https://github.com/JulienPalard/Pipe), [q](https://github.com/zestyping/q), and the `rollup_field` support in [Honeycomb's beeline](https://docs.honeycomb.io/getting-data-in/python/beeline/).
## Contributing
All help is welcome, especially help understanding how `otelme` is used and what other use cases we can help with. Not all pull requests will be accepted, before opening a PR with a feature please open an issue to discuss it to avoid doing work that can't be upstreamed.
## License
`otelme` is available under the MIT license, see `LICENSE` for details.