self

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf added in v0.9.1

type Conf func(*Config) error

Conf func is used for initializing a Config object.

func WithBackoff added in v0.9.1

func WithBackoff(backoff int) Conf

WithBackoff doesn't produce any errors.

func WithEndpoint added in v0.9.1

func WithEndpoint(endpoint string) Conf

WithEndpoint produces an error if endpoint is empty.

func WithInterval added in v0.9.1

func WithInterval(interval time.Duration) Conf

WithInterval doesn't produce any errors.

func WithLogger added in v0.9.1

func WithLogger(log internal.FieldLogger) Conf

WithLogger produces an error if the log is nil.

func WithName added in v0.9.1

func WithName(name string) Conf

WithName produces an error if name is empty.

func WithTypeName added in v0.9.1

func WithTypeName(typeName string) Conf

WithTypeName produces an error if typeName is empty.

func WithViper added in v0.9.1

func WithViper(v unmarshaller, name, key string) Conf

WithViper produces an error any of the inputs are empty.

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 NewConfig added in v0.9.1

func NewConfig(conf ...Conf) (*Config, error)

NewConfig returns an instance of the expvar reader func NewConfig(log internal.FieldLogger, name, typeName string, endpoint, routepath string, interval, timeout time.Duration, backoff int, mapFile string) (*Config, error) {

func (*Config) Backoff

func (c *Config) Backoff() int

Backoff returns the backoff

func (*Config) Endpoint

func (c *Config) Endpoint() string

Endpoint returns the endpoint

func (*Config) Interval

func (c *Config) Interval() time.Duration

Interval returns the interval

func (*Config) Logger

func (c *Config) Logger() internal.FieldLogger

Logger returns the logger

func (*Config) Name

func (c *Config) Name() string

Name returns the name

func (*Config) NewInstance

func (c *Config) NewInstance() (reader.DataReader, error)

NewInstance instantiates a SelfReader

func (*Config) Timeout

func (c *Config) Timeout() time.Duration

Timeout returns the timeout

func (*Config) TypeName added in v0.2.1

func (c *Config) TypeName() string

TypeName returns the typeName

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 | ErrInvalidEndpoint
typeName == ""   | ErrEmptyTypeName
backoff < 5      | ErrLowBackoffValue

func (*Reader) Backoff added in v0.8.1

func (r *Reader) Backoff() int

Backoff returns the backoff

func (*Reader) Endpoint added in v0.8.1

func (r *Reader) Endpoint() string

Endpoint returns the endpoint

func (*Reader) Interval

func (r *Reader) Interval() time.Duration

Interval returns the interval

func (*Reader) Logger added in v0.8.1

func (r *Reader) Logger() internal.FieldLogger

Logger returns the log

func (*Reader) Mapper added in v0.3.0

func (r *Reader) Mapper() datatype.Mapper

Mapper returns the mapper object

func (*Reader) Name

func (r *Reader) Name() string

Name shows the name identifier for this reader

func (*Reader) Ping added in v0.7.0

func (r *Reader) Ping() error

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) Read added in v0.6.0

func (r *Reader) Read(job *token.Context) (*reader.Result, error)

Read send the metrics back. The error is usually nil.

func (*Reader) SetBackoff added in v0.8.1

func (r *Reader) SetBackoff(backoff int)

SetBackoff sets the backoff of the reader

func (*Reader) SetEndpoint added in v0.8.1

func (r *Reader) SetEndpoint(endpoint string)

SetEndpoint sets the endpoint of the reader

func (*Reader) SetInterval added in v0.8.1

func (r *Reader) SetInterval(interval time.Duration)

SetInterval sets the interval of the reader

func (*Reader) SetLogger added in v0.8.1

func (r *Reader) SetLogger(log internal.FieldLogger)

SetLogger sets the log of the reader

func (*Reader) SetMapper added in v0.8.1

func (r *Reader) SetMapper(mapper datatype.Mapper)

SetMapper sets the mapper of the reader

func (*Reader) SetName added in v0.8.1

func (r *Reader) SetName(name string)

SetName sets the name 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

func (r *Reader) SetTimeout(timeout time.Duration)

SetTimeout sets the timeout of the reader

func (*Reader) SetTypeName added in v0.8.1

func (r *Reader) SetTypeName(typeName string)

SetTypeName sets the type name of the reader

func (*Reader) Timeout

func (r *Reader) Timeout() time.Duration

Timeout returns the time-out

func (*Reader) TypeName added in v0.2.1

func (r *Reader) TypeName() string

TypeName shows the typeName the recorder should record as

Jump to

Keyboard shortcuts

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