config

package
v3.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Copyright (c) F5, Inc.

This source code is licensed under the Apache License, Version 2.0 license found in the LICENSE file in the root directory of this source tree.

Copyright (c) F5, Inc.

This source code is licensed under the Apache License, Version 2.0 license found in the LICENSE file in the root directory of this source tree.

Index

Constants

View Source
const (
	ConfigFileName               = "nginx-agent.conf"
	EnvPrefix                    = "NGINX_AGENT"
	KeyDelimiter                 = "_"
	KeyValueNumber               = 2
	AgentDirName                 = "/etc/nginx-agent"
	DefaultMetricsBatchProcessor = "default_metrics"
	DefaultLogsBatchProcessor    = "default_logs"
	DefaultExporter              = "default"
	DefaultPipeline              = "default"
)
View Source
const (
	DefGracefulShutdownPeriod      = 5 * time.Second
	DefNginxReloadMonitoringPeriod = 10 * time.Second
	DefTreatErrorsAsWarnings       = false
	DefNginxApiTlsCa               = ""

	// Nginx Reload Backoff defaults
	DefNginxReloadBackoffInitialInterval     = 500 * time.Millisecond
	DefNginxReloadBackoffRandomizationFactor = 0.5 // the value is 0 <= and < 1
	DefNginxReloadBackoffMultiplier          = 2
	DefNginxReloadBackoffMaxInterval         = 3 * time.Second
	DefNginxReloadBackoffMaxElapsedTime      = 10 * time.Second

	DefCommandServerHostKey               = ""
	DefCommandServerPortKey               = 0
	DefCommandServerTypeKey               = "grpc"
	DefCommandAuthTokenKey                = ""
	DefCommandAuthTokenPathKey            = ""
	DefCommandTLSCertKey                  = ""
	DefCommandTLSKeyKey                   = ""
	DefCommandTLSCaKey                    = ""
	DefCommandTLSSkipVerifyKey            = false
	DefCommandTLServerNameKey             = ""
	DefCommandServerProxyURlKey           = ""
	DefCommandServerProxyNoProxyKey       = ""
	DefCommandServerProxyAuthMethodKey    = ""
	DefCommandServerProxyUsernameKey      = ""
	DefCommandServerProxyPasswordKey      = ""
	DefCommandServerProxyTokenKey         = ""
	DefCommandServerProxyTLSCertKey       = ""
	DefCommandServerProxyTLSKeyKey        = ""
	DefCommandServerProxyTLSCaKey         = ""
	DefCommandServerProxyTLSSkipVerifyKey = false
	DefCommandServerProxyTLServerNameKey  = ""
	DefCommandServerProxyTimeoutKey       = 10 * time.Second

	DefAuxiliaryCommandServerHostKey    = ""
	DefAuxiliaryCommandServerPortKey    = 0
	DefAuxiliaryCommandServerTypeKey    = "grpc"
	DefAuxiliaryCommandAuthTokenKey     = ""
	DefAuxiliaryCommandAuthTokenPathKey = ""
	DefAuxiliaryCommandTLSCertKey       = ""
	DefAuxiliaryCommandTLSKeyKey        = ""
	DefAuxiliaryCommandTLSCaKey         = ""
	DefAuxiliaryCommandTLSSkipVerifyKey = false
	DefAuxiliaryCommandTLServerNameKey  = ""

	// Client GRPC Settings
	DefMaxMessageSize               = 0       // 0 = unset
	DefMaxMessageRecieveSize        = 4194304 // default 4 MB
	DefMaxMessageSendSize           = 4194304 // default 4 MB
	DefMaxFileSize           uint32 = 1048576 // 1MB
	DefFileChunkSize         uint32 = 524288  // 0.5MB

	// Client HTTP Settings
	DefHTTPTimeout = 10 * time.Second

	// Client GRPC Keep Alive Settings
	DefGRPCKeepAliveTimeout             = 10 * time.Second
	DefGRPCKeepAliveTime                = 20 * time.Second
	DefGRPCKeepAlivePermitWithoutStream = true

	// Client Backoff defaults
	DefBackoffInitialInterval     = 1 * time.Second
	DefBackoffRandomizationFactor = 0.5 // the value is 0 <= and < 1
	DefBackoffMultiplier          = 3
	DefBackoffMaxInterval         = 20 * time.Second
	DefBackoffMaxElapsedTime      = 1 * time.Minute

	// Watcher defaults
	DefInstanceWatcherMonitoringFrequency       = 5 * time.Second
	DefInstanceHealthWatcherMonitoringFrequency = 5 * time.Second
	DefFileWatcherMonitoringFrequency           = 5 * time.Second

	// Collector defaults
	DefCollectorConfigPath  = "/etc/nginx-agent/opentelemetry-collector-agent.yaml"
	DefCollectorLogLevel    = "INFO"
	DefCollectorLogPath     = "/var/log/nginx-agent/opentelemetry-collector-agent.log"
	DefCollectorTLSCertPath = "/var/lib/nginx-agent/cert.pem"
	DefCollectorTLSKeyPath  = "/var/lib/nginx-agent/key.pem"
	DefCollectorTLSCAPath   = "/var/lib/nginx-agent/ca.pem"
	DefCollectorTLSSANNames = "127.0.0.1,::1,localhost"

	DefCollectorMetricsBatchProcessorSendBatchSize    = 1000
	DefCollectorMetricsBatchProcessorSendBatchMaxSize = 1000
	DefCollectorMetricsBatchProcessorTimeout          = 30 * time.Second
	DefCollectorLogsBatchProcessorSendBatchSize       = 100
	DefCollectorLogsBatchProcessorSendBatchMaxSize    = 100
	DefCollectorLogsBatchProcessorTimeout             = 60 * time.Second

	DefCollectorExtensionsHealthServerHost      = "localhost"
	DefCollectorExtensionsHealthServerPort      = 13133
	DefCollectorExtensionsHealthPath            = "/"
	DefCollectorExtensionsHealthTLSCertPath     = ""
	DefCollectorExtensionsHealthTLSKeyPath      = ""
	DefCollectorExtensionsHealthTLSCAPath       = ""
	DefCollectorExtensionsHealthTLSSkipVerify   = false
	DefCollectorExtensionsHealthTLServerNameKey = ""

	// File defaults
	DefManifestDir = "/var/lib/nginx-agent"
)
View Source
const (
	ClientRootKey                               = "client"
	AllowedDirectoriesKey                       = "allowed_directories"
	ConfigPathKey                               = "path"
	CommandRootKey                              = "command"
	AuxiliaryCommandRootKey                     = "auxiliary_command"
	DataPlaneConfigRootKey                      = "data_plane_config"
	LabelsRootKey                               = "labels"
	LogLevelRootKey                             = "log"
	CollectorRootKey                            = "collector"
	VersionKey                                  = "version"
	UUIDKey                                     = "uuid"
	FeaturesKey                                 = "features"
	InstanceWatcherMonitoringFrequencyKey       = "watchers_instance_watcher_monitoring_frequency"
	InstanceHealthWatcherMonitoringFrequencyKey = "watchers_instance_health_watcher_monitoring_frequency"
	FileWatcherKey                              = "watchers_file_watcher"
	ManifestDirPathKey                          = "manifest_dir"
)

