prometheus_client_php icon indicating copy to clipboard operation
prometheus_client_php copied to clipboard

Counters, gauges and histograms init with zero values

Open EdgarSedov opened this issue 3 years ago • 3 comments

Atm u can't create histogram with zero value upfront (for correct grafana increase function to work), because it will increment _count and mess with averages in future. It would be nice to have initialization mechanics (for example, on register method), as discussed in other clients, like here or here

I'm not that good at redis and lua, i've looked into current updateSomething realizations for redis and couln't come up with solution, but if u'll point me in right direction, i think i can try to help

EdgarSedov avatar Mar 09 '21 16:03 EdgarSedov

Hey @EdgarSedov,

good point! I already looked a bit into the code and I don't think this is easy solvable. The "problem" is that we only set the value/metric when you call inc/set/observe on the specific metric types. Before it does not "reach" the underlying storage and will be "thrown" away. I will think about it a bit more, but I think we can not fix it with the current architecture for this library.

LKaemmerling avatar Mar 10 '21 05:03 LKaemmerling

@LKaemmerling Hi' i've made a draft with possible solution, please take a look when u'll have some time

EdgarSedov avatar Mar 12 '21 13:03 EdgarSedov

@LKaemmerling is there any plan on this ? I saw the PR didn't move since 2 years ?

jaugustin avatar Jun 30 '23 16:06 jaugustin