Skip to content

HeraclesQL is a Python DSL for writing alerts!

License

Notifications You must be signed in to change notification settings

hudson-trading/heracles-ql

Repository files navigation

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])

About

HeraclesQL is a Python DSL for writing alerts!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages