expvar

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2016 License: Apache-2.0 Imports: 10 Imported by: 2

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 megabyets, 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 {
	TypeName_  string `mapstructure:"type_name"`
	Endpoint_  string `mapstructure:"endpoint"`
	RoutePath_ string `mapstructure:"routepath"`
	Interval_  string `mapstructure:"interval"`
	Timeout_   string `mapstructure:"timeout"`
	Backoff_   int    `mapstructure:"backoff"`
	// contains filtered or unexported fields
}

Config holds the necessary configuration for setting up an expvar reader endpoint.

func FromViper

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

FromViper constructs the necessary configuration for bootstrapping the expvar reader

func NewConfig

func NewConfig(name, typeName string, log logrus.FieldLogger, endpoint, routepath string, interval, timeout time.Duration, backoff int) (*Config, error)

func (*Config) Backoff

func (c *Config) Backoff() int

func (*Config) Endpoint

func (c *Config) Endpoint() string

func (*Config) Interval

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

func (*Config) Logger

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

func (*Config) Name

func (c *Config) Name() string

func (*Config) NewInstance

func (c *Config) NewInstance(ctx context.Context, jobChan chan context.Context, resultChan chan *reader.ReadJobResult) (reader.DataReader, error)

func (*Config) RoutePath

func (c *Config) RoutePath() string

func (*Config) Timeout

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

func (*Config) TypeName added in v0.2.1

func (c *Config) TypeName() string

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(logger logrus.FieldLogger, ctxReader reader.ContextReader, jobChan chan context.Context, resultChan chan *reader.ReadJobResult, name, typeName string, interval, 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) Interval added in v0.1.1

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

Interval returns the interval

func (*Reader) JobChan

func (r *Reader) JobChan() chan context.Context

JobChan returns the job channel.

func (*Reader) Name

func (r *Reader) Name() string

Name shows the name identifier for this reader

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) <-chan struct{}

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.

func (*Reader) Timeout added in v0.1.1

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

Timeout returns the timeout

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