Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dapplion/prometheus-drop-high-cardinality
https://github.com/dapplion/prometheus-drop-high-cardinality
Last synced: about 19 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/dapplion/prometheus-drop-high-cardinality
- Owner: dapplion
- Created: 2022-05-30T09:11:19.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-05-30T09:24:51.000Z (over 2 years ago)
- Last Synced: 2024-12-28T06:48:05.124Z (10 days ago)
- Language: Python
- Size: 1000 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Prometheus drop high cardinality
Drop metrics that have cardinality above some number:
```
cat sample_metrics.txt | python prometheus_drop_high_cardinality.py 5
```Input:
```
# HELP metric_name_1 Metric 1
# TYPE metric_name_1 gauge
metric_name_1{label_a="1"} 1
metric_name_1{label_a="2"} 1
metric_name_1{label_a="3"} 1
metric_name_1{label_a="4"} 1
metric_name_1{label_a="5"} 1
metric_name_1{label_a="6"} 1
metric_name_1{label_a="7"} 1
metric_name_1{label_a="8"} 1# HELP metric_name_2 Metric 2
# TYPE metric_name_2 gauge
metric_name_2{label_b="1"} 1
metric_name_2{label_b="2"} 1
metric_name_2{label_b="3"} 1# HELP metric_name_3 Metric 3
# TYPE metric_name_3 gauge
metric_name_3{label_a="1",label_c="1"} 1
metric_name_3{label_b="1",label_c="1"} 1
```Output:
```
# HELP metric_name_1 Metric 1
# TYPE metric_name_1 gauge# HELP metric_name_2 Metric 2
# TYPE metric_name_2 gauge
metric_name_2{label_b="1"} 1
metric_name_2{label_b="2"} 1
metric_name_2{label_b="3"} 1# HELP metric_name_3 Metric 3
# TYPE metric_name_3 gauge
metric_name_3{label_b="1",label_c="1"} 1
```