Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/michaelboulton/starlark_config_example
- Owner: michaelboulton
- License: mit
- Created: 2021-05-22T12:37:54.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-05-30T13:27:11.000Z (over 3 years ago)
- Last Synced: 2024-10-11T14:10:38.396Z (28 days ago)
- Topics: bazel, prometheus, protobuf, starlark
- Language: Starlark
- Homepage:
- Size: 117 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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```