config

package
v1.65.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 24 Imported by: 42

Documentation

Index

Constants

View Source
const (
	IndexPrefixSeparator = "-"
)

Variables

This section is empty.

Functions

func GetHTTPRoundTripper added in v1.19.0

func GetHTTPRoundTripper(c *Configuration, logger *zap.Logger) (http.RoundTripper, error)

GetHTTPRoundTripper returns configured http.RoundTripper

func NewClient added in v1.45.0

func NewClient(c *Configuration, logger *zap.Logger, metricsFactory metrics.Factory) (es.Client, error)

NewClient creates a new ElasticSearch client

func RolloverFrequencyAsNegativeDuration added in v1.63.0

func RolloverFrequencyAsNegativeDuration(frequency string) time.Duration

RolloverFrequencyAsNegativeDuration returns the index rollover frequency duration for the given frequency string

Types

type Authentication added in v1.63.0

type Authentication struct {
	BasicAuthentication       BasicAuthentication       `mapstructure:"basic"`
	BearerTokenAuthentication BearerTokenAuthentication `mapstructure:"bearer_token"`
}

type BasicAuthentication added in v1.63.0

type BasicAuthentication struct {
	// Username contains the username required to connect to Elasticsearch.
	Username string `mapstructure:"username"`
	// Password contains The password required by Elasticsearch
	Password string `mapstructure:"password" json:"-"`
	// PasswordFilePath contains the path to a file containing password.
	// This file is watched for changes.
	PasswordFilePath string `mapstructure:"password_file"`
}

type BearerTokenAuthentication added in v1.63.0

type BearerTokenAuthentication struct {
	// FilePath contains the path to a file containing a bearer token.
	FilePath string `mapstructure:"file_path"`
	// AllowTokenFromContext, if set to true, enables reading bearer token from the context.
	AllowFromContext bool `mapstructure:"from_context"`
}

BearerTokenAuthentication contains the configuration for attaching bearer tokens when making HTTP requests. Note that TokenFilePath and AllowTokenFromContext should not both be enabled. If both TokenFilePath and AllowTokenFromContext are set, the TokenFilePath will be ignored. For more information about token-based authentication in elasticsearch, check out https://www.elastic.co/guide/en/elasticsearch/reference/current/token-authentication-services.html.

type BulkProcessing added in v1.63.0

type BulkProcessing struct {
	// MaxBytes, contains the number of bytes which specifies when to flush.
	MaxBytes int `mapstructure:"max_bytes"`
	// MaxActions contain the number of added actions which specifies when to flush.
	MaxActions int `mapstructure:"max_actions"`
	// FlushInterval is the interval at the end of which a flush occurs.
	FlushInterval time.Duration `mapstructure:"flush_interval"`
	// Workers contains the number of concurrent workers allowed to be executed.
	Workers int `mapstructure:"workers"`
}

type Configuration

type Configuration struct {
	// ---- connection related configs ----
	// Servers is a list of Elasticsearch servers. The strings must must contain full URLs
	// (i.e. http://localhost:9200).
	Servers []string `mapstructure:"server_urls" valid:"required,url"`
	// RemoteReadClusters is a list of Elasticsearch remote cluster names for cross-cluster
	// querying.
	RemoteReadClusters []string       `mapstructure:"remote_read_clusters"`
	Authentication     Authentication `mapstructure:"auth"`
	// TLS contains the TLS configuration for the connection to the ElasticSearch clusters.
	TLS      configtls.ClientConfig `mapstructure:"tls"`
	Sniffing Sniffing               `mapstructure:"sniffing"`
	// SendGetBodyAs is the HTTP verb to use for requests that contain a body.
	SendGetBodyAs string `mapstructure:"send_get_body_as"`
	// QueryTimeout contains the timeout used for queries. A timeout of zero means no timeout.
	QueryTimeout time.Duration `mapstructure:"query_timeout"`

	// ---- elasticsearch client related configs ----
	BulkProcessing BulkProcessing `mapstructure:"bulk_processing"`
	// Version contains the major Elasticsearch version. If this field is not specified,
	// the value will be auto-detected from Elasticsearch.
	Version uint `mapstructure:"version"`
	// LogLevel contains the Elasticsearch client log-level. Valid values for this field
	// are: [debug, info, error]
	LogLevel string `mapstructure:"log_level"`

	// ---- index related configs ----
	Indices Indices `mapstructure:"indices"`
	// UseReadWriteAliases, if set to true, will use read and write aliases for indices.
	// Use this option with Elasticsearch rollover API. It requires an external component
	// to create aliases before startup and then performing its management.
	UseReadWriteAliases bool `mapstructure:"use_aliases"`
	// CreateIndexTemplates, if set to true, creates index templates at application startup.
	// This configuration should be set to false when templates are installed manually.
	CreateIndexTemplates bool `mapstructure:"create_mappings"`
	// Option to enable Index Lifecycle Management (ILM) for Jaeger span and service indices.
	// Read more about ILM at
	// https://www.jaegertracing.io/docs/deployment/#enabling-ilm-support
	UseILM bool `mapstructure:"use_ilm"`

	// ---- jaeger-specific configs ----
	// MaxDocCount Defines maximum number of results to fetch from storage per query.
	MaxDocCount int `mapstructure:"max_doc_count"`
	// MaxSpanAge configures the maximum lookback on span reads.
	MaxSpanAge time.Duration `mapstructure:"max_span_age"`
	// ServiceCacheTTL contains the TTL for the cache of known service names.
	ServiceCacheTTL time.Duration `mapstructure:"service_cache_ttl"`
	// AdaptiveSamplingLookback contains the duration to look back for the
	// latest adaptive sampling probabilities.
	AdaptiveSamplingLookback time.Duration `mapstructure:"adaptive_sampling_lookback"`
	Tags                     TagsAsFields  `mapstructure:"tags_as_fields"`
	// Enabled, if set to true, enables the namespace for storage pointed to by this configuration.
	Enabled bool `mapstructure:"-"`
}