Variables

View Source
var (
	// child flags saved as vars to enable easier prefixing.
	GrpcKeepAlive                         = pre(ClientRootKey) + "grpc_keepalive"
	ClientKeepAlivePermitWithoutStreamKey = pre(GrpcKeepAlive) + "permit_without_stream"
	ClientKeepAliveTimeKey                = pre(GrpcKeepAlive) + "time"
	ClientKeepAliveTimeoutKey             = pre(GrpcKeepAlive) + "timeout"

	ClientHTTPTimeoutKey               = pre(ClientRootKey) + "http_timeout"
	ClientGRPCMaxMessageSendSizeKey    = pre(ClientRootKey) + "grpc_max_message_send_size"
	ClientGRPCMaxMessageReceiveSizeKey = pre(ClientRootKey) + "grpc_max_message_receive_size"
	ClientGRPCMaxMessageSizeKey        = pre(ClientRootKey) + "grpc_max_message_size"
	ClientGRPCMaxFileSizeKey           = pre(ClientRootKey) + "grpc_max_file_size"
	ClientGRPCFileChunkSizeKey         = pre(ClientRootKey) + "grpc_file_chunk_size"

	ClientBackoffInitialIntervalKey     = pre(ClientRootKey) + "backoff_initial_interval"
	ClientBackoffMaxIntervalKey         = pre(ClientRootKey) + "backoff_max_interval"
	ClientBackoffMaxElapsedTimeKey      = pre(ClientRootKey) + "backoff_max_elapsed_time"
	ClientBackoffRandomizationFactorKey = pre(ClientRootKey) + "backoff_randomization_factor"
	ClientBackoffMultiplierKey          = pre(ClientRootKey) + "backoff_multiplier"

	CollectorConfigPathKey                      = pre(CollectorRootKey) + "config_path"
	CollectorExportersKey                       = pre(CollectorRootKey) + "exporters"
	CollectorDebugExporterKey                   = pre(CollectorExportersKey) + "debug"
	CollectorPrometheusExporterKey              = pre(CollectorExportersKey) + "prometheus"
	CollectorPrometheusExporterServerHostKey    = pre(CollectorPrometheusExporterKey) + "server_host"
	CollectorPrometheusExporterServerPortKey    = pre(CollectorPrometheusExporterKey) + "server_port"
	CollectorPrometheusExporterTLSKey           = pre(CollectorPrometheusExporterKey) + "tls"
	CollectorPrometheusExporterTLSCertKey       = pre(CollectorPrometheusExporterTLSKey) + "cert"
	CollectorPrometheusExporterTLSKeyKey        = pre(CollectorPrometheusExporterTLSKey) + "key"
	CollectorPrometheusExporterTLSCaKey         = pre(CollectorPrometheusExporterTLSKey) + "ca"
	CollectorPrometheusExporterTLSSkipVerifyKey = pre(CollectorPrometheusExporterTLSKey) + "skip_verify"
	CollectorPrometheusExporterTLSServerNameKey = pre(CollectorPrometheusExporterTLSKey) + "server_name"
	CollectorOtlpExportersKey                   = pre(CollectorExportersKey) + "otlp"
	CollectorProcessorsKey                      = pre(CollectorRootKey) + "processors"
	CollectorExtensionsKey                      = pre(CollectorRootKey) + "extensions"
	CollectorExtensionsHealthKey                = pre(CollectorExtensionsKey) + "health"
	CollectorExtensionsHealthServerHostKey      = pre(CollectorExtensionsHealthKey) + "server_host"
	CollectorExtensionsHealthServerPortKey      = pre(CollectorExtensionsHealthKey) + "server_port"
	CollectorExtensionsHealthPathKey            = pre(CollectorExtensionsHealthKey) + "path"
	CollectorExtensionsHealthTLSKey             = pre(CollectorExtensionsHealthKey) + "tls"
	CollectorExtensionsHealthTLSCaKey           = pre(CollectorExtensionsHealthTLSKey) + "ca"
	CollectorExtensionsHealthTLSCertKey         = pre(CollectorExtensionsHealthTLSKey) + "cert"
	CollectorExtensionsHealthTLSKeyKey          = pre(CollectorExtensionsHealthTLSKey) + "key"
	CollectorExtensionsHealthTLSServerNameKey   = pre(CollectorExtensionsHealthTLSKey) + "server_name"
	CollectorExtensionsHealthTLSSkipVerifyKey   = pre(CollectorExtensionsHealthTLSKey) + "skip_verify"
	CollectorExtensionsHeadersSetterKey         = pre(CollectorExtensionsKey) + "headers_setter"
	CollectorPipelinesKey                       = pre(CollectorRootKey) + "pipelines"
	CollectorMetricsPipelinesKey                = pre(CollectorPipelinesKey) + "metrics"
	CollectorLogsPipelinesKey                   = pre(CollectorPipelinesKey) + "logs"
	CollectorReceiversKey                       = pre(CollectorRootKey) + "receivers"
	CollectorLogKey                             = pre(CollectorRootKey) + "log"
	CollectorLogLevelKey                        = pre(CollectorLogKey) + "level"
	CollectorLogPathKey                         = pre(CollectorLogKey) + "path"

	CommandAuthKey                     = pre(CommandRootKey) + "auth"
	CommandAuthTokenKey                = pre(CommandAuthKey) + "token"
	CommandAuthTokenPathKey            = pre(CommandAuthKey) + "tokenpath"
	CommandServerHostKey               = pre(CommandServerKey) + "host"
	CommandServerKey                   = pre(CommandRootKey) + "server"
	CommandServerPortKey               = pre(CommandServerKey) + "port"
	CommandServerTypeKey               = pre(CommandServerKey) + "type"
	CommandTLSKey                      = pre(CommandRootKey) + "tls"
	CommandTLSCaKey                    = pre(CommandTLSKey) + "ca"
	CommandTLSCertKey                  = pre(CommandTLSKey) + "cert"
	CommandTLSKeyKey                   = pre(CommandTLSKey) + "key"
	CommandTLSServerNameKey            = pre(CommandTLSKey) + "server_name"
	CommandTLSSkipVerifyKey            = pre(CommandTLSKey) + "skip_verify"
	CommandServerProxyTimeoutKey       = pre(CommandServerKey) + "proxy_timeout"
	CommandServerProxyURLKey           = pre(CommandServerKey) + "proxy_url"
	CommandServerProxyUsernameKey      = pre(CommandServerKey) + "proxy_username"
	CommandServerProxyPasswordKey      = pre(CommandServerKey) + "proxy_password"
	CommandServerProxyNoProxyKey       = pre(CommandServerKey) + "proxy_no_proxy"
	CommandServerProxyTokenKey         = pre(CommandServerKey) + "proxy_token"
	CommandServerProxyAuthMethodKey    = pre(CommandServerKey) + "proxy_auth_method"
	CommandServerProxyTLSCertKey       = pre(CommandServerKey) + "proxy_tls_cert"
	CommandServerProxyTLSKeyKey        = pre(CommandServerKey) + "proxy_tls_key"
	CommandServerProxyTLSCaKey         = pre(CommandServerKey) + "proxy_tls_ca"
	CommandServerProxyTLSSkipVerifyKey = pre(CommandServerKey) + "proxy_tls_skip_verify"
	CommandServerProxyTLSServerNameKey = pre(CommandServerKey) + "proxy_tls_server_name"

	AuxiliaryCommandAuthKey          = pre(AuxiliaryCommandRootKey) + "auth"
	AuxiliaryCommandAuthTokenKey     = pre(AuxiliaryCommandAuthKey) + "token"
	AuxiliaryCommandAuthTokenPathKey = pre(AuxiliaryCommandAuthKey) + "tokenpath"
	AuxiliaryCommandServerHostKey    = pre(AuxiliaryCommandServerKey) + "host"
	AuxiliaryCommandServerKey        = pre(AuxiliaryCommandRootKey) + "server"
	AuxiliaryCommandServerPortKey    = pre(AuxiliaryCommandServerKey) + "port"
	AuxiliaryCommandServerTypeKey    = pre(AuxiliaryCommandServerKey) + "type"
	AuxiliaryCommandTLSKey           = pre(AuxiliaryCommandRootKey) + "tls"
	AuxiliaryCommandTLSCaKey         = pre(AuxiliaryCommandTLSKey) + "ca"
	AuxiliaryCommandTLSCertKey       = pre(AuxiliaryCommandTLSKey) + "cert"
	AuxiliaryCommandTLSKeyKey        = pre(AuxiliaryCommandTLSKey) + "key"
	AuxiliaryCommandTLSServerNameKey = pre(AuxiliaryCommandTLSKey) + "server_name"
	AuxiliaryCommandTLSSkipVerifyKey = pre(AuxiliaryCommandTLSKey) + "skip_verify"

	LogLevelKey = pre(LogLevelRootKey) + "level"
	LogPathKey  = pre(LogLevelRootKey) + "path"

	NginxReloadMonitoringPeriodKey           = pre(DataPlaneConfigRootKey, "nginx") + "reload_monitoring_period"
	NginxTreatWarningsAsErrorsKey            = pre(DataPlaneConfigRootKey, "nginx") + "treat_warnings_as_errors"
	NginxReloadBackoffKey                    = pre(DataPlaneConfigRootKey, "nginx") + "reload_backoff"
	NginxReloadBackoffInitialIntervalKey     = pre(NginxReloadBackoffKey) + "initial_interval"
	NginxReloadBackoffMaxIntervalKey         = pre(NginxReloadBackoffKey) + "max_interval"
	NginxReloadBackoffMaxElapsedTimeKey      = pre(NginxReloadBackoffKey) + "max_elapsed_time"
	NginxReloadBackoffRandomizationFactorKey = pre(NginxReloadBackoffKey) + "randomization_factor"
	NginxReloadBackoffMultiplierKey          = pre(NginxReloadBackoffKey) + "multiplier"
	NginxExcludeLogsKey                      = pre(DataPlaneConfigRootKey, "nginx") + "exclude_logs"
	NginxApiTlsCa                            = pre(DataPlaneConfigRootKey, "nginx") + "api_tls_ca"

	FileWatcherMonitoringFrequencyKey = pre(FileWatcherKey) + "monitoring_frequency"
	NginxExcludeFilesKey              = pre(FileWatcherKey) + "exclude_files"
)
View Source
var CompletionCommand = &cobra.Command{
	Use:   "completion [bash|zsh|fish]",
	Short: "Generate completion script.",
	Long: `To load completions:

Bash:

$ source <(nginx-agent completion bash)

# To load completions for each session, execute once:
Linux:
  $ nginx-agent completion bash > /etc/bash_completion.d/nginx-agent
MacOS:
  $ nginx-agent completion bash > /usr/local/etc/bash_completion.d/nginx-agent

Zsh:

# If shell completion is not already enabled in your environment you will need
# to enable it.  You can execute the following once:

$ echo "autoload -U compinit; compinit" >> ~/.zshrc

# To load completions for each session, execute once:
$ nginx-agent completion zsh > "${fpath[1]}/_nginx-agent"

# You will need to start a new shell for this setup to take effect.

Fish:

$ nginx-agent completion fish | source

# To load completions for each session, execute once:
$ nginx-agent completion fish > ~/.config/fish/completions/nginx-agent.fish
`,
	DisableFlagsInUseLine: true,
	ValidArgs:             []string{"bash", "zsh", "fish"},
	Args:                  cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
	Run: func(cmd *cobra.Command, args []string) {
		var err error

		switch args[0] {
		case "bash":
			err = cmd.Root().GenBashCompletion(os.Stdout)
		case "zsh":
			err = cmd.Root().GenZshCompletion(os.Stdout)
		case "fish":
			err = cmd.Root().GenFishCompletion(os.Stdout, true)
		}

		if err != nil {
			slog.Warn("Error sending command", "error", err)
		}
	},
}
View Source
var RootCommand = &cobra.Command{
	Use:   "nginx-agent [flags]",
	Short: "nginx-agent",
}

