Documentation
¶
Index ¶
- Variables
- func GetMetricsExporter(name string, e *Exporters) (remote.RemoteWriteClient, error)
- func HasMetricsExporter(name string, e *Exporters) bool
- func NewTransformer(defaultDropMetrics *bool, addLabels map[string]string, ...) (*transform.RequestTransformer, error)
- type Config
- type Exporters
- type HostLog
- type JournalTarget
- type LabelMatcher
- type LiftLabel
- type LiftResource
- type LogTransform
- type OtelLog
- type OtelMetric
- type OtlpMetricExport
- type PrometheusRemoteWrite
- type PrometheusScrape
- type ScrapeTarget
- type TailTarget
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 ¶
func GetMetricsExporter ¶
func GetMetricsExporter(name string, e *Exporters) (remote.RemoteWriteClient, error)
func HasMetricsExporter ¶
func NewTransformer ¶
func NewTransformer(defaultDropMetrics *bool, addLabels map[string]string, dropLabels map[string]string, dropMetrics, keepMetrics []string, keepMetricsWithLabelValue []LabelMatcher) (*transform.RequestTransformer, error)
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."`
Exporters *Exporters `` /* 214-byte string literal not displayed */
}
func (*Config) ReplaceVariable ¶
ReplaceVariable replaces all instances of the given variable with the given value.
type Exporters ¶
type Exporters struct {
OtlpMetricExport []*OtlpMetricExport `toml:"otlp-metric-export" comment:"Configuration for exporting metrics to an OTLP/HTTP endpoint."`
}
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."`
}
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 LiftResource ¶
type LogTransform ¶
type OtelLog ¶
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."`
Exporters []string `toml:"exporters" comment:"List of exporter names to forward metrics to."`
}
func (*OtelMetric) Validate ¶
func (w *OtelMetric) Validate() error
type OtlpMetricExport ¶
type OtlpMetricExport struct {
Name string `toml:"name" comment:"Name of the exporter."`
Destination string `toml:"destination" comment:"OTLP/HTTP endpoint to send metrics to."`
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,omitempty" 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."`
AddResourceAttributes map[string]string `toml:"add-resource-attributes" comment:"Key/value pairs of resource attributes to add to all metrics."`
}
OtlpMetricExport exports metric telemetry to OTLP/HTTP metrics endpoints.
func (*OtlpMetricExport) GetWriteClient ¶
func (o *OtlpMetricExport) GetWriteClient() (remote.RemoteWriteClient, error)
func (*OtlpMetricExport) Validate ¶
func (o *OtlpMetricExport) 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."`
Exporters []string `toml:"exporters" comment:"List of exporter names to forward metrics to."`
}
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."`
Exporters []string `toml:"exporters" comment:"List of exporter names to forward metrics to."`
}
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."`
}
Click to show internal directories.
Click to hide internal directories.