Configuration describes the configuration properties needed to connect to an ElasticSearch cluster

func (*Configuration) ApplyDefaults added in v0.6.0

func (c *Configuration) ApplyDefaults(source *Configuration)

ApplyDefaults copies settings from source unless its own value is non-zero.

func (*Configuration) TagKeysAsFields added in v1.19.0

func (c *Configuration) TagKeysAsFields() ([]string, error)

TagKeysAsFields returns tags from the file and command line merged

func (*Configuration) Validate added in v1.55.0

func (c *Configuration) Validate() error

type IndexOptions added in v1.63.0

type IndexOptions struct {
	// Priority contains the priority of index template (ESv8 only).
	Priority int64 `mapstructure:"priority"`
	// DateLayout contains the format string used to format current time to part of the index name.
	// For example, "2006-01-02" layout will result in "jaeger-spans-yyyy-mm-dd".
	// If not specified, the default value is "2006-01-02".
	// See https://pkg.go.dev/time#Layout for more details on the syntax.
	DateLayout string `mapstructure:"date_layout"`
	// Shards is the number of shards per index in Elasticsearch.
	Shards int64 `mapstructure:"shards"`
	// Replicas is the number of replicas per index in Elasticsearch.
	Replicas int64 `mapstructure:"replicas"`
	// RolloverFrequency contains the rollover frequency setting used to fetch
	// indices from elasticsearch.
	// Valid configuration options are: [hour, day].
	// This setting does not affect the index rotation and is simply used for
	// fetching indices.
	RolloverFrequency string `mapstructure:"rollover_frequency"`
}

IndexOptions describes the index format and rollover frequency

type IndexPrefix added in v1.63.0

type IndexPrefix string

func (IndexPrefix) Apply added in v1.63.0

func (p IndexPrefix) Apply(indexName string) string

type Indices added in v1.63.0

type Indices struct {
	// IndexPrefix is an optional prefix to prepend to Jaeger indices.
	// For example, setting this field to "production" creates "production-jaeger-*".
	IndexPrefix  IndexPrefix  `mapstructure:"index_prefix"`
	Spans        IndexOptions `mapstructure:"spans"`
	Services     IndexOptions `mapstructure:"services"`
	Dependencies IndexOptions `mapstructure:"dependencies"`
	Sampling     IndexOptions `mapstructure:"sampling"`
}

Indices describes different configuration options for each index type

type Sniffing added in v1.63.0

type Sniffing struct {
	// Enabled, if set to true, enables sniffing for the ElasticSearch client.
	Enabled bool `mapstructure:"enabled"`
	// UseHTTPS, if set to true, sets the HTTP scheme to HTTPS when performing sniffing.
	// For ESV8, the scheme is set to HTTPS by default, so this configuration is ignored.
	UseHTTPS bool `mapstructure:"use_https"`
}

Sniffing sets the sniffing configuration for the ElasticSearch client, which is the process of finding all the nodes of your cluster. Read more about sniffing at https://github.com/olivere/elastic/wiki/Sniffing.

type TagsAsFields added in v1.18.0

type TagsAsFields struct {
	// Store all tags as object fields, instead nested objects
	AllAsFields bool `mapstructure:"all"`
	// Dot replacement for tag keys when stored as object fields
	DotReplacement string `mapstructure:"dot_replacement"`
	// File path to tag keys which should be stored as object fields
	File string `mapstructure:"config_file"`
	// Comma delimited list of tags to store as object fields
	Include string `mapstructure:"include"`
}

TagsAsFields holds configuration for tag schema. By default Jaeger stores tags in an array of nested objects. This configurations allows to store tags as object fields for better Kibana support.

Jump to

Keyboard shortcuts

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