Closed achille-roussel closed 7 years ago
Looks good to me dude! Let's 🚢
Alright I made a couple of optimizations to the code so there's no dynamic memory allocations, I'm pretty satisfied with the state of the code now so unless someone has a concern I'll go ahead and merge.
$ go test -v -run _ ./prometheus/ -bench . -benchmem -memprofile /tmp/mem
BenchmarkAppendMetric/simple_counter_metric-4 10000000 146 ns/op 0 B/op 0 allocs/op
BenchmarkAppendMetric/simple_gauge_metric-4 10000000 147 ns/op 0 B/op 0 allocs/op
BenchmarkAppendMetric/simple_histogram_metric-4 5000000 230 ns/op 0 B/op 0 allocs/op
BenchmarkAppendMetric/counter_metric_with_help,_floating_point_value,_labels,_and_timestamp-4 3000000 545 ns/op 0 B/op 0 allocs/op
BenchmarkHandleMetric/counter-4 5000000 260 ns/op 0 B/op 0 allocs/op
BenchmarkHandleMetric/gauge-4 5000000 256 ns/op 0 B/op 0 allocs/op
BenchmarkHandleMetric/histogram-4 5000000 250 ns/op 0 B/op 0 allocs/op
BenchmarkHash/standard_hash_function-4 10000000 107 ns/op 333.80 MB/s 56 B/op 2 allocs/op
BenchmarkHash/hash_function-4 20000000 73.0 ns/op 493.42 MB/s 0 B/op 0 allocs/op
PASS
ok github.com/segmentio/stats/prometheus 14.271s
Thanks for the reviews guys!
Hey guys, here's the implementation of a metrics handler to support feeding stats into Prometheus.
The code is not complete but it's functioning well enough and that I want to open it for review and discussions on some design decisions.
See more comments inline.