Functions

func DefaultAllowedDirectories

func DefaultAllowedDirectories() []string

func DefaultExcludedFiles

func DefaultExcludedFiles() []string

func DefaultFeatures

func DefaultFeatures() []string

func DefaultLabels

func DefaultLabels() map[string]string

func Execute

func Execute(ctx context.Context) error

func Init

func Init(version, commit string)

func RegisterConfigFile

func RegisterConfigFile() error

func RegisterRunner

func RegisterRunner(r func(cmd *cobra.Command, args []string))

func ToAuxiliaryCommandServerProto added in v3.2.0

func ToAuxiliaryCommandServerProto(cmd *Command) *mpi.AuxiliaryCommandServer

ToAuxiliaryCommandServerProto maps the AgentConfig Command struct back to the AuxiliaryCommandServer proto message

func ToCommandProto

func ToCommandProto(cmd *Command) *mpi.CommandServer

ToCommandProto maps the AgentConfig Command struct back to the Command proto message

Types

type APIDetails

type APIDetails struct {
	URL      string `yaml:"url"      mapstructure:"url"`
	Listen   string `yaml:"listen"   mapstructure:"listen"`
	Location string `yaml:"location" mapstructure:"location"`
	Ca       string `yaml:"ca"       mapstructure:"ca"`
}

