-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
The API client functions all follow this pattern, where they make an http call to get back a []byte
then decode the JSON:
client_golang/api/prometheus/v1/api.go
Lines 830 to 836 in f63e219
_, body, warnings, err := h.client.DoGetFallback(ctx, u, q) | |
if err != nil { | |
return nil, warnings, err | |
} | |
var qres queryResult | |
return model.Value(qres.v), warnings, json.Unmarshal(body, &qres) |
For larger responses, this buffer gets quite expensive (see #976).
I propose that instead we parse JSON from the response body as it comes in.
I can see that this would make handling timeouts more complicated.
kakkoyun