Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientConfig ¶
type ClientConfig struct {
confighttp.ClientConfig `mapstructure:",squash"`
// CloudID holds the cloud ID to identify the Elastic Cloud cluster to send events to.
// https://www.elastic.co/guide/en/cloud/current/ec-cloud-id.html
//
// This setting is required if no URL is configured.
CloudID string `mapstructure:"cloudid"`
// ELASTICSEARCH_URL environment variable is not set.
Endpoints []string `mapstructure:"endpoints"`
Retry RetrySettings `mapstructure:"retry"`
Discovery DiscoverySettings `mapstructure:"discover"`
// TelemetrySettings contains settings useful for testing/debugging purposes
// This is experimental and may change at any time.
TelemetrySettings `mapstructure:"telemetry"`
}
func NewDefaultClientConfig ¶
func NewDefaultClientConfig() ClientConfig
NewDefaultClientConfig returns ClientConfig type object with the default values of 'MaxIdleConns' and 'IdleConnTimeout', as well as http.DefaultTransport values. Other config options are not added as they are initialized with 'zero value' by GoLang as default. We encourage to use this function to create an object of ClientConfig.
func (*ClientConfig) ToClient ¶
func (cfg *ClientConfig) ToClient( ctx context.Context, host component.Host, telemetry component.TelemetrySettings, ) (*elasticsearch.Client, error)
user_agent should be added with the confighttp client
func (*ClientConfig) Validate ¶
func (cfg *ClientConfig) Validate() error
Validate checks the receiver configuration is valid.
type DiscoverySettings ¶
type DiscoverySettings struct {
// OnStart, if set, instructs the exporter to look for available Elasticsearch
// nodes the first time the exporter connects to the cluster.
OnStart bool `mapstructure:"on_start"`
// Interval instructs the exporter to renew the list of Elasticsearch URLs
// with the given interval. URLs will not be updated if Interval is <=0.
Interval time.Duration `mapstructure:"interval"`
}
DiscoverySettings defines Elasticsearch node discovery related settings. The exporter will check Elasticsearch regularly for available nodes and updates the list of hosts if discovery is enabled. Newly discovered nodes will automatically be used for load balancing.
DiscoverySettings should not be enabled when operating Elasticsearch behind a proxy or load balancer.
https://www.elastic.co/blog/elasticsearch-sniffing-best-practices-what-when-why-how
type RetrySettings ¶
type RetrySettings struct {
// RetryOnStatus configures the status codes that trigger request or document level retries.
RetryOnStatus []int `mapstructure:"retry_on_status"`
// MaxRetries configures how many times an HTTP request is retried.
MaxRetries int `mapstructure:"max_retries"`
// InitialInterval configures the initial waiting time if a request failed.
InitialInterval time.Duration `mapstructure:"initial_interval"`
// MaxInterval configures the max waiting time if consecutive requests failed.
MaxInterval time.Duration `mapstructure:"max_interval"`
// Enabled allows users to disable retry without having to comment out all settings.
Enabled bool `mapstructure:"enabled"`
}
RetrySettings defines settings for the HTTP request retries in the Elasticsearch exporter. Failed sends are retried with exponential backoff.