Documentation
¶
Index ¶
Constants ¶
const DefaultRemoteWriteVersion = "0.1.0"
Variables ¶
var ( ErrNilContext = errors.New("nil context passed") ErrNoGatherersDefined = errors.New("no gatherers were defined") )
Functions ¶
This section is empty.
Types ¶
type Compression ¶ added in v0.1.1
type Compression int
Compression is the compression algorithm used on the marshalled data before sending
const ( // None tells the engine not to compress at all None Compression = iota // Snappy uses the snappy compression algorithm described at https://github.com/google/snappy Snappy // Gzip uses the standard Gzip compression algorithm with default compression level Gzip )
func (Compression) Compress ¶ added in v0.1.1
func (e Compression) Compress(data []byte) ([]byte, error)
Compress attempts to compress the data with the given algorithm. If the Compression instance is valid, only gzip returns an error
func (Compression) String ¶ added in v0.1.1
func (e Compression) String() string
String returns the name of the compression algorithm
func (Compression) UpdateRequest ¶ added in v0.1.1
func (e Compression) UpdateRequest(req *http.Request)
UpdateRequest adds the appropriate Content-Encoding header to the given request
type Format ¶ added in v0.1.1
type Format int
Format represents the format to which metrics will be marshalled before sending to Prometheus
func (Format) Marshal ¶ added in v0.1.1
func (f Format) Marshal(wr prompb.WriteRequest) ([]byte, error)
Marshal will attempt to convert the prompb.WriteRequest into a byte slice
func (Format) UpdateRequest ¶ added in v0.1.1
UpdateRequest adds the approprate Content-Type header to the given request
type RemoteMetricsWriter ¶
RemoteMetricsWriter knows how to marshal a set of metrics and send them to a remote prometheus endpoint
func NewRemoteMetricsWriter ¶
func NewRemoteMetricsWriter(targetURL string, options RemoteMetricsWriterOptions, gatherers ...prometheus.Gatherer) (RemoteMetricsWriter, error)
NewRemoteMetricsWriter attempts to create and return a new RemoteMetricsWriter, and will do so unless targetURL is the empty string (or only whitespace). If no gatherers are specified, prometheus.DefaultGatherer is used.
type RemoteMetricsWriterOptions ¶
type RemoteMetricsWriterOptions struct {
HTTPClient *http.Client
Format Format
Compression Compression
RemoteWriteVersion string
}
RemoteMetricsWriterOptions are the optional settings for a RemoteMetricsWriter.
If HTTPClient is not set, http.DefaultClient is used If Format is not set, it defaults to Protobuf If Compression is not set, it defaults to None If RemoteWriteVersion is not set, it defaults to DefaultRemoteWriteVersion (0.1.0, currently). This should never change