You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the Go client for Prometheus, but I wonder how to parse the response data in model.Value (including Vector and Matrix). I have checked the source code, only to find the String() method to get the Vector like {pod="test-001-deployment-896b6d55b-bs586"} => 0.06435052290435223 @[1598949467.625] {pod="test-003-deployment-665d48fb7f-dlxfb"} => 0.03620828100637146 @[1598949467.625]. So, how can I use the model data gracefully?
The text was updated successfully, but these errors were encountered:
It makes more sense to ask questions like this on the prometheus-users mailing list rather than in a GitHub issue. On the mailing list, more people are available to potentially respond to your question, and the whole community can benefit from the answers provided.
For anyone else stumbling upon this issue, model.Value is an interface.
If you're in the same situation that I am in, and you're trying to mock an API call from Prometheus that returns model.Value, you can use something like this:
model.Value(
model.Vector{
...
}
)
You're asking the Go compiler to treat this concrete type as the interface it implements.
I am using the Go client for Prometheus, but I wonder how to parse the response data in model.Value (including Vector and Matrix). I have checked the source code, only to find the String() method to get the Vector like
{pod="test-001-deployment-896b6d55b-bs586"} => 0.06435052290435223 @[1598949467.625] {pod="test-003-deployment-665d48fb7f-dlxfb"} => 0.03620828100637146 @[1598949467.625]
. So, how can I use the model data gracefully?The text was updated successfully, but these errors were encountered: