Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/michaelboulton/starlark_config_example

example to generate prometheus config from starlark
https://github.com/michaelboulton/starlark_config_example

bazel prometheus protobuf starlark

Last synced: 4 days ago
JSON representation

example to generate prometheus config from starlark

Awesome Lists containing this project

README

        

# 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

```