-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sporadic error happening: label ... was collected before with the same name and label values #1269
Comments
The error seems to be pointing towards an error in your logic somewhere. In your examples the snippet where you are incrementing your countervec is missing. I've seen this error in one of my implementations before too, and this occurred when trying to set a metric with a labelset (thus a vector) with duplicate label values in them. This results in a metric with the same name and label values, but a different value and thus that error is thrown. |
@marevers The labels i am adding to my metric are statusCode, method, and path. |
same errors, try lots of ways, but errors still exist. |
Hey, those kind of errors are typically happening with custom collectors with duplicated constant metrics by author. It's weird that here, it looks like it occurs with normal metrics. Normally if you duplicate new basic metric, the register will panic or error, depending if you use Must or not. To uncover what's happening a simple @liubq919 could help us creating one, since you say you can repro it with fiber? |
Same problem with fiber. Has anyone successfully resolved this issue? |
Hi, the same problem for me in the project with fiber framework and similar connection. |
@ryap-pepperstone @YuriyChmil @liubq919 Hi! can you try using
to collect method data instead of your variant
|
We too encountered something similar, and it looks like issue isn't on prometheus side - it's Fiber. Basically Fiber returns strings that aren't really immutable. They added it to their documentation - a lot of discussion around "immutable": https://docs.gofiber.io (and this issue around it gofiber/fiber#185) I have to say though from Fiber's side it's still very error-prone because strings in Go are considered immutable so it's easy to make a mistake. |
@ryap-pepperstone, you are using Fiber, in Fiber http parameters, body unsafe and mutable. Set Immutable: true in fiber.Config. |
Hi Team!
This error has been happening sporadically in a live environment. I am unable to replicate the issue using unit tests. My error could be related to this guy but i will be adding more details
I am using v1.15.0 with Golang 1.19.3. I am also using fiber golang v2.44.0 to expose the metrics endpoint. To convert the prometheus handler to a fiber handler, i am using gofiber adaptor v2.2.1
This is as far as i can trace it. I am unable to comprehend the things inside the Gather() function due to my limited knowledge of the library. That function is returning an error.
Raw Error
Bits and pieces of my implementation
How i am registering the metrics
How i am registering the GET endpoint
Function to increment my metric
Middleware where the metric gets incremented
Any help would be appreciated!
Thank you!
The text was updated successfully, but these errors were encountered: