Skip to content

Instantly share code, notes, and snippets.

@franzwong
Last active August 8, 2023 08:29
Show Gist options
  • Save franzwong/73cc1861bd4c75b35778c15fcc36cea9 to your computer and use it in GitHub Desktop.
Save franzwong/73cc1861bd4c75b35778c15fcc36cea9 to your computer and use it in GitHub Desktop.
example of prometheus kdb exporter
/ Usage: rlwrap q main.q -p 8080
/ Metrics can be viewed at http://localhost:8080/metrics
/ extract.q can be downloaded in https://github.com/KxSystems/prometheus-kdb-exporter
system"l /src/prometheus-kdb-test/lib/extract.q"
labelkeys:`city
labelvalues:enlist "Tokyo"
.prom.newmetric[`temperature;`gauge;labelkeys;"Temperature"]
temp:.prom.addmetric[`temperature;labelvalues;();33]
.prom.on_poll:{[msg]
.prom.updval[temp;:;first 30 + 1?10];}
.prom.init[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment