Documentation ¶
Overview ¶
Package self contains codes for recording expipe's own metrics.
Collected metrics ¶
This list will grow in time:
+-------------------------+----------------------+ | ElasticSearch Var Name | Expipe var name | +-------------------------+----------------------+ | Readers | expReaders | | Read Jobs | readJobs | | Record Jobs | recordJobs | | 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 ¶
- func WithTempServer() func(reader.Constructor) error
- type Conf
- type Config
- func (c *Config) Backoff() int
- func (c *Config) Endpoint() string
- func (c *Config) Interval() time.Duration
- func (c *Config) Logger() tools.FieldLogger
- func (c *Config) Name() string
- func (c *Config) Reader() (reader.DataReader, error)
- func (c *Config) Timeout() time.Duration
- func (c *Config) TypeName() string
- type Reader
- func (r *Reader) Backoff() int
- func (r *Reader) Endpoint() string
- 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) SetBackoff(backoff int)
- func (r *Reader) SetEndpoint(endpoint string)
- func (r *Reader) SetInterval(interval time.Duration)
- func (r *Reader) SetLogger(log tools.FieldLogger)
- func (r *Reader) SetMapper(mapper datatype.Mapper)
- func (r *Reader) SetName(name string)
- func (r *Reader) SetTestMode()
- func (r *Reader) SetTimeout(timeout time.Duration)
- func (r *Reader) SetTypeName(typeName string)
- func (r *Reader) Timeout() time.Duration
- func (r *Reader) TypeName() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithTempServer ¶ added in v0.11.0
func WithTempServer() func(reader.Constructor) error
WithTempServer creates a temp server that does nothing and attach it to the reader to response to Engine pings.
Types ¶
type Conf ¶ added in v0.9.1
Conf func is used for initializing a Config object.
func WithLogger ¶ added in v0.9.1
func WithLogger(log tools.FieldLogger) Conf
WithLogger produces an error if the log is nil.
type Config ¶
type Config struct { SelfName string 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 Cinterval time.Duration // contains filtered or unexported fields }
Config holds the necessary configuration for setting up an self reading facility, which is the way to record the app's metrics.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reads from expipe own application's metric information. It implements DataReader interface.
func New ¶ added in v0.7.0
func New(options ...func(reader.Constructor) error) (*Reader, error)
New exposes expipe's own metrics. It returns and error on the following occasions:
+------------------+----------------------+ | Condition | Error | +------------------+----------------------+ | name == "" | ErrEmptyName | | endpoint == "" | ErrEmptyEndpoint | | Invalid Endpoint | InvalidEndpointError | | typeName == "" | ErrEmptyTypeName | | backoff < 5 | LowBackoffValueError | +------------------+----------------------+
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. TODO: this method is duplicated. Create a Pinger type and share the logic.
func (*Reader) SetBackoff ¶ added in v0.8.1
SetBackoff sets the backoff of the reader
func (*Reader) SetEndpoint ¶ added in v0.8.1
SetEndpoint sets the endpoint of the reader
func (*Reader) SetInterval ¶ added in v0.8.1
SetInterval sets the interval of the reader
func (*Reader) SetLogger ¶ added in v0.8.1
func (r *Reader) SetLogger(log tools.FieldLogger)
SetLogger sets the log of the reader
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
func (*Reader) SetTimeout ¶ added in v0.8.1
SetTimeout sets the timeout of the reader
func (*Reader) SetTypeName ¶ added in v0.8.1
SetTypeName sets the type name of the reader