Skip to content

Commit

Permalink
Workaround to handle scalar responses
Browse files Browse the repository at this point in the history
Workaround for trickstercache#82
  • Loading branch information
jacksontj committed Jul 11, 2018
1 parent 952ba2d commit 0fe2831
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,11 @@ func (t *TricksterHandler) getVectorFromPrometheus(url string, params url.Values
// Unmarshal the prometheus data into another PrometheusMatrixEnvelope
err = json.Unmarshal(body, &pe)
if err != nil {
return pe, nil, fmt.Errorf("Prometheus vector unmarshaling error for URL %q: %v", url, err)
// If we get a scalar response, we just want to return the resp without an error
// this will allow the upper layers to just use the raw response
if pe.Data.ResultType != "scalar" {
return pe, nil, fmt.Errorf("Prometheus vector unmarshaling error for URL %q: %v", url, err)
}
}

return pe, resp, nil
Expand Down

0 comments on commit 0fe2831

Please sign in to comment.