code: func (d *diagnosticsCollector) Flush() error {
  	d.mu.Lock()
  	defer d.mu.Unlock()
  	d.metrics["Uptime"] = (time.Now().Unix() - d.startTime)
  	buf, err := d.encode()
  	if err != nil {
  		return errors.Wrap(err, "encoding")
  	}
  	req, err := http.NewRequest("POST", d.host, bytes.NewReader(buf))
  	if err != nil {
  		return errors.Wrap(err, "making new request")
  	}
  	req.Header.Set("Content-Type", "application/json")
  	resp, err := d.client.Do(req)
  	if err != nil {
  		return errors.Wrap(err, "posting")
  	}
  	// Intentionally ignoring response body, as user does not need to be notified of error.
  	defer resp.Body.Close()
  	return nil
  }
docs: // Flush sends the current metrics.