config

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	// RegisterReloadCallback takes a name and a function that will be called
	// when the configuration is reloaded. This will happen infrequently. If
	// consumers of configuration set config values on startup, they should
	// check their values haven't changed and re-start anything that needs
	// restarting with the new values.
	RegisterReloadCallback(callback func())

	// GetListenAddr returns the address and port on which to listen for
	// incoming events
	GetListenAddr() (string, error)

	// GetPeerListenAddr returns the address and port on which to listen for
	// peer traffic
	GetPeerListenAddr() (string, error)

	// GetAPIKeys returns a list of Honeycomb API keys
	GetAPIKeys() ([]string, error)

	// GetPeers returns a list of other servers participating in this proxy cluster
	GetPeers() ([]string, error)

	GetPeerManagementType() (string, error)

	// GetRedisHost returns the address of a Redis instance to use for peer
	// management.
	GetRedisHost() (string, error)

	// GetHoneycombAPI returns the base URL (protocol, hostname, and port) of
	// the upstream Honeycomb API server
	GetHoneycombAPI() (string, error)

	// GetLoggingLevel returns the verbosity with which we should log
	GetLoggingLevel() (string, error)

	// GetSendDelay returns the number of seconds to pause after a trace is
	// complete before sending it, to allow stragglers to arrive
	GetSendDelay() (time.Duration, error)

	// GetTraceTimeout is how long to wait before sending a trace even if it's
	// not complete. This should be longer than the longest expected trace
	// duration.
	GetTraceTimeout() (time.Duration, error)

	// GetOtherConfig attempts to fill the passed in struct with the contents of
	// a subsection of the config.   This is used by optional configurations to
	// allow different implementations of necessary interfaces configure
	// themselves
	GetOtherConfig(name string, configStruct interface{}) error

	// GetLoggerType returns the type of the logger to use. Valid types are in
	// the logger package
	GetLoggerType() (string, error)

	// GetHoneycombLoggerConfig returns the config specific to the HoneycombLogger
	GetHoneycombLoggerConfig() (HoneycombLoggerConfig, error)

	// GetCollectorType returns the type of the collector to use. Valid types
	// are in the collect package
	GetCollectorType() (string, error)

	// GetInMemCollectorCacheCapacity returns the config specific to the InMemCollector
	GetInMemCollectorCacheCapacity() (InMemoryCollectorCacheCapacity, error)

	// GetSamplerConfigForDataset returns the sampler type to use for the given dataset
	GetSamplerConfigForDataset(string) (interface{}, error)

	// GetMetricsType returns the type of metrics to use. Valid types are in the
	// metrics package
	GetMetricsType() (string, error)

	// GetHoneycombMetricsConfig returns the config specific to HoneycombMetrics
	GetHoneycombMetricsConfig() (HoneycombMetricsConfig, error)

	// GetPrometheusMetricsConfig returns the config specific to PrometheusMetrics
	GetPrometheusMetricsConfig() (PrometheusMetricsConfig, error)

	// GetUpstreamBufferSize returns the size of the libhoney buffer to use for the upstream
	// libhoney client
	GetUpstreamBufferSize() int
	// GetPeerBufferSize returns the size of the libhoney buffer to use for the peer forwarding
	// libhoney client
	GetPeerBufferSize() int

	GetIdentifierInterfaceName() (string, error)

	GetUseIPV6Identifier() (bool, error)

	GetRedisIdentifier() (string, error)

	// GetSendTickerValue returns the duration to use to check for traces to send
	GetSendTickerValue() time.Duration

	// GetDebugServiceAddr sets the IP and port the debug service will run on (you must provide the
	// command line flag -d to start the debug service)
	GetDebugServiceAddr() (string, error)

	GetIsDryRun() bool

	GetDryRunFieldName() string
}

func NewConfig

func NewConfig(config, rules string, errorCallback func(error)) (Config, error)

NewConfig creates a new config struct

type DeterministicSamplerConfig

type DeterministicSamplerConfig struct {
	SampleRate int `validate:"required,gte=1"`
}

type DynamicSamplerConfig

type DynamicSamplerConfig struct {
	SampleRate                   int64 `validate:"required,gte=1"`
	ClearFrequencySec            int64
	FieldList                    []string `validate:"required"`
	UseTraceLength               bool
	AddSampleRateKeyToTrace      bool
	AddSampleRateKeyToTraceField string
}

type EMADynamicSamplerConfig

type EMADynamicSamplerConfig struct {
	GoalSampleRate      int `validate:"gte=1"`
	AdjustmentInterval  int
	Weight              float64 `validate:"gt=0,lt=1"`
	AgeOutValue         float64
	BurstMultiple       float64
	BurstDetectionDelay uint
	MaxKeys             int

	FieldList                    []string `validate:"required"`
	UseTraceLength               bool
	AddSampleRateKeyToTrace      bool
	AddSampleRateKeyToTraceField string
}

type HoneycombLevel

type HoneycombLevel int

type HoneycombLoggerConfig

type HoneycombLoggerConfig struct {
	LoggerHoneycombAPI string `validate:"required,url"`
	LoggerAPIKey       string `validate:"required"`
	LoggerDataset      string `validate:"required"`
	Level              HoneycombLevel
}

type HoneycombMetricsConfig

type HoneycombMetricsConfig struct {
	MetricsHoneycombAPI      string `validate:"required,url"`
	MetricsAPIKey            string `validate:"required"`
	MetricsDataset           string `validate:"required"`
	MetricsReportingInterval int64  `validate:"required"`
}

type InMemoryCollectorCacheCapacity

type InMemoryCollectorCacheCapacity struct {
	// CacheCapacity must be less than math.MaxInt32
	CacheCapacity int `validate:"required,lt=2147483647"`
	MaxAlloc      uint64
}

type MockConfig

type MockConfig struct {
	Callbacks                            []func()
	GetAPIKeysErr                        error
	GetAPIKeysVal                        []string
	GetCollectorTypeErr                  error
	GetCollectorTypeVal                  string
	GetInMemoryCollectorCacheCapacityErr error
	GetInMemoryCollectorCacheCapacityVal InMemoryCollectorCacheCapacity
	GetHoneycombAPIErr                   error
	GetHoneycombAPIVal                   string
	GetListenAddrErr                     error
	GetListenAddrVal                     string
	GetPeerListenAddrErr                 error
	GetPeerListenAddrVal                 string
	GetLoggerTypeErr                     error
	GetLoggerTypeVal                     string
	GetHoneycombLoggerConfigErr          error
	GetHoneycombLoggerConfigVal          HoneycombLoggerConfig
	GetLoggingLevelErr                   error
	GetLoggingLevelVal                   string
	GetOtherConfigErr                    error
	// GetOtherConfigVal must be a JSON representation of the config struct to be populated.
	GetOtherConfigVal             string
	GetPeersErr                   error
	GetPeersVal                   []string
	GetRedisHostErr               error
	GetRedisHostVal               string
	GetSamplerTypeErr             error
	GetSamplerTypeVal             interface{}
	GetMetricsTypeErr             error
	GetMetricsTypeVal             string
	GetHoneycombMetricsConfigErr  error
	GetHoneycombMetricsConfigVal  HoneycombMetricsConfig
	GetPrometheusMetricsConfigErr error
	GetPrometheusMetricsConfigVal PrometheusMetricsConfig
	GetSendDelayErr               error
	GetSendDelayVal               time.Duration
	GetTraceTimeoutErr            error
	GetTraceTimeoutVal            time.Duration
	GetUpstreamBufferSizeVal      int
	GetPeerBufferSizeVal          int
	SendTickerVal                 time.Duration
	IdentifierInterfaceName       string
	UseIPV6Identifier             bool
	RedisIdentifier               string
	PeerManagementType            string
	DebugServiceAddr              string
	DryRun                        bool
	DryRunFieldName               string

	Mux sync.RWMutex
}

MockConfig will respond with whatever config it's set to do during initialization

func (*MockConfig) GetAPIKeys

func (m *MockConfig) GetAPIKeys() ([]string, error)

func (*MockConfig) GetCollectorType

func (m *MockConfig) GetCollectorType() (string, error)

func (*MockConfig) GetDebugServiceAddr

func (m *MockConfig) GetDebugServiceAddr() (string, error)

func (*MockConfig) GetDryRunFieldName

func (m *MockConfig) GetDryRunFieldName() string

func (*MockConfig) GetHoneycombAPI

func (m *MockConfig) GetHoneycombAPI() (string, error)

func (*MockConfig) GetHoneycombLoggerConfig

func (m *MockConfig) GetHoneycombLoggerConfig() (HoneycombLoggerConfig, error)

func (*MockConfig) GetHoneycombMetricsConfig

func (m *MockConfig) GetHoneycombMetricsConfig() (HoneycombMetricsConfig, error)

