config

package
v0.0.0-...-8a5471c Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Endpoint:                     "https://ingestor.adx-mon.svc.cluster.local",
	MaxBatchSize:                 5000,
	WALFlushIntervalMilliSeconds: 100,
	ListenAddr:                   ":8080",
	StorageDir:                   homedir,
	PrometheusScrape: &PrometheusScrape{
		StaticScrapeTarget:    []*ScrapeTarget{},
		ScrapeIntervalSeconds: 30,
	},

	PrometheusRemoteWrite: []*PrometheusRemoteWrite{
		{
			Path:      "/remote_write",
			AddLabels: make(map[string]string),
		},
	},
	OtelLog: &OtelLog{
		AddAttributes: make(map[string]string),
	},
	OtelMetric: []*OtelMetric{
		{
			Path:      "/v1/metrics",
			AddLabels: make(map[string]string),
		},
	},
	HostLog: []*HostLog{
		{
			StaticFileTargets: []*TailTarget{},
			JournalTargets:    []*JournalTarget{},
			AddAttributes:     make(map[string]string),
		},
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint           string `toml:"endpoint,omitempty" comment:"Ingestor URL to send collected telemetry."`
	Kubeconfig         string `toml:"kube-config,omitempty" comment:"Path to kubernetes client config"`
	InsecureSkipVerify bool   `toml:"insecure-skip-verify,omitempty" comment:"Skip TLS verification."`
	ListenAddr         string `toml:"listen-addr,omitempty" comment:"Address to listen on for endpoints."`
	Region             string `toml:"region,omitempty" comment:"Region is a location identifier."`
	TLSKeyFile         string `toml:"tls-key-file,omitempty" comment:"Optional path to the TLS key file."`
	TLSCertFile        string `toml:"tls-cert-file,omitempty" comment:"Optional path to the TLS cert bundle file."`

	MaxConnections               int   `toml:"max-connections,omitempty" comment:"Maximum number of connections to accept."`
	MaxBatchSize                 int   `toml:"max-batch-size,omitempty" comment:"Maximum number of samples to send in a single batch."`
	MaxSegmentAgeSeconds         int   `toml:"max-segment-age-seconds,omitempty" comment:"Max segment agent in seconds."`
	MaxSegmentSize               int64 `toml:"max-segment-size,omitempty" comment:"Maximum segment size in bytes."`
	MaxDiskUsage                 int64 `toml:"max-disk-usage,omitempty" comment:"Maximum allowed size in bytes of all segments on disk."`
	WALFlushIntervalMilliSeconds int   `toml:"wal-flush-interval-ms,omitempty" comment:"Interval to flush the WAL. (default 100)"`

	StorageDir  string `toml:"storage-dir,omitempty" comment:"Storage directory for the WAL and log cursors."`
	EnablePprof bool   `toml:"enable-pprof,omitempty" comment:"Enable pprof endpoints."`

	// These are global config options that apply to all endpoints.
	DefaultDropMetrics        *bool             `` /* 129-byte string literal not displayed */
	AddLabels                 map[string]string `toml:"add-labels,omitempty" comment:"Global Key/value pairs of labels to add to all metrics."`
	DropLabels                map[string]string `` /* 193-byte string literal not displayed */
	DropMetrics               []string          `toml:"drop-metrics,omitempty" comment:"Global Regexes of metrics to drop."`
	KeepMetrics               []string          `toml:"keep-metrics,omitempty" comment:"Global Regexes of metrics to keep."`
	KeepMetricsWithLabelValue []LabelMatcher    `` /* 186-byte string literal not displayed */
	LiftLabels                []*LiftLabel      `toml:"lift-labels,omitempty" comment:"Global labels to lift from the metric to top level columns"`

	DisableMetricsForwarding bool `toml:"disable-metrics-forwarding,omitempty" comment:"Disable metrics forwarding to endpoints."`

	// These are global config options that apply to all endpoints.
	AddAttributes  map[string]string `toml:"add-attributes,omitempty" comment:"Key/value pairs of attributes to add to all logs."`
	LiftAttributes []string          `toml:"lift-attributes,omitempty" comment:"Attributes lifted from the Body field and added to Attributes."`
	LiftResources  []*LiftResource   `toml:"lift-resources,omitempty" comment:"Fields lifted from the Resource and added as top level columns."`

	PrometheusScrape      *PrometheusScrape        `toml:"prometheus-scrape,omitempty" comment:"Defines a prometheus format endpoint scraper."`
	PrometheusRemoteWrite []*PrometheusRemoteWrite `toml:"prometheus-remote-write,omitempty" comment:"Defines a prometheus remote write endpoint."`
	OtelLog               *OtelLog                 `toml:"otel-log,omitempty" comment:"Defines an OpenTelemetry log endpoint. Accepts OTLP/HTTP."`
	OtelMetric            []*OtelMetric            `toml:"otel-metric,omitempty" comment:"Defines an OpenTelemetry metric endpoint. Accepts OTLP/HTTP and/or OTLP/gRPC."`
	HostLog               []*HostLog               `toml:"host-log,omitempty" comment:"Defines a host log scraper."`
}

