Add headers to indicate remote read/write version

Also add Content-Type header.
This commit is contained in:
Julius Volz 2017-03-24 17:39:51 +01:00
parent 8fda83ea12
commit 3f23aa2cc7
1 changed files with 4 additions and 0 deletions

View File

@ -100,6 +100,8 @@ func (c *Client) Store(samples model.Samples) error {
return err
}
httpReq.Header.Add("Content-Encoding", "snappy")
httpReq.Header.Set("Content-Type", "application/x-protobuf")
httpReq.Header.Set("X-Prometheus-Remote-Write-Version", "0.0.1")
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
defer cancel()
@ -146,6 +148,8 @@ func (c *Client) Read(ctx context.Context, from, through model.Time, matchers me
if err != nil {
return nil, fmt.Errorf("unable to create request: %v", err)
}
httpReq.Header.Set("Content-Type", "application/x-protobuf")
httpReq.Header.Set("X-Prometheus-Remote-Read-Version", "0.0.1")
ctx, cancel := context.WithTimeout(ctx, c.timeout)
defer cancel()