prome-string
prometheus string generator
Install
npm install prome-string
Modules
Metric
Gauge
Counter
Histogram
Summary
Usage
Counter
- code
const Counter = ; const counter = name: 'counter_name' help: 'counter_help' labels: 'labelA' 'labelB'; counter;counter; console;
- result
# HELP counter_name counter_help# TYPE counter_name gaugecounter_name 1counter_name{labelA="A"} -1
Gauge
- code
const Gauge = ; const gauge = name: 'gauge_name' help: 'gauge_help' labels: 'labelA' 'labelB'; gauge;gauge; console
- result
# HELP gauge_name gauge_help# TYPE gauge_name gaugegauge_name 2gauge_name{labelA="A"} 4
Histogram
- code
const Histogram = ; const histogram = name: 'histogram_name' help: 'histogram_help' labels: 'labelA' 'labelB' buckets: 1 10 100 1000; histogram;histogram;histogram; console;
- result
# HELP histogram_name histogram_help# TYPE histogram_name histogramhistogram_name_bucket{le="1"} 0histogram_name_bucket{le="10"} 1histogram_name_bucket{le="100"} 1histogram_name_bucket{le="1000"} 2histogram_name_bucket{le="+Inf"} 2histogram_name_bucket{labelA="A",le="1"} 0histogram_name_bucket{labelA="A",le="10"} 0histogram_name_bucket{labelA="A",le="100"} 1histogram_name_bucket{labelA="A",le="1000"} 1histogram_name_bucket{labelA="A",le="+Inf"} 1histogram_name_sum 505histogram_name_sum{labelA="A"} 20histogram_name_count 2histogram_name_count{labelA="A"} 1
Summary
- code
const summary = name: 'summary_name' help: 'summary_help' labels: 'method' // percentiles: [0.01, 0.1, 0.5, 0.9, 0.99], <default> // queueLength: 1000, <default> // timeout: Infinity, <default>; summary;summary; summary;summary; console;
- result
# HELP summary_name summary_help# TYPE summary_name summarysummary_name{quantile=0.01,method="get"} 10summary_name{quantile=0.1,method="get"} 10summary_name{quantile=0.5,method="get"} 15summary_name{quantile=0.9,method="get"} 20summary_name{quantile=0.99,method="get"} 20summary_name{quantile=0.01,method="post"} 100summary_name{quantile=0.1,method="post"} 100summary_name{quantile=0.5,method="post"} 150summary_name{quantile=0.9,method="post"} 200summary_name{quantile=0.99,method="post"} 200summary_name_sum{method="get"} 30summary_name_sum{method="post"} 300summary_name_count{method="get"} 2summary_name_count{method="post"} 2