instance

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package instance provides a mini Prometheus scraper and remote_writer.

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultConfig = Config{
		HostFilter:           false,
		WALTruncateFrequency: 60 * time.Minute,
		MinWALTime:           5 * time.Minute,
		MaxWALTime:           4 * time.Hour,
		RemoteFlushDeadline:  1 * time.Minute,
		WriteStaleOnShutdown: false,
		// contains filtered or unexported fields
	}
)

Default configuration values

View Source
var DefaultGlobalConfig = GlobalConfig{
	Prometheus: config.DefaultGlobalConfig,
}

DefaultGlobalConfig holds default global settings to be used across all instances.

Functions

func MarshalConfig

func MarshalConfig(c *Config, scrubSecrets bool) ([]byte, error)

MarshalConfig marshals an instance config based on a provided content type.

func MarshalConfigToWriter

func MarshalConfigToWriter(c *Config, w io.Writer, scrubSecrets bool) error

MarshalConfigToWriter marshals a config to an io.Writer.

Types

type Config

type Config struct {
	Name                     string                      `yaml:"name,omitempty"`
	HostFilter               bool                        `yaml:"host_filter,omitempty"`
	HostFilterRelabelConfigs []*relabel.Config           `yaml:"host_filter_relabel_configs,omitempty"`
	ScrapeConfigs            []*config.ScrapeConfig      `yaml:"scrape_configs,omitempty"`
	RemoteWrite              []*config.RemoteWriteConfig `yaml:"remote_write,omitempty"`

	// How frequently the WAL should be truncated.
	WALTruncateFrequency time.Duration `yaml:"wal_truncate_frequency,omitempty"`

	// Minimum and maximum time series should exist in the WAL for.
	MinWALTime time.Duration `yaml:"min_wal_time,omitempty"`
	MaxWALTime time.Duration `yaml:"max_wal_time,omitempty"`

	RemoteFlushDeadline  time.Duration `yaml:"remote_flush_deadline,omitempty"`
	WriteStaleOnShutdown bool          `yaml:"write_stale_on_shutdown,omitempty"`
	// contains filtered or unexported fields
}

Config is a specific agent that runs within the overall Prometheus agent. It has its own set of scrape_configs and remote_write rules.

func UnmarshalConfig

func UnmarshalConfig(r io.Reader) (*Config, error)

UnmarshalConfig unmarshals an instance config from a reader based on a provided content type.

func (*Config) ApplyDefaults

func (c *Config) ApplyDefaults(global GlobalConfig) error

ApplyDefaults applies default configurations to the configuration to all values that have not been changed to their non-zero value. ApplyDefaults also validates the config.

The value for global will be saved.

func (Config) MarshalYAML

func (c Config) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type GlobalConfig

type GlobalConfig struct {
	Prometheus  config.GlobalConfig         `yaml:",inline"`
	RemoteWrite []*config.RemoteWriteConfig `yaml:"remote_write,omitempty"`

	ExtraMetrics      bool          `yaml:"-"`
	DisableKeepAlives bool          `yaml:"-"`
	IdleConnTimeout   time.Duration `yaml:"-"`
}

GlobalConfig holds global settings that apply to all instances by default.

func (GlobalConfig) IsZero

func (c GlobalConfig) IsZero() bool

func (*GlobalConfig) UnmarshalYAML

func (c *GlobalConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type Mode

type Mode string

Mode controls how instances are created.

var (
	ModeDistinct Mode = "distinct"
	ModeShared   Mode = "shared"

	DefaultMode = ModeShared
)

Types of instance modes

func (*Mode) UnmarshalYAML

func (m *Mode) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals a string to a Mode. Fails if the string is unrecognized.

Jump to

Keyboard shortcuts

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