Categorygithub.com/hjet/mixin-metrics
modulepackage
0.0.0-20210811232040-beec95a14110
Repository: https://github.com/hjet/mixin-metrics.git
Documentation: pkg.go.dev

# README

⚠️ This project has been deprecated. Please see cortextool analyse which provides the same features ⚠️

mixin-metrics

License

Extract prometheus metrics from dashboard JSON and rules YAML.

Prerequisites

  • Go 1.16

Compile

go build mixin-metrics.go

Use

Parse rules configs in DIR

mixin-metrics --dir=DIR --out="metrics_out.json" rules

Replace DIR with directory containing Prometheus rules YAML files. By default will save parsed metrics in metrics_out.json.

Parse dashboard JSON files in DIR

mixin-metrics --dir=DIR dash 

Similar to above. Parses Grafana dashboard JSON files.

Join and print parsed metrics in Prom relabel-config format

mixin-metrics --dir=DIR --print dash

Use this output with relabel_config to drop or keep needed metrics. See Reducing Prometheus metrics usage with relabeling to learn more.

TODO

  • fail fast if parsing rules/dash with wrong flag
  • better docs
  • dashboard structs (no jq)
  • tests
  • binaries

# Functions

create MetricsFile struct.
parses through a dashboard to extract queries, and then metrics from queries.
iterates over all rules/dash files in dir.
use jq on a file to extract prom queries.
use promql parser on a query to extract metrics.
todo: separate rules and raw metrics parses through a rules file and extracts queries, and then metrics from queries.

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
todo: dashboard structs https://github.com/grafana-tools/sdk/issues/130#issuecomment-797018658 using jq for now.
No description provided by the author