promremote

package
v0.1.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package promremote is a package to write timeseries data to a Prometheus remote write endpoint. copied from https://github.com/m3dbx/prometheus_remote_client_golang/blob/master/promremote/client.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(url, token string) *Client

NewClient creates a new remote write coordinator client.

func (*Client) WriteProto

func (c *Client) WriteProto(
	ctx context.Context,
	promWR *prompb.WriteRequest,
	opts WriteOptions,
) (WriteResult, WriteError)

func (*Client) WriteTimeSeries

func (c *Client) WriteTimeSeries(
	ctx context.Context,
	seriesList TSList,
	opts WriteOptions,
) (WriteResult, WriteError)

type Datapoint

type Datapoint struct {
	Timestamp time.Time
	Value     float64
}

A Datapoint is a single data value reported at a given time.

type Label

type Label struct {
	Name  string
	Value string
}

Label is a metric label.

type TSList

type TSList []TimeSeries

TSList is a slice of TimeSeries.

type TimeSeries

type TimeSeries struct {
	Labels    []Label
	Datapoint Datapoint
}

TimeSeries are made of labels and a datapoint.

func ConvertMetric

func ConvertMetric(metric prometheus.Metric, name string) TimeSeries

type WriteError

type WriteError interface {
	error
	StatusCode() int
}

WriteError is an error that can also return the HTTP status code if the response is what caused an error.

type WriteOptions

type WriteOptions struct {
	// Headers to append or override the outgoing headers.
	Headers map[string]string
}

WriteOptions specifies additional write options.

type WriteResult

type WriteResult struct {
	StatusCode int
}

WriteResult returns the successful HTTP status code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL