Documentation
¶
Overview ¶
Package elasticsearch contains logic to record data to an elasticsearch index. The data is already sanitised by the data provider.
Index ¶
- type Config
- func (c *Config) Backoff() int
- func (c *Config) Endpoint() string
- func (c *Config) IndexName() string
- func (c *Config) Logger() internal.FieldLogger
- func (c *Config) Name() string
- func (c *Config) NewInstance(ctx context.Context) (recorder.DataRecorder, error)
- func (c *Config) RoutePath() string
- func (c *Config) Timeout() time.Duration
- type Recorder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ESEndpoint string `mapstructure:"endpoint"` ESTimeout string `mapstructure:"timeout"` ESBackoff int `mapstructure:"backoff"` ESIndexName string `mapstructure:"index_name"` // contains filtered or unexported fields }
Config holds the necessary configuration for setting up an elasticsearch reader endpoint.
func FromViper ¶
FromViper constructs the necessary configuration for bootstrapping the elasticsearch reader
func NewConfig ¶
func NewConfig(log internal.FieldLogger, name string, endpoint string, timeout time.Duration, backoff int, indexName string) (*Config, error)
NewConfig returns errors coming from Viper
func (*Config) NewInstance ¶
NewInstance returns an instance of the elasticsearch recorder
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder contains an elasticsearch client and an index name for recording data It implements DataRecorder interface
func New ¶ added in v0.7.0
func New(ctx context.Context, log internal.FieldLogger, name, endpoint, indexName string, timeout time.Duration, backoff int) (*Recorder, error)
New returns an error if it can't create the index It returns and error on the following occasions:
Condition | Error ---------------------|------------- Invalid endpoint | ErrInvalidEndpoint backoff < 5 | ErrLowBackoffValue Empty name | ErrEmptyName Invalid IndexName | ErrInvalidIndexName Empty IndexName | ErrEmptyIndexName
func (*Recorder) Ping ¶ added in v0.7.0
Ping should ping the endpoint and report if was successful. It returns and error on the following occasions:
Condition | Error ---------------------|------------- Unavailable endpoint | ErrEndpointNotAvailable Ping errors | Timeout/Ping failed Index creation | elasticsearch's errors