promremote

package
v0.0.0-...-27b3d77 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

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
}

Client is a client for the prometheus remote write API. It is safe to be shared between goroutines.

func NewClient

func NewClient(opts ClientOpts) (*Client, error)

func (*Client) CloseIdleConnections

func (c *Client) CloseIdleConnections()

func (*Client) Write

func (c *Client) Write(ctx context.Context, endpoint string, wr *prompb.WriteRequest) error

type ClientOpts

type ClientOpts struct {
	// Close controls whether the client closes the connection after each request.
	Close bool

	// Timeout is the timeout for the http client and the http request.
	Timeout time.Duration

	// InsecureSkipVerify controls whether the client verifies the server's certificate chain and host name.
	InsecureSkipVerify bool

	// IdleConnTimeout is the maximum amount of time an idle (keep-alive) connection
	// will remain idle before closing itself.
	IdleConnTimeout time.Duration

	// ResponseHeaderTimeout is the amount of time to wait for a server's response headers
	// after fully writing the request (including its body, if any).
	ResponseHeaderTimeout time.Duration

	// MaxIdleConns controls the maximum number of idle (keep-alive) connections across all hosts.
	MaxIdleConns int

	// MaxIdleConnsPerHost, if non-zero, controls the maximum idle (keep-alive) per host.
	MaxIdleConnsPerHost int

	// MaxConnsPerHost, if non-zero, controls the maximum connections per host.
	MaxConnsPerHost int

	// TLSHandshakeTimeout specifies the maximum amount of time to
	// wait for a TLS handshake. Zero means no timeout.
	TLSHandshakeTimeout time.Duration

	// DisableHTTP2 controls whether the client disables HTTP/2 support.
	DisableHTTP2 bool

	// DisableKeepAlives controls whether the client disables HTTP keep-alives.
	DisableKeepAlives bool
}

func (ClientOpts) WithDefaults

func (c ClientOpts) WithDefaults() ClientOpts

type RemoteWriteClient

type RemoteWriteClient interface {
	Write(ctx context.Context, endpoint string, wr *prompb.WriteRequest) error
	CloseIdleConnections()
}

type RemoteWriteProxy

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

func NewRemoteWriteProxy

func NewRemoteWriteProxy(client RemoteWriteClient, endpoints []string, maxBatchSize int, disableMetricsForwarding bool) *RemoteWriteProxy

func (*RemoteWriteProxy) Close

func (r *RemoteWriteProxy) Close() error

func (*RemoteWriteProxy) Open

func (r *RemoteWriteProxy) Open(ctx context.Context) error

func (*RemoteWriteProxy) Write

Jump to

Keyboard shortcuts

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