elasticsearch

package
v1.66.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

README

ElasticSearch Support

This provides a storage backend for Jaeger using Elasticsearch. More information is available on the Jaeger documentation website.

Indices

Indices will be created depending on the spans timestamp. i.e., a span with a timestamp on 2017/04/21 will be stored in an index named jaeger-2017-04-21.

It is common to only keep observability data for a limited time. However, Elasticsearch does no support expiring of old data via TTL. To purge old Jaeger indices, use jaeger-es-index-cleaner.

Timestamps

Because ElasticSearch's Date datatype has only millisecond granularity and Jaeger requires microsecond granularity, Jaeger spans' StartTime is saved as a long type. The conversion is done automatically.

Nested fields (tags)

Tags are nested fields in the ElasticSearch schema used for Jaeger. This allows for better search capabilities and data retention. However, because ElasticSearch creates a new document for every nested field, there is currently a limit of 50 nested fields per document.

Shards and Replicas

Number of shards and replicas per index can be specified as parameters to the writer and/or through configs under ./pkg/es/config/config.go. If not specified, it defaults to ElasticSearch defaults: 5 shards and 1 replica. This article goes into more information about choosing how many shards should be chosen for optimization.

Limitations

Tag query over multiple spans

This plugin queries against spans. This means that all tags in a query must lie under the same span for a query to successfully return a trace.

Case-sensitivity

Queries are case-sensitive. For example, if a document with service name ABC is searched using a query abc, the document will not be retrieved.

Testing

To locally test the ElasticSearch storage plugin,

  • have ElasticSearch running on port 9200
  • run STORAGE=es make storage-integration-test in the top folder.

All integration tests also run on pull request via GitHub Actions. This integration test is against ElasticSearch v7.x and v8.x.

  • The script used in GitHub Actions can be found under scripts/e2e/elasticsearch.sh, and that script be run from the top folder to integration test ElasticSearch as well. This script requires Docker to be running.
Adding tests

Integration test framework for storage lie under ../integration. Add to ../integration/fixtures/traces/*.json and ../integration/fixtures/queries.json to add more trace cases.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig() config.Configuration

Types

type Factory

type Factory struct {
	Options *Options
	// contains filtered or unexported fields
}

Factory implements storage.Factory for Elasticsearch backend.

func NewArchiveFactory

func NewArchiveFactory() *Factory

func NewFactory

func NewFactory() *Factory

NewFactory creates a new Factory.

func NewFactoryWithConfig

func NewFactoryWithConfig(
	cfg config.Configuration,
	metricsFactory metrics.Factory,
	logger *zap.Logger,
) (*Factory, error)

func (*Factory) AddFlags

func (f *Factory) AddFlags(flagSet *flag.FlagSet)

AddFlags implements plugin.Configurable

func (*Factory) Close

func (f *Factory) Close() error

Close closes the resources held by the factory

func (*Factory) CreateDependencyReader

func (f *Factory) CreateDependencyReader() (dependencystore.Reader, error)

CreateDependencyReader implements storage.Factory

func (*Factory) CreateSamplingStore

func (f *Factory) CreateSamplingStore(int) (samplingstore.Store, error)

func (*Factory) CreateSpanReader

func (f *Factory) CreateSpanReader() (spanstore.Reader, error)

CreateSpanReader implements storage.Factory

func (*Factory) CreateSpanWriter

func (f *Factory) CreateSpanWriter() (spanstore.Writer, error)

CreateSpanWriter implements storage.Factory

func (*Factory) InheritSettingsFrom

func (f *Factory) InheritSettingsFrom(other storage.Factory)

func (*Factory) InitFromViper

func (f *Factory) InitFromViper(v *viper.Viper, _ *zap.Logger)

InitFromViper implements plugin.Configurable

func (*Factory) Initialize

func (f *Factory) Initialize(metricsFactory metrics.Factory, logger *zap.Logger) error

Initialize implements storage.Factory.

func (*Factory) IsArchiveCapable

func (f *Factory) IsArchiveCapable() bool

func (*Factory) Purge

func (f *Factory) Purge(ctx context.Context) error

type Options

type Options struct {
	// TODO: remove indirection
	Config namespaceConfig `mapstructure:",squash"`
}

Options contains various type of Elasticsearch configs and provides the ability to bind them to command line flag and apply overlays, so that some configurations (e.g. archive) may be underspecified and infer the rest of its parameters from primary.

func NewOptions

func NewOptions(namespace string) *Options

NewOptions creates a new Options struct.

func (*Options) AddFlags

func (opt *Options) AddFlags(flagSet *flag.FlagSet)

AddFlags adds flags for Options

func (*Options) GetConfig

func (opt *Options) GetConfig() *config.Configuration

GetPrimary returns primary configuration.

func (*Options) InitFromViper

func (opt *Options) InitFromViper(v *viper.Viper)

InitFromViper initializes Options with properties from viper

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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