Skip to content

example to generate prometheus config from starlark

License

Notifications You must be signed in to change notification settings

michaelboulton/starlark_config_example

Repository files navigation

Starlark prometheus config generator

Generate prometheus config file from a starlark file

Regenerate:

bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%go_dependencies -prune=true
bazel run //:gazelle -- fix

Usage

  • Modify cfg/prometheus.bzl
  • Run bazel run //cmd

Example:

$ bazel run //cmd
INFO: Build options --compilation_mode, --dynamic_mode, and --test_sharding_strategy have changed, discarding analysis cache.
INFO: Analyzed target //cmd:cmd (77 packages loaded, 8320 targets configured).
INFO: Found 1 target...
Target //cmd:cmd up-to-date:
  bazel-bin/cmd/cmd_/cmd
INFO: Elapsed time: 0.875s, Critical Path: 0.27s
INFO: 3 processes: 1 internal, 2 linux-sandbox.
INFO: Build completed successfully, 3 total actions
INFO: Build completed successfully, 3 total actions
global_config:
  scrape_interval_seconds: 2
scrape_config:
- job: service_1
  metric_relabel_configs:
  - regex: (.+)
    source_labels:
    - old_1
    - old_2
    target_label: new
  metrics_path: /metrics
- job: service_2
  metric_relabel_configs:
  - regex: (.+)
    source_labels:
    - old_1
    - old_2
    target_label: new
  metrics_path: /metrics

About

example to generate prometheus config from starlark

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published