zapier / prom-aggregation-gateway

An aggregating push gateway for Prometheus
Mozilla Public License 2.0
122 stars 27 forks source link

add quick logic for jobs to be passed in the uri path #35

Closed mplachter closed 1 year ago

mplachter commented 1 year ago

Quick implementation for passed job name in URI to be added to metrics as labels, this is to prevent different metrics from clobbering together from different jobs.

Before Benchmark

pkg: prom-aggregation-gateway
BenchmarkConcurrentAggregate/metric_type_simpleGauge-10                   160633             76634 ns/op           87347 B/op       1313 allocs/op
BenchmarkConcurrentAggregate/metric_type_fullMetrics-10                    85020            141702 ns/op          194174 B/op       3773 allocs/op
BenchmarkConcurrentAggregate/metric_type_multiLabel-10                    228883             51287 ns/op           64626 B/op        673 allocs/op
BenchmarkConcurrentAggregate/metric_type_multiLabelIgnore-10              236571             50984 ns/op           65026 B/op        703 allocs/op
BenchmarkConcurrentAggregate/metric_type_labelFields-10                   229822             49480 ns/op           61830 B/op        553 allocs/op
BenchmarkConcurrentAggregate/metric_type_reorderedLabels-10               247396             48567 ns/op           63026 B/op        603 allocs/op
BenchmarkConcurrentAggregate/metric_type_ignoredLabels-10                 247699             48915 ns/op           64866 B/op        703 allocs/op
PASS
ok      prom-aggregation-gateway        88.855s

After Benchmark

pkg: prom-aggregation-gateway
BenchmarkConcurrentAggregate/metric_type_simpleGauge-10                   151737             80920 ns/op           90707 B/op       1403 allocs/op
BenchmarkConcurrentAggregate/metric_type_fullMetrics-10                    83394            149929 ns/op          197534 B/op       3893 allocs/op
BenchmarkConcurrentAggregate/metric_type_multiLabel-10                    212082             54311 ns/op           65425 B/op        693 allocs/op
BenchmarkConcurrentAggregate/metric_type_multiLabelIgnore-10              228790             51045 ns/op           66146 B/op        733 allocs/op
BenchmarkConcurrentAggregate/metric_type_labelFields-10                   251012             47880 ns/op           62790 B/op        583 allocs/op
BenchmarkConcurrentAggregate/metric_type_reorderedLabels-10               257607             50677 ns/op           64146 B/op        633 allocs/op
BenchmarkConcurrentAggregate/metric_type_ignoredLabels-10                 228663             49682 ns/op           65986 B/op        733 allocs/op
PASS
ok      prom-aggregation-gateway        89.613s

This was quick and dirty, this can be optimized.