Documentation
¶
Overview ¶
Package self contains codes for recording expvastic's own metrics.
Collected metrics ¶
This list will grow in time:
ElasticSearch Var Name | expvastic var name ---------------------------------------------- Readers | expReaders Read Jobs | readJobs Record Jobs | recordJobs Records Distributed | recordsDistributed DataType Objects | datatypeObjs DataType Objects Errors | datatypeErrs Unidentified JSON Count | unidentifiedJSON StringType Count | stringTypeCount FloatType Count | floatTypeCount GCListType Count | gcListTypeCount ByteType Count | byteTypeCount Expvar Reads | expvarReads ElasticSearch Records | elasticsearchRecords
Index ¶
- type Config
- func (c *Config) Backoff() int
- func (c *Config) Endpoint() string
- func (c *Config) Interval() time.Duration
- func (c *Config) Logger() logrus.FieldLogger
- func (c *Config) Name() string
- func (c *Config) NewInstance(ctx context.Context) (reader.DataReader, error)
- func (c *Config) RoutePath() string
- func (c *Config) Timeout() time.Duration
- func (c *Config) TypeName() string
- type Reader
- func (r *Reader) Interval() time.Duration
- func (r *Reader) Mapper() datatype.Mapper
- func (r *Reader) Name() string
- func (r *Reader) Ping() error
- func (r *Reader) Read(job *token.Context) (*reader.Result, error)
- func (r *Reader) SetTestMode()
- func (r *Reader) Timeout() time.Duration
- func (r *Reader) TypeName() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { SelfTypeName string `mapstructure:"type_name"` SelfInterval string `mapstructure:"interval"` SelfBackoff int `mapstructure:"backoff"` SelfEndpoint string // this is for testing purposes and you are not supposed to set it // contains filtered or unexported fields }
Config holds the necessary configuration for setting up an self reading facility.
func FromViper ¶
FromViper constructs the necessary configuration for bootstrapping the expvar reader
func (*Config) NewInstance ¶
NewInstance instantiates a SelfReader
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reads from expvastic own application's metric information. It implements DataReader interface.
func New ¶ added in v0.7.0
func New(log logrus.FieldLogger, endpoint string, mapper datatype.Mapper, name, typeName string, interval time.Duration, timeout time.Duration, backoff int) (*Reader, error)
New exposes expvastic's own metrics. It returns and error on the following occasions:
Condition | Error -----------------|------------- name == "" | ErrEmptyName endpoint == "" | ErrEmptyEndpoint Invalid Endpoint | ErrInvalidEndpoint typeName == "" | ErrEmptyTypeName backoff < 5 | ErrLowBackoffValue
func (*Reader) Ping ¶ added in v0.7.0
Ping pings the endpoint and return nil if was successful. It returns an error if the endpoint is not available.
func (*Reader) SetTestMode ¶ added in v0.7.0
func (r *Reader) SetTestMode()
SetTestMode sets the mode to testing for testing purposes This is because the way self works