HeraclesQL - A Python DSL for writing VictoriaMetrics Queries
🚧 HeraclesQL is available now, but this repo is still under construction! 🚧
HeraclesQL is a Python package which provides a type-safe embedded domain specific language for writing VictoriaMetrics MetricsQL queries.
Highlights include:
- MetricsQL-like syntax - HeraclesQL will be immediately familiar to anyone who's written MetricsQL or PromQL!
- Custom Functions and Parameterizable Expressions - No more copy and pasting behavior between alerts!
- Static Type Safety - MyPy and your editor will catch common problems before they occur!
- Variables - Complicated alerts can be expressed imperatively!
- Meta-alerts - Generate alerts about your alerts to avoid common pitfalls!
Installation
HeraclesQL is available on PyPi. Just pip install heracles-ql
HeraclesQL depends on native code in a few places. Right now, we provide binaries for manylinux_2_34_x86_64.
Otherwise, we provide an sdist that includes the native source code. In order to build the sdist, you'll need a modern Go compiler.
Example
HeraclesQL lets you write MetricsQL queries as Python. For example,
from heracles import ql
v = ql.Selector()
my_query = ql.rate(v.my_interesting_metric(useful="label")[5 * ql.Minute])
print(ql.format(my_query.render()))
# rate(my_interesting_metric{useful="label"}[5m])
Release files for heracles-ql 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| heracles_ql-0.2.1.tar.gz | 33.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| heracles_ql-0.2.1-py3-none-manylinux_2_34_x86_64.whl | Python 3 | none | Linux glibc 2.34+ x86-64 | Details |
Total release size: 18.0 MB
Release files / heracles_ql-0.2.1.tar.gz
| Download URL | heracles_ql-0.2.1.tar.gz |
|---|---|
| Size | 33.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c36779b2d9c0141e1162e9f7f105aee49d428489f79e840bbbabaaa133bcbdc0
|
|
BLAKE2b-256 checksum How to use checksums |
c6b964a9a12c3fa593b908eaa748da2be83d1584bf50d2eeb296e1298b4b6e09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / heracles_ql-0.2.1-py3-none-manylinux_2_34_x86_64.whl
| Download URL | heracles_ql-0.2.1-py3-none-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 18.0 MB |
| Tags | Linux glibc 2.34+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
cae03817dc18a697c0c2f1c069b33468a50ca16262040cc34f3eaf26417c6552
|
|
BLAKE2b-256 checksum How to use checksums |
ecbf2df6a187d43c453a71bcc698d5d7ccc5a682df9343f0f3a0e01dc119dd48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|