Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/denisidoro/pipers
Use pipe expressions in your PromQL queries or code!
https://github.com/denisidoro/pipers
grafana pipe prometheus query
Last synced: 3 months ago
JSON representation
Use pipe expressions in your PromQL queries or code!
- Host: GitHub
- URL: https://github.com/denisidoro/pipers
- Owner: denisidoro
- Created: 2021-02-28T18:04:46.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-03T12:47:42.000Z (almost 4 years ago)
- Last Synced: 2024-05-13T05:09:26.616Z (8 months ago)
- Topics: grafana, pipe, prometheus, query
- Language: JavaScript
- Homepage: https://denisidoro.github.io/pipers
- Size: 328 KB
- Stars: 14
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pipers
Use pipe expressions in your PromQL queries or code!
For example, the following query...
```coffee
sum(irate(node_cpu_seconds_total{instance=~"$node:$port",job=~"$job"}(node_cpu_seconds_total){mode='idle'}[5m](node_cpu_seconds_total{instance=~"$node:$port",job=~"$job"}(node_cpu_seconds_total)))) / count(count(node_cpu_seconds_total{instance=~"$node:$port",job=~"$job"}(node_cpu_seconds_total)) by (cpu))
```
...can be written as:
```coffee
cpuSeconds = node_cpu_seconds_total
| x -> x{instance=~"$node:$port",job=~"$job"}cpuCount = cpuSeconds
| s -> count(s) by (cpu)
| countcpuIdle = cpuSeconds
| s -> s{mode='idle'}[5m]
| irate
| sumcpuIdle / cpuCount
```## Syntax and live playground
Check [this page](https://denisidoro.github.io/pipers/) to try it out!
## Using it inside your IDE
### add the binary to your `$PATH`
```bash
git clone https://github.com/denisidoro/pipers
cargo build --release
```
### setup your IDE accordinglyE.g., in VSCode you can use the [Filter Text](https://marketplace.visualstudio.com/items?itemName=yhirose.FilterText) extension:
![Demo](https://user-images.githubusercontent.com/3226564/109806044-f9f08380-7c02-11eb-9429-92d26ee7084c.gif)