type AccessLog

type AccessLog struct {
	FilePath  string `yaml:"file_path"  mapstructure:"file_path"`
	LogFormat string `yaml:"log_format" mapstructure:"log_format"`
}

type Action

type Action struct {
	Key    string `yaml:"key"    mapstructure:"key"`
	Action string `yaml:"action" mapstructure:"action"`
	Value  string `yaml:"value"  mapstructure:"value"`
}

type Attribute

type Attribute struct {
	Actions []Action `yaml:"actions" mapstructure:"actions"`
}

type AuthConfig

type AuthConfig struct {
	Token     string `yaml:"token"     mapstructure:"token"`
	TokenPath string `yaml:"tokenpath" mapstructure:"tokenpath"`
}

type BackOff

type BackOff struct {
	InitialInterval     time.Duration `yaml:"initial_interval"     mapstructure:"initial_interval"`
	MaxInterval         time.Duration `yaml:"max_interval"         mapstructure:"max_interval"`
	MaxElapsedTime      time.Duration `yaml:"max_elapsed_time"     mapstructure:"max_elapsed_time"`
	RandomizationFactor float64       `yaml:"randomization_factor" mapstructure:"randomization_factor"`
	Multiplier          float64       `yaml:"multiplier"           mapstructure:"multiplier"`
}

