Skip to content

unmarshalerDecoder Error with string query #423

@martialblog

Description

@martialblog

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions