yabeda-rb / yabeda-prometheus

Adapter to expose metrics collected by Yabeda plugins to Prometheus
MIT License
113 stars 18 forks source link

Counter metricts not working with prometheus-client-mmap #7

Closed alexander37137 closed 5 years ago

alexander37137 commented 5 years ago

Counter metricts not working with prometheus-client-mmap Only histogram metrics works with prometheus-client all metrics work fine

looks like it because yabeda-prometheus do not send counter metric to prometheus client https://github.com/yabeda-rb/yabeda-prometheus/blob/master/lib/yabeda/prometheus/adapter.rb#L20 and keep it in registry metric https://github.com/yabeda-rb/yabeda/blob/f73bf8e15797362599a101a52ca896081870d965/lib/yabeda/counter.rb#L15

prometheus client when exporting metrics read it from registry https://github.com/prometheus/client_ruby/blob/9bae72520e7fdadab983ddd2cd40832e37489793/lib/prometheus/client/formats/text.rb#L26, but prometheus-client-mmap read it directly from files https://gitlab.com/gitlab-org/prometheus-client-mmap/blob/master/lib/prometheus/client/formats/text.rb#L30

I think quick fix will be to send counter metrics to adapter, and better fix will be to use new version of prometheus client with support of pre fork server

Envek commented 5 years ago

I will take a look in a couple of days. Sorry for the late reply!