type Batch

type Batch struct {
	SendBatchSize    uint32        `yaml:"send_batch_size"     mapstructure:"send_batch_size"`
	SendBatchMaxSize uint32        `yaml:"send_batch_max_size" mapstructure:"send_batch_max_size"`
	Timeout          time.Duration `yaml:"timeout"             mapstructure:"timeout"`
}

type CPUScraper

type CPUScraper struct{}

type Client

type Client struct {
	HTTP    *HTTP    `yaml:"http"    mapstructure:"http"`
	Grpc    *GRPC    `yaml:"grpc"    mapstructure:"grpc"`
	Backoff *BackOff `yaml:"backoff" mapstructure:"backoff"`
}

type Collector

type Collector struct {
	ConfigPath string     `yaml:"config_path" mapstructure:"config_path"`
	Log        *Log       `yaml:"log"         mapstructure:"log"`
	Exporters  Exporters  `yaml:"exporters"   mapstructure:"exporters"`
	Extensions Extensions `yaml:"extensions"  mapstructure:"extensions"`
	Processors Processors `yaml:"processors"  mapstructure:"processors"`
	Pipelines  Pipelines  `yaml:"pipelines"   mapstructure:"pipelines"`
	Receivers  Receivers  `yaml:"receivers"   mapstructure:"receivers"`
}

func (*Collector) Validate

func (col *Collector) Validate(allowedDirectories []string) error

type Command

type Command struct {
	Server *ServerConfig `yaml:"server" mapstructure:"server"`
	Auth   *AuthConfig   `yaml:"auth"   mapstructure:"auth"`
	TLS    *TLSConfig    `yaml:"tls"    mapstructure:"tls"`
}

func FromCommandProto

func FromCommandProto(config *mpi.CommandServer) *Command

FromCommandProto maps the AgentConfig Command struct to the Command proto message

type Config

type Config struct {
	Command            *Command         `yaml:"command"             mapstructure:"command"`
	AuxiliaryCommand   *Command         `yaml:"auxiliary_command"   mapstructure:"auxiliary_command"`
	Log                *Log             `yaml:"log"                 mapstructure:"log"`
	DataPlaneConfig    *DataPlaneConfig `yaml:"data_plane_config"   mapstructure:"data_plane_config"`
	Client             *Client          `yaml:"client"              mapstructure:"client"`
	Collector          *Collector       `yaml:"collector"           mapstructure:"collector"`
	Watchers           *Watchers        `yaml:"watchers"            mapstructure:"watchers"`
	Labels             map[string]any   `yaml:"labels"              mapstructure:"labels"`
	Version            string           `yaml:"-"`
	Path               string           `yaml:"-"`
	UUID               string           `yaml:"-"`
	ManifestDir        string           `yaml:"-"`
	AllowedDirectories []string         `yaml:"allowed_directories" mapstructure:"allowed_directories"`
	Features           []string         `yaml:"features"            mapstructure:"features"`
}