func (*Config) ReplaceVariable

func (c *Config) ReplaceVariable(variable, value string)

ReplaceVariable replaces all instances of the given variable with the given value.

func (*Config) Validate

func (c *Config) Validate() error

type HostLog

type HostLog struct {
	DisableKubeDiscovery bool              `` /* 145-byte string literal not displayed */
	AddAttributes        map[string]string `toml:"add-attributes" comment:"Key/value pairs of attributes to add to all logs."`
	StaticFileTargets    []*TailTarget     `toml:"file-target" comment:"Defines a tail file target."`
	JournalTargets       []*JournalTarget  `toml:"journal-target" comment:"Defines a journal target to scrape."`
	Transforms           []*LogTransform   `toml:"transforms" comment:"Defines a list of transforms to apply to log lines."`
}

func (*HostLog) Validate

func (w *HostLog) Validate() error

type JournalTarget

type JournalTarget struct {
	Matches  []string `` /* 233-byte string literal not displayed */
	Database string   `toml:"database" comment:"Database to store logs in."`
	Table    string   `toml:"table" comment:"Table to store logs in."`
	Parsers  []string `toml:"parsers" comment:"Parsers to apply sequentially to the log line."`
}

func (*JournalTarget) Validate

func (j *JournalTarget) Validate() error

type LabelMatcher

type LabelMatcher struct {
	LabelRegex string `` /* 127-byte string literal not displayed */
	ValueRegex string `` /* 126-byte string literal not displayed */
}

type LiftLabel

type LiftLabel struct {
	Name       string `toml:"name" comment:"The name of the label to lift."`
	ColumnName string `toml:"column" comment:"The name of the column to lift the label to."`
}

type LiftResource

type LiftResource struct {
	Name       string `toml:"name" comment:"The name of the resource to lift."`
	ColumnName string `toml:"column" comment:"The name of the column to lift the resource to."`
}

type LogTransform

type LogTransform struct {
	Name   string         `toml:"name" comment:"The name of the transform to apply to the log line."`
	Config map[string]any `toml:"config" comment:"The configuration for the transform."`
}

type OtelLog

type OtelLog struct {
	AddAttributes  map[string]string `toml:"add-attributes" comment:"Key/value pairs of attributes to add to all logs."`
	LiftAttributes []string          `toml:"lift-attributes" comment:"Attributes lifted from the Body and added to Attributes."`
}

func (*OtelLog) Validate

func (w *OtelLog) Validate() error

type OtelMetric

type OtelMetric struct {
	Database                 string `toml:"database" comment:"Database to store metrics in."`
	Path                     string `toml:"path" comment:"The path to listen on for OTLP/HTTP requests."`
	GrpcPort                 int    `toml:"grpc-port" comment:"The port to listen on for OTLP/gRPC requests."`
	DisableMetricsForwarding *bool  `toml:"disable-metrics-forwarding" comment:"Disable metrics forwarding to endpoints."`

	DefaultDropMetrics        *bool             `toml:"default-drop-metrics" comment:"Default to dropping all metrics.  Only metrics matching a keep rule will be kept."`
	AddLabels                 map[string]string `toml:"add-labels" comment:"Key/value pairs of labels to add to all metrics."`
	DropLabels                map[string]string `` /* 177-byte string literal not displayed */
	DropMetrics               []string          `toml:"drop-metrics" comment:"Regexes of metrics to drop."`
	KeepMetrics               []string          `toml:"keep-metrics" comment:"Regexes of metrics to keep."`
	KeepMetricsWithLabelValue []LabelMatcher    `toml:"keep-metrics-with-label-value" comment:"Regexes of metrics to keep if they have the given label and value."`
}

