trickster: Unable to handle scalar responses
If I send a simple scalar query such as /api/v1/query?query=5
trickster now returns errors. I bisected this and it seems that the error was introduced in ec4eff34d5532b1907723eeaabe620f02dd25b32 . The basic problem here is that trickster assumes the response type from prometheus as a vector, when in reality it can be (1) scalar (2) vector or (3) string. The way this worked before was that the unmarshal error was ignored and the response handed back (I have a patch that puts it back to that behavior.
From what I see that looks like caching won’t work on those scalar values – as it wasn’t able to unmarshal. Alternatively we could change the model to use model.Value
and then add some type-switching. But since that is a potentially large change I figured I’d get others’ input first.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 20 (15 by maintainers)
Commits related to this issue
- Workaround to handle scalar responses Workaround for #82 — committed to jacksontj/trickster by jacksontj 6 years ago
@jacksontj You at least have my support in updating the API client library to support POST requests (and other maybe still unsupported API features) 😃