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() logrus.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
- func (r *Recorder) IndexName() string
- func (r *Recorder) Name() string
- func (r *Recorder) Record(ctx context.Context, job *recorder.RecordJob) error
- func (r *Recorder) SetRecordFunc(f func(ctx context.Context, typeName string, timestamp time.Time, ...) error)
- func (r *Recorder) Timeout() time.Duration
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 logrus.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 NewRecorder ¶
func NewRecorder( ctx context.Context, log logrus.FieldLogger, name, endpoint, indexName string, timeout time.Duration, backoff int, ) (*Recorder, error)
NewRecorder returns an error if it can't create the index
func (*Recorder) Record ¶ added in v0.6.0
Record returns an error if the endpoint errors. It stops receiving jobs when the endpoint's absence has exceeded the backoff value.