func (*OtelMetric) Validate

func (w *OtelMetric) Validate() error

type PrometheusRemoteWrite

type PrometheusRemoteWrite struct {
	Database                 string `toml:"database" comment:"Database to store metrics in."`
	Path                     string `toml:"path" comment:"The path to listen on for prometheus remote write requests.  Defaults to /receive."`
	DisableMetricsForwarding *bool  `toml:"disable-metrics-forwarding" comment:"Disable metrics forwarding to endpoints."`

	DefaultDropMetrics        *bool             `toml:"default-drop-metrics" comment:"Default to dropping all metrics.  Only metrics matching a keep rule will be kept."`
	AddLabels                 map[string]string `toml:"add-labels" comment:"Key/value pairs of labels to add to all metrics."`
	DropLabels                map[string]string `toml:"drop-labels" comment:"Labels to drop if they match a metrics regex in the format <metrics regex>=<label name>."`
	DropMetrics               []string          `toml:"drop-metrics" comment:"Regexes of metrics to drop."`
	KeepMetrics               []string          `toml:"keep-metrics" comment:"Regexes of metrics to keep."`
	KeepMetricsWithLabelValue []LabelMatcher    `toml:"keep-metrics-with-label-value" comment:"Regexes of metrics to keep if they have the given label and value."`
}

func (*PrometheusRemoteWrite) Validate

func (w *PrometheusRemoteWrite) Validate() error

type PrometheusScrape

type PrometheusScrape struct {
	Database                 string          `toml:"database" comment:"Database to store metrics in."`
	StaticScrapeTarget       []*ScrapeTarget `toml:"static-scrape-target" comment:"Defines a static scrape target."`
	ScrapeIntervalSeconds    int             `toml:"scrape-interval" comment:"Scrape interval in seconds."`
	ScrapeTimeout            int             `toml:"scrape-timeout" comment:"Scrape timeout in seconds."`
	DisableMetricsForwarding bool            `toml:"disable-metrics-forwarding" comment:"Disable metrics forwarding to endpoints."`
	DisableDiscovery         bool            `toml:"disable-discovery" comment:"Disable discovery of kubernetes pod targets."`

	DefaultDropMetrics        *bool             `toml:"default-drop-metrics" comment:"Default to dropping all metrics.  Only metrics matching a keep rule will be kept."`
	AddLabels                 map[string]string `toml:"add-labels" comment:"Key/value pairs of labels to add to all metrics."`
	DropLabels                map[string]string `toml:"drop-labels" comment:"Labels to drop if they match a metrics regex in the format <metrics regex>=<label name>."`
	DropMetrics               []string          `toml:"drop-metrics" comment:"Regexes of metrics to drop."`
	KeepMetrics               []string          `toml:"keep-metrics" comment:"Regexes of metrics to keep."`
	KeepMetricsWithLabelValue []LabelMatcher    `toml:"keep-metrics-with-label-value" comment:"Regexes of metrics to keep if they have the given label and value."`
}

func (*PrometheusScrape) Validate

func (s *PrometheusScrape) Validate() error

type ScrapeTarget

type ScrapeTarget struct {
	HostRegex string `toml:"host-regex" comment:"The regex to match the host name against.  If the hostname matches, the URL will be scraped."`
	URL       string `toml:"url" comment:"The URL to scrape."`
	Namespace string `toml:"namespace" comment:"The namespace label to add for metrics scraped at this URL."`
	Pod       string `toml:"pod" comment:"The pod label to add for metrics scraped at this URL."`
	Container string `toml:"container" comment:"The container label to add for metrics scraped at this URL."`
}

func (*ScrapeTarget) Validate

func (t *ScrapeTarget) Validate() error

type TailTarget

type TailTarget struct {
	FilePath string           `toml:"file-path" comment:"The path to the file to tail."`
	LogType  sourceparse.Type `` /* 192-byte string literal not displayed */
	Database string           `toml:"database" comment:"Database to store logs in."`
	Table    string           `toml:"table" comment:"Table to store logs in."`
	Parsers  []string         `toml:"parsers" comment:"Parsers to apply sequentially to the log line."`
}

Jump to

Keyboard shortcuts

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