I am instrumenting application metrics using the prometheus go client.
I am using the prometheus handler to expose the metrics.
Blockquote
import (
“github.com/gofiber/adaptor/v2”
“github.com/prometheus/client_golang/prometheus/promhttp”
)
func MetricsRoutes(api fiber.Router) {
api.Get(“/metrics”, adaptor.HTTPHandler(promhttp.Handler()))
}
On scrape from prometheus, the target starts throwing 500 server error after a few scrapes. This happens only in some environments.
when i tried to hit the /metrics endpoint, i got the following error.
<metric_name> was collected before with the same name and label values
I understand that the go client is throwing it while checking for metric consistency but no clue of why its happening? It works fine in my local environment