func (*MockConfig) GetIdentifierInterfaceName

func (m *MockConfig) GetIdentifierInterfaceName() (string, error)

func (*MockConfig) GetInMemCollectorCacheCapacity

func (m *MockConfig) GetInMemCollectorCacheCapacity() (InMemoryCollectorCacheCapacity, error)

func (*MockConfig) GetIsDryRun

func (m *MockConfig) GetIsDryRun() bool

func (*MockConfig) GetListenAddr

func (m *MockConfig) GetListenAddr() (string, error)

func (*MockConfig) GetLoggerType

func (m *MockConfig) GetLoggerType() (string, error)

func (*MockConfig) GetLoggingLevel

func (m *MockConfig) GetLoggingLevel() (string, error)

func (*MockConfig) GetMetricsType

func (m *MockConfig) GetMetricsType() (string, error)

func (*MockConfig) GetOtherConfig

func (m *MockConfig) GetOtherConfig(name string, iface interface{}) error

func (*MockConfig) GetPeerBufferSize

func (m *MockConfig) GetPeerBufferSize() int

func (*MockConfig) GetPeerListenAddr

func (m *MockConfig) GetPeerListenAddr() (string, error)

func (*MockConfig) GetPeerManagementType

func (m *MockConfig) GetPeerManagementType() (string, error)

func (*MockConfig) GetPeers

func (m *MockConfig) GetPeers() ([]string, error)

func (*MockConfig) GetPrometheusMetricsConfig

func (m *MockConfig) GetPrometheusMetricsConfig() (PrometheusMetricsConfig, error)

func (*MockConfig) GetRedisHost

func (m *MockConfig) GetRedisHost() (string, error)

func (*MockConfig) GetRedisIdentifier

func (m *MockConfig) GetRedisIdentifier() (string, error)

func (*MockConfig) GetSamplerConfigForDataset

func (m *MockConfig) GetSamplerConfigForDataset(dataset string) (interface{}, error)

TODO: allow per-dataset mock values

func (*MockConfig) GetSendDelay

func (m *MockConfig) GetSendDelay() (time.Duration, error)

func (*MockConfig) GetSendTickerValue

func (m *MockConfig) GetSendTickerValue() time.Duration

func (*MockConfig) GetTraceTimeout

func (m *MockConfig) GetTraceTimeout() (time.Duration, error)

func (*MockConfig) GetUpstreamBufferSize

func (m *MockConfig) GetUpstreamBufferSize() int

func (*MockConfig) GetUseIPV6Identifier

func (m *MockConfig) GetUseIPV6Identifier() (bool, error)

func (*MockConfig) RegisterReloadCallback

func (m *MockConfig) RegisterReloadCallback(callback func())

func (*MockConfig) ReloadConfig

func (m *MockConfig) ReloadConfig()

type PeerManagementConfig

type PeerManagementConfig struct {
	Type                    string   `validate:"required,oneof= file redis"`
	Peers                   []string `validate:"dive,url"`
	RedisHost               string
	IdentifierInterfaceName string
	UseIPV6Identifier       bool
	RedisIdentifier         string
}

type PrometheusMetricsConfig

type PrometheusMetricsConfig struct {
	MetricsListenAddr string `validate:"required"`
}

type RulesBasedSamplerCondition

type RulesBasedSamplerCondition struct {
	Field    string
	Operator string
	Value    interface{}
}

func (*RulesBasedSamplerCondition) String

func (r *RulesBasedSamplerCondition) String() string

type RulesBasedSamplerConfig

type RulesBasedSamplerConfig struct {
	Rule []*RulesBasedSamplerRule
}

func (*RulesBasedSamplerConfig) String

func (r *RulesBasedSamplerConfig) String() string

type RulesBasedSamplerRule

type RulesBasedSamplerRule struct {
	Name       string
	SampleRate int
	Drop       bool
	Condition  []*RulesBasedSamplerCondition
}

func (*RulesBasedSamplerRule) String

func (r *RulesBasedSamplerRule) String() string

type TotalThroughputSamplerConfig added in v0.13.0

type TotalThroughputSamplerConfig struct {
	GoalThroughputPerSec         int64 `validate:"gte=1"`
	ClearFrequencySec            int64
	FieldList                    []string `validate:"required"`
	UseTraceLength               bool
	AddSampleRateKeyToTrace      bool
	AddSampleRateKeyToTraceField string
}

Jump to

Keyboard shortcuts

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