fix(push): incorporate changes from review

Signed-off-by: Frank Spitulski <fspituls@ucsd.edu>
This commit is contained in:
Frank Spitulski 2019-02-24 15:15:35 -08:00
parent 7b127b3fe5
commit 10e34c668f
1 changed files with 5 additions and 3 deletions

View File

@ -186,8 +186,10 @@ func (p *Pusher) BasicAuth(username, password string) *Pusher {
}
// Format configures the Pusher to use an encoding format given by the
// provided expfmt.Format. For convenience, this method returns a
// pointer to the Pusher itself.
// provided expfmt.Format. The default format is expfmt.FmtProtoDelim and
// should be used with the standard Prometheus Pushgateway. Custom
// implementations may require different formats. For convenience, this
// method returns a pointer to the Pusher itself.
func (p *Pusher) Format(format expfmt.Format) *Pusher {
p.expfmt = format
return p
@ -233,7 +235,7 @@ func (p *Pusher) push(method string) error {
if p.useBasicAuth {
req.SetBasicAuth(p.username, p.password)
}
req.Header.Set(contentTypeHeader, string(expfmt.FmtProtoDelim))
req.Header.Set(contentTypeHeader, string(p.expfmt))
resp, err := p.client.Do(req)
if err != nil {
return err