zsais / go-gin-prometheus

Gin Web Framework Prometheus metrics exporter
MIT License
450 stars 133 forks source link

How to Increment Custom Metric #48

Closed lmcdasm closed 3 years ago

lmcdasm commented 3 years ago

ok.. so im a bit stumped here.

i have the custom metrics implemented (so i can see them show up when i have my server running):

image

However, even with looking with the answer provided to nizarayari, i dont see how to apply the .Inc() method to the custom metric.

I have tried as well looking at the other example, however the prometheus.Register(numErrors) example never ends up showing up in the gin metrics list (as the test ones outlined above are).

any pointers would be wonderful! D

lmcdasm commented 3 years ago

i figured it out.. the prometheus.Register call was working fine (with a call to func IncrementMe - not shown) - i was just not spinning the counter to see it at start :(