func ResolveConfig

func ResolveConfig() (*Config, error)

func (*Config) AreReceiversConfigured

func (c *Config) AreReceiversConfigured() bool

func (*Config) IsACollectorExporterConfigured

func (c *Config) IsACollectorExporterConfigured() bool

func (*Config) IsAuxiliaryCommandGrpcClientConfigured added in v3.2.0

func (c *Config) IsAuxiliaryCommandGrpcClientConfigured() bool

func (*Config) IsCommandGrpcClientConfigured added in v3.2.0

func (c *Config) IsCommandGrpcClientConfigured() bool

func (*Config) IsCommandServerProxyConfigured added in v3.3.0

func (c *Config) IsCommandServerProxyConfigured() bool

func (*Config) IsDirectoryAllowed

func (c *Config) IsDirectoryAllowed(directory string) bool

func (*Config) IsFeatureEnabled

func (c *Config) IsFeatureEnabled(feature string) bool

func (*Config) NewContextWithLabels added in v3.2.0

func (c *Config) NewContextWithLabels(ctx context.Context) context.Context

type ContainerMetricsReceiver

type ContainerMetricsReceiver struct {
	CollectionInterval time.Duration `yaml:"collection_interval" mapstructure:"collection_interval"`
}

type DataPlaneConfig

type DataPlaneConfig struct {
	Nginx *NginxDataPlaneConfig `yaml:"nginx" mapstructure:"nginx"`
}

type DebugExporter

type DebugExporter struct{}

type DiskScraper

type DiskScraper struct{}

type Exporters

type Exporters struct {
	Debug              *DebugExporter           `yaml:"debug"      mapstructure:"debug"`
	PrometheusExporter *PrometheusExporter      `yaml:"prometheus" mapstructure:"prometheus"`
	OtlpExporters      map[string]*OtlpExporter `yaml:"otlp"       mapstructure:"otlp"`
}

type Extensions

type Extensions struct {
	Health        *Health        `yaml:"health"         mapstructure:"health"`
	HeadersSetter *HeadersSetter `yaml:"headers_setter" mapstructure:"headers_setter"`
}

type FileWatcher

type FileWatcher struct {
	ExcludeFiles        []string      `yaml:"exclude_files"        mapstructure:"exclude_files"`
	MonitoringFrequency time.Duration `yaml:"monitoring_frequency" mapstructure:"monitoring_frequency"`
}

type FilesystemScraper

type FilesystemScraper struct{}

type GRPC

type GRPC struct {
	KeepAlive *KeepAlive `yaml:"keepalive" mapstructure:"keepalive"`
	// if MaxMessageSize is size set then we use that value,
	// otherwise MaxMessageRecieveSize and MaxMessageSendSize for individual settings
	MaxMessageSize        int    `yaml:"max_message_size"         mapstructure:"max_message_size"`
	MaxMessageReceiveSize int    `yaml:"max_message_receive_size" mapstructure:"max_message_receive_size"`
	MaxMessageSendSize    int    `yaml:"max_message_send_size"    mapstructure:"max_message_send_size"`
	MaxFileSize           uint32 `yaml:"max_file_size"            mapstructure:"max_file_size"`
	FileChunkSize         uint32 `yaml:"file_chunk_size"          mapstructure:"file_chunk_size"`
}

type HTTP

type HTTP struct {
	Timeout time.Duration `yaml:"timeout" mapstructure:"timeout"`
}
type Header struct {
	Action       string `yaml:"action"        mapstructure:"action"`
	Key          string `yaml:"key"           mapstructure:"key"`
	Value        string `yaml:"value"         mapstructure:"value"`
	DefaultValue string `yaml:"default_value" mapstructure:"default_value"`
	FromContext  string `yaml:"from_context"  mapstructure:"from_context"`
	FilePath     string `yaml:"file_path"     mapstructure:"file_path"`
}

type HeadersSetter

type HeadersSetter struct {
	Headers []Header `yaml:"headers" mapstructure:"headers"`
}

type Health

type Health struct {
	Server *ServerConfig `yaml:"server" mapstructure:"server"`
	TLS    *TLSConfig    `yaml:"tls"    mapstructure:"tls"`
	Path   string        `yaml:"path"   mapstructure:"path"`
}

type HostMetrics

