expvar

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

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

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

func FromViper(v *viper.Viper, log logrus.FieldLogger, name, key string) (*Config, error)

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) Backoff

func (c *Config) Backoff() int

Backoff returns backoff

func (*Config) Endpoint

func (c *Config) Endpoint() string

Endpoint returns endpoint

func (*Config) Interval

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

Interval returns interval

func (*Config) Logger

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

Logger returns logger

func (*Config) Name

func (c *Config) Name() string

Name returns name

func (*Config) NewInstance

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

NewInstance returns an instance of the expvar reader

func (*Config) RoutePath

func (c *Config) RoutePath() string

RoutePath returns routepath

func (*Config) Timeout

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

Timeout returns timeout

func (*Config) TypeName added in v0.2.1

func (c *Config) TypeName() string

TypeName returns type name

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,
	name string,
	typeName string,
	interval time.Duration,
	timeout time.Duration,
	backoff int,
) (*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) Interval added in v0.1.1

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

Interval returns the interval

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

func (r *Reader) Read(job context.Context) (*reader.ReadJobResult, error)

Read begins reading from the target. It sends an error back to the engine if it can't read from metrics provider

func (*Reader) Timeout added in v0.1.1

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