mirror of https://github.com/prometheus/prometheus
Remove work-around that required copying all bytes of a scrape.
Now that the subtle bug in matttproud/golang_protobuf_extensions is fixed, we do not need to copy the bytes of a scrape into a buffer first before starting to parse it. Change-Id: Ib73ecae16173ddd219cda56388a8f853332f8853changes/55/255/1
parent
6b325bfbde
commit
dfb9c2a072
|
@ -14,7 +14,6 @@
|
|||
package retrieval
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -264,14 +263,6 @@ func (t *target) scrape(timestamp clientmodel.Timestamp, ingester extraction.Ing
|
|||
baseLabels[baseLabel] = baseValue
|
||||
}
|
||||
|
||||
// N.B. - It is explicitly required to extract the entire payload before
|
||||
// attempting to deserialize, as the underlying reader will interpret
|
||||
// pending data as a truncated message.
|
||||
buf := new(bytes.Buffer)
|
||||
if _, err := buf.ReadFrom(resp.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
i := &MergeLabelsIngester{
|
||||
Labels: baseLabels,
|
||||
CollisionPrefix: clientmodel.ExporterLabelPrefix,
|
||||
|
@ -281,7 +272,7 @@ func (t *target) scrape(timestamp clientmodel.Timestamp, ingester extraction.Ing
|
|||
processOptions := &extraction.ProcessOptions{
|
||||
Timestamp: timestamp,
|
||||
}
|
||||
return processor.ProcessSingle(buf, i, processOptions)
|
||||
return processor.ProcessSingle(resp.Body, i, processOptions)
|
||||
}
|
||||
|
||||
func (t *target) State() TargetState {
|
||||
|
|
Loading…
Reference in New Issue