Back to

Package storage

Latest Go to latest

The highest tagged major version is .

Published: Nov 7, 2019 | License: Apache-2.0 | Module:



const (
	// SpanStorageTypeEnvVar is the name of the env var that defines the type of backend used for span storage.
	SpanStorageTypeEnvVar = "SPAN_STORAGE_TYPE"

	// DependencyStorageTypeEnvVar is the name of the env var that defines the type of backend used for dependencies storage.
	DependencyStorageTypeEnvVar = "DEPENDENCY_STORAGE_TYPE"


var AllStorageTypes = []string{cassandraStorageType, elasticsearchStorageType, memoryStorageType, kafkaStorageType, badgerStorageType, grpcPluginStorageType}

AllStorageTypes defines all available storage backends

type Factory

type Factory struct {
	// contains filtered or unexported fields

Factory implements storage.Factory interface as a meta-factory for storage components.

func NewFactory

func NewFactory(config FactoryConfig) (*Factory, error)

NewFactory creates the meta-factory.

func (*Factory) AddFlags

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

AddFlags implements plugin.Configurable

func (*Factory) CreateArchiveSpanReader

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

CreateArchiveSpanReader implements storage.ArchiveFactory

func (*Factory) CreateArchiveSpanWriter

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

CreateArchiveSpanWriter implements storage.ArchiveFactory

func (*Factory) CreateDependencyReader

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

CreateDependencyReader implements storage.Factory

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) InitFromViper

func (f *Factory) InitFromViper(v *viper.Viper)

InitFromViper implements plugin.Configurable

func (*Factory) Initialize

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

Initialize implements storage.Factory.

type FactoryConfig

type FactoryConfig struct {
	SpanWriterTypes         []string
	SpanReaderType          string
	DependenciesStorageType string
	DownsamplingRatio       float64
	DownsamplingHashSalt    string

FactoryConfig tells the Factory which types of backends it needs to create for different storage types.

func FactoryConfigFromEnvAndCLI

func FactoryConfigFromEnvAndCLI(args []string, log io.Writer) FactoryConfig

FactoryConfigFromEnvAndCLI reads the desired types of storage backends from SPAN_STORAGE_TYPE and DEPENDENCY_STORAGE_TYPE environment variables. Allowed values:

* `cassandra` - built-in
* `elasticsearch` - built-in
* `memory` - built-in
* `kafka` - built-in
* `plugin` - loads a dynamic plugin that implements storage.Factory interface (not supported at the moment)

For backwards compatibility it also parses the args looking for deprecated --span-storage.type flag. If found, it writes a deprecation warning to the log.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier