Skip to content

Commit

Permalink
fix: Fixes detected labels API wiring (#12442)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyriltovena authored Apr 3, 2024
1 parent 643f353 commit fbb8686
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/querier/queryrange/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,6 @@ func decodeResponseJSON(r *http.Response, req queryrangebase.Request) (queryrang
}

func decodeResponseJSONFrom(buf []byte, req queryrangebase.Request, headers http.Header) (queryrangebase.Response, error) {

switch req := req.(type) {
case *LokiSeriesRequest:
var resp LokiSeriesResponse
Expand Down Expand Up @@ -1136,6 +1135,15 @@ func decodeResponseJSONFrom(buf []byte, req queryrangebase.Request, headers http
Response: &resp,
Headers: httpResponseHeadersToPromResponseHeaders(headers),
}, nil
case *DetectedLabelsRequest:
var resp logproto.DetectedLabelsResponse
if err := json.Unmarshal(buf, &resp); err != nil {
return nil, httpgrpc.Errorf(http.StatusInternalServerError, "error decoding response: %v", err)
}
return &DetectedLabelsResponse{
Response: &resp,
Headers: httpResponseHeadersToPromResponseHeaders(headers),
}, nil
default:
var resp loghttp.QueryResponse
if err := resp.UnmarshalJSON(buf); err != nil {
Expand Down Expand Up @@ -1749,9 +1757,11 @@ func (p paramsRangeWrapper) End() time.Time {
func (p paramsRangeWrapper) Step() time.Duration {
return time.Duration(p.GetStep() * 1e6)
}

func (p paramsRangeWrapper) Interval() time.Duration {
return time.Duration(p.GetInterval() * 1e6)
}

func (p paramsRangeWrapper) Direction() logproto.Direction {
return p.GetDirection()
}
Expand Down

0 comments on commit fbb8686

Please sign in to comment.