|
| 1 | +# mtypes |
| 2 | + |
| 3 | +Go CLI gathering statistics around the distribution of types, average number of buckets (and more) across your Prometheus metrics/series. |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +The main usage allows to take resource (from stdin, file or HTTP /metrics endpoint) and calculate type statistics e.g.: |
| 8 | + |
| 9 | +```bash |
| 10 | +go install github.com/prometheus-community/avalanche/cmd/mtypes@latest # or locally: alias mtypes="go run ./cmd/mtypes" |
| 11 | +$ mtypes -resource=http://localhost:9090/metrics |
| 12 | +$ mtypes -resource=./cmd/mtypes/exampleprometheustarget.txt |
| 13 | +$ cat ./cmd/mtypes/exampleprometheustarget.txt | mtypes |
| 14 | +``` |
| 15 | + |
| 16 | +```bash |
| 17 | +Metric Type Metric Families Series (adjusted) Series (adjusted) % Average Buckets/Objectives |
| 18 | +GAUGE 76 93 (93) 31.958763 (16.909091) - |
| 19 | +COUNTER 96 157 (157) 53.951890 (28.545455) - |
| 20 | +HISTOGRAM 8 14 (186) 4.810997 (33.818182) 11.285714 |
| 21 | +SUMMARY 15 27 (114) 9.278351 (20.727273) 2.222222 |
| 22 | +--- --- --- --- --- |
| 23 | +* 195 291 (550) 100.000000 (100.000000) - |
| 24 | +``` |
| 25 | + |
| 26 | +> NOTE: "Adjusted" series, means actual number of individual series stored in Prometheus. Classic histograms and summaries are stored as a set of counters. This is relevant as the cost of indexing new series is higher than storing complex values (this is why we slowly move to native histograms). |
| 27 | +
|
| 28 | +Additionally, you can pass `--avalanche-flags-for-adjusted-series=10000` to print Avalanche v0.6.0+ flags to configure, for avalanche to generate metric target with the given amount of adjusted series, while maintaining a similar distribution e.g. |
| 29 | + |
| 30 | +```bash |
| 31 | +cat ./cmd/mtypes/exampleprometheustarget.txt | mtypes --avalanche-flags-for-adjusted-series=1000 |
| 32 | +Metric Type Metric Families Series (adjusted) Series (adjusted) % Average Buckets/Objectives |
| 33 | +GAUGE 76 93 (93) 31.958763 (16.909091) - |
| 34 | +COUNTER 96 157 (157) 53.951890 (28.545455) - |
| 35 | +HISTOGRAM 8 14 (186) 4.810997 (33.818182) 11.285714 |
| 36 | +SUMMARY 15 27 (114) 9.278351 (20.727273) 2.222222 |
| 37 | +--- --- --- --- --- |
| 38 | +* 195 291 (550) 100.000000 (100.000000) - |
| 39 | + |
| 40 | +Avalanche flags for the similar distribution to get to the adjusted series goal of: 1000 |
| 41 | +--gauge-metric-count=16 |
| 42 | +--counter-metric-count=28 |
| 43 | +--histogram-metric-count=2 |
| 44 | +--histogram-metric-bucket-count=10 |
| 45 | +--native-histogram-metric-count=0 |
| 46 | +--summary-metric-count=5 |
| 47 | +--summary-metric-objective-count=2 |
| 48 | +--series-count=10 |
| 49 | +--value-interval=300 # Changes values every 5m. |
| 50 | +--series-interval=3600 # 1h series churn. |
| 51 | +--metric-interval=0 |
| 52 | +This should give the total adjusted series to: 900 |
| 53 | +``` |
0 commit comments