Hi,
I was wondering if this is a bug or if I'm just using the library wrong.
When trying to send a String query to the server with the golang client like so:
result, warnings, err := v1api.Query(ctx, "\"up\"", time.Now(), v1.WithTimeout(5*time.Second))
It results in an error:
Error querying Prometheus: unmarshalerDecoder: unexpected value type "string", error found in #10 byte of ...|.97,"up"]}|..., bigger context ...|esultType":"string","result":[1670860804.97,"up"]}|... exit status 1
Since server accepts the query when I send it via curl for example, everything seems fine:
curl --data-urlencode 'query="up"' localhost:9090/api/v1/query
{"status":"success","data":{"resultType":"string","result":[1670861105.448,"up"]}}
Since the golang client tried to decode the JSON into a v model.Value I opened the issue here.
I know that the docs say that:
String - a simple string value; currently unused
but I assumed the library would still be able to parse the response.
Cheers
Markus
Hi,
I was wondering if this is a bug or if I'm just using the library wrong.
When trying to send a String query to the server with the golang client like so:
result, warnings, err := v1api.Query(ctx, "\"up\"", time.Now(), v1.WithTimeout(5*time.Second))It results in an error:
Error querying Prometheus: unmarshalerDecoder: unexpected value type "string", error found in #10 byte of ...|.97,"up"]}|..., bigger context ...|esultType":"string","result":[1670860804.97,"up"]}|... exit status 1Since server accepts the query when I send it via curl for example, everything seems fine:
Since the golang client tried to decode the JSON into a v model.Value I opened the issue here.
I know that the docs say that:
but I assumed the library would still be able to parse the response.
Cheers
Markus