type HostMetrics struct {
	Scrapers           *HostMetricsScrapers `yaml:"scrapers"            mapstructure:"scrapers"`
	CollectionInterval time.Duration        `yaml:"collection_interval" mapstructure:"collection_interval"`
	InitialDelay       time.Duration        `yaml:"initial_delay"       mapstructure:"initial_delay"`
}

type HostMetricsScrapers

type HostMetricsScrapers struct {
	CPU        *CPUScraper        `yaml:"cpu"        mapstructure:"cpu"`
	Disk       *DiskScraper       `yaml:"disk"       mapstructure:"disk"`
	Filesystem *FilesystemScraper `yaml:"filesystem" mapstructure:"filesystem"`
	Memory     *MemoryScraper     `yaml:"memory"     mapstructure:"memory"`
	Network    *NetworkScraper    `yaml:"network"    mapstructure:"network"`
}

type InstanceHealthWatcher

type InstanceHealthWatcher struct {
	MonitoringFrequency time.Duration `yaml:"monitoring_frequency" mapstructure:"monitoring_frequency"`
}

type InstanceWatcher

type InstanceWatcher struct {
	MonitoringFrequency time.Duration `yaml:"monitoring_frequency" mapstructure:"monitoring_frequency"`
}

type KeepAlive

type KeepAlive struct {
	Timeout             time.Duration `yaml:"timeout"               mapstructure:"timeout"`
	Time                time.Duration `yaml:"time"                  mapstructure:"time"`
	PermitWithoutStream bool          `yaml:"permit_without_stream" mapstructure:"permit_without_stream"`
}

type Log

type Log struct {
	Level string `yaml:"level" mapstructure:"level"`
	Path  string `yaml:"path"  mapstructure:"path"`
}

type LogsGzip added in v3.1.0

type LogsGzip struct{}

type MemoryScraper

type MemoryScraper struct{}

type NetworkScraper

type NetworkScraper struct{}

type NginxDataPlaneConfig

type NginxDataPlaneConfig struct {
	ReloadBackoff          *BackOff      `yaml:"reload_backoff"           mapstructure:"reload_backoff"`
	APITls                 TLSConfig     `yaml:"api_tls"                  mapstructure:"api_tls"`
	ExcludeLogs            []string      `yaml:"exclude_logs"             mapstructure:"exclude_logs"`
	ReloadMonitoringPeriod time.Duration `yaml:"reload_monitoring_period" mapstructure:"reload_monitoring_period"`
	TreatWarningsAsErrors  bool          `yaml:"treat_warnings_as_errors" mapstructure:"treat_warnings_as_errors"`
}

type NginxPlusReceiver

type NginxPlusReceiver struct {
	InstanceID         string        `yaml:"instance_id"         mapstructure:"instance_id"`
	PlusAPI            APIDetails    `yaml:"api_details"         mapstructure:"api_details"`
	CollectionInterval time.Duration `yaml:"collection_interval" mapstructure:"collection_interval"`
}

type NginxReceiver

type NginxReceiver struct {
	InstanceID         string        `yaml:"instance_id"         mapstructure:"instance_id"`
	StubStatus         APIDetails    `yaml:"api_details"         mapstructure:"api_details"`
	AccessLogs         []AccessLog   `yaml:"access_logs"         mapstructure:"access_logs"`
	CollectionInterval time.Duration `yaml:"collection_interval" mapstructure:"collection_interval"`
}

func (*NginxReceiver) Validate

func (nr *NginxReceiver) Validate(allowedDirectories []string) error

type Operator

type Operator struct {
	Fields map[string]string `yaml:"fields" mapstructure:"fields"`
	Type   string            `yaml:"type"   mapstructure:"type"`
}

There are many types of operators with different field names so we use a generic map to store the fields. See here for more info: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/stanza/docs/operators/README.md

type OtlpExporter

type OtlpExporter struct {
	Server        *ServerConfig `yaml:"server"        mapstructure:"server"`
	TLS           *TLSConfig    `yaml:"tls"           mapstructure:"tls"`
	Compression   string        `yaml:"compression"   mapstructure:"compression"`
	Authenticator string        `yaml:"authenticator" mapstructure:"authenticator"`
}

type OtlpReceiver

type OtlpReceiver struct {
	Server        *ServerConfig  `yaml:"server" mapstructure:"server"`
	Auth          *AuthConfig    `yaml:"auth"   mapstructure:"auth"`
	OtlpTLSConfig *OtlpTLSConfig `yaml:"tls"    mapstructure:"tls"`
}

type OtlpTLSConfig

type OtlpTLSConfig struct {
	Cert                   string `yaml:"cert"                      mapstructure:"cert"`
	Key                    string `yaml:"key"                       mapstructure:"key"`
	Ca                     string `yaml:"ca"                        mapstructure:"ca"`
	ServerName             string `yaml:"server_name"               mapstructure:"server_name"`
	ExistingCert           bool   `yaml:"-"`
	SkipVerify             bool   `yaml:"skip_verify"               mapstructure:"skip_verify"`
	GenerateSelfSignedCert bool   `yaml:"generate_self_signed_cert" mapstructure:"generate_self_signed_cert"`
}

