prometheus

package
v0.87.7-rc2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: BSD-3-Clause Imports: 22 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Prometheus output

It sends metrics to Prometheus using the remote write API. The plugin receives metric events from the pipeline (e.g., from the event_to_metrics action plugin) and forwards them to a Prometheus-compatible endpoint.

Config params

endpoint string default=http://localhost:9090/api/v1/write

Prometheus remote write endpoint URL.


auth AuthConfig

Auth config.

AuthConfig params:

  • strategy describes strategy to use; options:"disabled|tenant|basic|bearer" By default strategy is disabled.
  • tenant_id should be provided if strategy is tenant.
  • username should be provided if strategy is basic. Username is used for HTTP Basic Authentication.
  • password should be provided if strategy is basic. Password is used for HTTP Basic Authentication.
  • bearer_token should be provided if strategy is bearer. Token is used for HTTP Bearer Authentication.

tls *cfg.TLSConfig

TLS config.

TLSConfig params:

  • ca_cert - path or content of a PEM-encoded CA file
  • client_cert - path or content of a PEM-encoded client certificate file
  • client_key - path or content of a PEM-encoded client key file
  • insecure - if set, the plugin will skip SSL/TLS verification

request_timeout cfg.Duration default=1s

Client timeout when sends requests to Prometheus HTTP API.


connection_timeout cfg.Duration default=5s

It defines how much time to wait for the connection.


keep_alive KeepAliveConfig

Keep-alive config.

KeepAliveConfig params:

  • max_idle_conn_duration - idle keep-alive connections are closed after this duration. By default idle connections are closed after 10s.
  • max_conn_duration - keep-alive connections are closed after this duration. If set to 0 - connection duration is unlimited. By default connection duration is 5m.

retry int default=10

Retries of upload. If File.d cannot upload for this number of attempts, File.d will fall with non-zero exit code or skip message (see fatal_on_failed_insert).


fatal_on_failed_insert bool default=false

After an insert error, fall with a non-zero exit code or not


retention cfg.Duration default=1s

Retention milliseconds for retry to upload.


retention_exponentially_multiplier int default=2

Multiplier for exponential increase of retention between retries



Generated using insane-doc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Factory

func Factory() (pipeline.AnyPlugin, pipeline.AnyConfig)

Types

type AuthConfig

type AuthConfig struct {
	// > AuthStrategy.Strategy describes strategy to use.
	Strategy  string `json:"strategy" default:"disabled" options:"disabled|tenant|basic|bearer"`
	Strategy_ AuthStrategy

	// > TenantID for Tenant Authentication.
	TenantID string `json:"tenant_id"`

	// > Username for HTTP Basic Authentication.
	Username string `json:"username"`

	// > Password for HTTP Basic Authentication.
	Password string `json:"password"`

	// > Token for HTTP Bearer Authentication.
	BearerToken string `json:"bearer_token"`
}

! config-params ^ config-params

type AuthStrategy

type AuthStrategy byte
const (
	StrategyDisabled AuthStrategy = iota
	StrategyTenant
	StrategyBasic
	StrategyBearer
)

type Config

type Config struct {
	// > @3@4@5@6
	// >
	// > Prometheus remote write endpoint URL.
	Endpoint string `json:"endpoint" default:"http://localhost:9090/api/v1/write"` // *

	// > @3@4@5@6
	// >
	// > Auth config.
	// >
	// > `AuthConfig` params:
	// > * `strategy` describes strategy to use; options:"disabled|tenant|basic|bearer"
	// > By default strategy is `disabled`.
	// > * `tenant_id` should be provided if strategy is `tenant`.
	// > * `username` should be provided if strategy is `basic`.
	// > Username is used for HTTP Basic Authentication.
	// > * `password` should be provided if strategy is `basic`.
	// > Password is used for HTTP Basic Authentication.
	// > * `bearer_token` should be provided if strategy is `bearer`.
	// > Token is used for HTTP Bearer Authentication.
	Auth AuthConfig `json:"auth" child:"true"` // *

	// > @3@4@5@6
	// >
	// > TLS config.
	// >
	// > `TLSConfig` params:
	// > * `ca_cert` - path or content of a PEM-encoded CA file
	// > * `client_cert` - path or content of a PEM-encoded client certificate file
	// > * `client_key` - path or content of a PEM-encoded client key file
	// > * `insecure` - if set, the plugin will skip SSL/TLS verification
	TLS *cfg.TLSConfig `json:"tls"` // *

	// > @3@4@5@6
	// >
	// > Client timeout when sends requests to Prometheus HTTP API.
	RequestTimeout  cfg.Duration `json:"request_timeout" default:"1s" parse:"duration"` // *
	RequestTimeout_ time.Duration

	// > @3@4@5@6
	// >
	// > It defines how much time to wait for the connection.
	ConnectionTimeout  cfg.Duration `json:"connection_timeout" default:"5s" parse:"duration"` // *
	ConnectionTimeout_ time.Duration

	// > @3@4@5@6
	// >
	// > Keep-alive config.
	// >
	// > `KeepAliveConfig` params:
	// > * `max_idle_conn_duration` - idle keep-alive connections are closed after this duration.
	// > By default idle connections are closed after `10s`.
	// > * `max_conn_duration` - keep-alive connections are closed after this duration.
	// > If set to `0` - connection duration is unlimited.
	// > By default connection duration is `5m`.
	KeepAlive KeepAliveConfig `json:"keep_alive" child:"true"` // *

	// > @3@4@5@6
	// >
	// > Retries of upload. If File.d cannot upload for this number of attempts,
	// > File.d will fall with non-zero exit code or skip message (see fatal_on_failed_insert).
	Retry int `json:"retry" default:"10"` // *

	// > @3@4@5@6
	// >
	// > After an insert error, fall with a non-zero exit code or not
	FatalOnFailedInsert bool `json:"fatal_on_failed_insert" default:"false"` // *

	// > @3@4@5@6
	// >
	// > Retention milliseconds for retry to upload.
	Retention  cfg.Duration `json:"retention" default:"1s" parse:"duration"` // *
	Retention_ time.Duration

	// > @3@4@5@6
	// >
	// > Multiplier for exponential increase of retention between retries
	RetentionExponentMultiplier int `json:"retention_exponentially_multiplier" default:"2"` // *
}

! config-params ^ config-params

type KeepAliveConfig

type KeepAliveConfig struct {
	// Idle keep-alive connections are closed after this duration.
	MaxIdleConnDuration  cfg.Duration `json:"max_idle_conn_duration" parse:"duration" default:"10s"`
	MaxIdleConnDuration_ time.Duration

	// Keep-alive connections are closed after this duration.
	MaxConnDuration  cfg.Duration `json:"max_conn_duration" parse:"duration" default:"5m"`
	MaxConnDuration_ time.Duration
}

type Plugin

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

func (*Plugin) Out

func (p *Plugin) Out(event *pipeline.Event)

func (*Plugin) Start

func (p *Plugin) Start(config pipeline.AnyConfig, params *pipeline.OutputPluginParams)

func (*Plugin) Stop

func (p *Plugin) Stop()

type PrometheusClient

type PrometheusClient interface {
	Write(ctx context.Context, req *promwrite.WriteRequest, options ...promwrite.WriteOption) (*promwrite.WriteResponse, error)
}

Jump to

Keyboard shortcuts

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