Documentation
¶
Overview ¶
Package expvar contains logic to read from an expvar provide. The data comes in JSON format. The GC and memory related information will be changed to better presented to the data recorders. Bytes will be turned into megabytes, gc lists will be truncated to remove zero values.
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, jobChan chan 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) JobChan() chan context.Context
- func (r *Reader) Mapper() datatype.Mapper
- func (r *Reader) Name() string
- func (r *Reader) ResultChan() chan *reader.ReadJobResult
- func (r *Reader) Start(ctx context.Context, stop communication.StopChannel)
- 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 { EXPTypeName string `mapstructure:"type_name"` EXPEndpoint string `mapstructure:"endpoint"` EXPRoutePath string `mapstructure:"routepath"` EXPInterval string `mapstructure:"interval"` EXPTimeout string `mapstructure:"timeout"` EXPBackoff int `mapstructure:"backoff"` MapFile string `mapstructure:"map_file"` // contains filtered or unexported fields }
Config holds the necessary configuration for setting up an expvar reader endpoint. If MapFile is provided, the data will be mapped, otherwise it uses the defaults.
func FromViper ¶
FromViper constructs the necessary configuration for bootstrapping the expvar reader
func NewConfig ¶
func NewConfig( log logrus.FieldLogger, name, typeName string, endpoint, routepath string, interval, timeout time.Duration, backoff int, mapFile string, ) (*Config, error)
NewConfig returns an instance of the expvar reader
func (*Config) NewInstance ¶
func (c *Config) NewInstance( ctx context.Context, jobChan chan context.Context, resultChan chan *reader.ReadJobResult, errorChan chan<- communication.ErrorMessage, ) (reader.DataReader, error)
NewInstance returns an instance of the expvar reader
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader contains communication channels with a worker that exposes expvar information. It implements DataReader interface.
func NewExpvarReader ¶
func NewExpvarReader( log logrus.FieldLogger, endpoint string, mapper datatype.Mapper, jobChan chan context.Context, resultChan chan *reader.ReadJobResult, errorChan chan<- communication.ErrorMessage, name string, typeName string, interval time.Duration, timeout time.Duration, ) (*Reader, error)
NewExpvarReader creates the worker and sets up its channels. Because the caller is reading the resp.Body, it is its job to close it.
func (*Reader) ResultChan ¶
func (r *Reader) ResultChan() chan *reader.ReadJobResult
ResultChan returns the result channel.
func (*Reader) Start ¶
func (r *Reader) Start(ctx context.Context, stop communication.StopChannel)
Start begins reading from the target in its own goroutine. It will issue a goroutine on each job request. It will close the done channel when the job channel is closed.