Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kyle-verhoog/datadog-python
kyle's vision of how datadog's python client should look
https://github.com/kyle-verhoog/datadog-python
Last synced: 23 days ago
JSON representation
kyle's vision of how datadog's python client should look
- Host: GitHub
- URL: https://github.com/kyle-verhoog/datadog-python
- Owner: Kyle-Verhoog
- Created: 2021-11-19T00:50:43.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-19T19:35:43.000Z (11 months ago)
- Last Synced: 2024-10-30T21:51:31.157Z (2 months ago)
- Language: Python
- Size: 69.3 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# kyle's datadog python vision/proposal
_not for production use_
See [`examples/comprehensive.py`](examples/comprehensive.py) for a mostly
working example of the proposed API.## 📈🐶 ❤️ 🐍
✅ traces, metrics, logs, profiles, application security
✅ unified configuration
✅ trace-logs correlation by default
✅ trace-aware metrics
✅ typed and validated configuration### API
```python
from datadog import DDClient, DDConfig# Options are
# - type-checked + validated
# - available as corresponding environment vars
ddcfg = DDConfig(
agent_url="localhost",
datadog_site="us1.datadoghq.com",
service="my-python-service",
env="prod",
version="0.01",
tracing_enabled=True,
tracing_patch=True,
tracing_modules=["django", "redis", "psycopg2"],
tracing_sampling_rules=[("my-python-service", "prod", 0.02)],
profiling_enabled=True,
security_enabled=True,
runtime_metrics_enabled=True,
)
ddclient = DDClient(config=ddcfg)# metrics
ddclient.gauge()
ddclient.measure()
ddclient.count()
ddclient.flush_metrics()# logs
ddclient.log()
ddclient.warning()
ddclient.exception()
ddclient.info()
ddclient.debug()
log = ddclient.getLogger()
ddclient.LogHandler() # or datadog.DDLogHandler()
ddclient.flush_logs()# tracing
ddclient.trace()
ddclient.traced()
ddclient.patch()
ddclient.flush_traces()# profiling
ddclient.profiling_start()
ddclient.profiling_stop()
ddclient.flush_profiles()
```### `ddtrace-run`
I propose `datadog-run` which will install a default `DDClient`, initialized only via environment variable
to `datadog.client`. Essentially `sitecustomize.py` would just be something like:```python
import datadog
from datadog import DDConfig, DDClient_DEFAULT_CONFIG = dict(
tracing_patch=True, # different from the default when using the library manually
# ... rest of defaults
)datadog.client = DDClient(DDConfig(default_config=_DEFAULT_CONFIG))
```## open questions/concerns
- What API is exposed for flushing data?
- Unified for entire client?
- Reuse connections/batch data for performance.
- Must allow both automatic + manual strategies
- Buffer size
- Flush period
- What to use to locate an agent?
- UDS vs HTTP(S) support
- URL is weird/not intuitive with unix sockets
- Should config values store whether they are user defined?