Specialized TLS configuration for OtlpReceiver with self-signed cert generation.

type Pipeline added in v3.2.0

type Pipeline struct {
	Receivers  []string `yaml:"receivers"  mapstructure:"receivers"`
	Processors []string `yaml:"processors" mapstructure:"processors"`
	Exporters  []string `yaml:"exporters"  mapstructure:"exporters"`
}

type Pipelines added in v3.2.0

type Pipelines struct {
	Metrics map[string]*Pipeline `yaml:"metrics" mapstructure:"metrics"`
	Logs    map[string]*Pipeline `yaml:"logs"    mapstructure:"logs"`
}

type Processors

type Processors struct {
	Attribute map[string]*Attribute `yaml:"attribute" mapstructure:"attribute"`
	Resource  map[string]*Resource  `yaml:"resource"  mapstructure:"resource"`
	Batch     map[string]*Batch     `yaml:"batch"     mapstructure:"batch"`
	LogsGzip  map[string]*LogsGzip  `yaml:"logsgzip"  mapstructure:"logsgzip"`
}

OTel Collector Processors configuration.

type PrometheusExporter

type PrometheusExporter struct {
	Server *ServerConfig `yaml:"server" mapstructure:"server"`
	TLS    *TLSConfig    `yaml:"tls"    mapstructure:"tls"`
}

type Proxy added in v3.3.0

type Proxy struct {
	TLS        *TLSConfig    `yaml:"tls,omitempty"         mapstructure:"tls"`
	URL        string        `yaml:"url"                   mapstructure:"url"`
	NoProxy    string        `yaml:"no_proxy,omitempty"    mapstructure:"no_proxy"`
	AuthMethod string        `yaml:"auth_method,omitempty" mapstructure:"auth_method"`
	Username   string        `yaml:"username,omitempty"    mapstructure:"username"`
	Password   string        `yaml:"password,omitempty"    mapstructure:"password"`
	Token      string        `yaml:"token,omitempty"       mapstructure:"token"`
	Timeout    time.Duration `yaml:"timeout"               mapstructure:"timeout"`
}

type Receivers

type Receivers struct {
	ContainerMetrics   *ContainerMetricsReceiver  `yaml:"container_metrics" mapstructure:"container_metrics"`
	HostMetrics        *HostMetrics               `yaml:"host_metrics"      mapstructure:"host_metrics"`
	OtlpReceivers      map[string]*OtlpReceiver   `yaml:"otlp"              mapstructure:"otlp"`
	TcplogReceivers    map[string]*TcplogReceiver `yaml:"tcplog"            mapstructure:"tcplog"`
	NginxReceivers     []NginxReceiver            `yaml:"-"`
	NginxPlusReceivers []NginxPlusReceiver        `yaml:"-"`
}

OTel Collector Receiver configuration.

type Resource

type Resource struct {
	Attributes []ResourceAttribute `yaml:"attributes" mapstructure:"attributes"`
}

type ResourceAttribute

type ResourceAttribute struct {
	Key    string `yaml:"key"    mapstructure:"key"`
	Action string `yaml:"action" mapstructure:"action"`
	Value  string `yaml:"value"  mapstructure:"value"`
}

type ServerConfig

type ServerConfig struct {
	Proxy *Proxy     `yaml:"proxy" mapstructure:"proxy"`
	Type  ServerType `yaml:"type"  mapstructure:"type"`
	Host  string     `yaml:"host"  mapstructure:"host"`
	Port  int        `yaml:"port"  mapstructure:"port"`
}

type ServerType

type ServerType string
const (
	Grpc ServerType = "grpc"
)

type TLSConfig

type TLSConfig struct {
	Cert       string `yaml:"cert"        mapstructure:"cert"`
	Key        string `yaml:"key"         mapstructure:"key"`
	Ca         string `yaml:"ca"          mapstructure:"ca"`
	ServerName string `yaml:"server_name" mapstructure:"server_name"`
	SkipVerify bool   `yaml:"skip_verify" mapstructure:"skip_verify"`
}

type TcplogReceiver

type TcplogReceiver struct {
	ListenAddress string     `yaml:"listen_address" mapstructure:"listen_address"`
	Operators     []Operator `yaml:"operators"      mapstructure:"operators"`
}

type Watchers

type Watchers struct {
	FileWatcher     FileWatcher     `yaml:"file_watcher"     mapstructure:"file_watcher"`
	InstanceWatcher InstanceWatcher `yaml:"instance_watcher" mapstructure:"instance_watcher"`
	//nolint:lll // this needs to be in one line
	InstanceHealthWatcher InstanceHealthWatcher `yaml:"instance_health_watcher" mapstructure:"instance_health_watcher"`
}

Jump to

Keyboard shortcuts

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