internal

package
v0.0.0-...-2a2e17e Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const Usage = `` /* 158-byte string literal not displayed */

Variables

View Source
var (
	VersionAlreadySetError = errors.New("version has already been set")
)

Functions

func AlignDuration

func AlignDuration(tm time.Time, interval time.Duration) time.Duration

AlignDuration returns the duration until next aligned interval. If the current time is aligned a 0 duration is returned.

func AlignTime

func AlignTime(tm time.Time, interval time.Duration) time.Time

AlignTime returns the time of the next aligned interval. If the current time is aligned the current time is returned.

func CloseIdleConnections

func CloseIdleConnections(c *http.Client)

func CompressWithGzip

func CompressWithGzip(data io.Reader) (io.Reader, error)

CompressWithGzip takes an io.Reader as input and pipes it through a gzip.Writer returning an io.Reader containing the gzipped data. An error is returned if passing data to the gzip.Writer fails

func ExitStatus

func ExitStatus(err error) (int, bool)

Exit status takes the error from exec.Command and returns the exit status and true if error is not exit status, will return 0 and false

func ProductToken

func ProductToken() string

ProductToken returns a tag for Flow that can be used in user agents.

func RandomDuration

func RandomDuration(max time.Duration) time.Duration

RandomDuration returns a random duration between 0 and max.

func SetVersion

func SetVersion(v string) error

func SleepContext

func SleepContext(ctx context.Context, duration time.Duration) error

SleepContext sleeps until the context is closed or the duration is reached.

func Version

func Version() string

Types

type Duration

type Duration struct {
	Duration time.Duration
}

Duration just wraps time.Duration

func (*Duration) UnmarshalTOML

func (d *Duration) UnmarshalTOML(b []byte) error

UnmarshalTOML parses the duration from the TOML config file

type Field

type Field struct {
	Key   string
	Value interface{}
}

type Metric

type Metric interface {
	Name() string
	Tags() map[string]string
	TagList() []*Tag
	Fields() map[string]interface{}
	FieldList() []*Field
	Time() time.Time
	Type() ValueType

	// Name functions
	SetName(name string)
	AddPrefix(prefix string)
	AddSuffix(suffix string)

	// Tag functions
	GetTag(key string) (string, bool)
	HasTag(key string) bool
	AddTag(key, value string)
	RemoveTag(key string)

	// Copy returns a deep copy of the Metric.
	Copy() Metric

	// Accept marks the metric as processed successfully and written to an output.
	Accept()

	// Reject marks the metric as processed unsuccessfully.
	Reject()

	// Drop marks the metric as processed successfully without being written to any output.
	Drop()
}

type Number

type Number struct {
	Value float64
}

func (*Number) UnmarshalTOML

func (n *Number) UnmarshalTOML(b []byte) error

type Size

type Size struct {
	Size int64
}

Size just wraps an int64

func (*Size) UnmarshalTOML

func (s *Size) UnmarshalTOML(b []byte) error

type Tag

type Tag struct {
	Key   string
	Value string
}

type ValueType

type ValueType int
const (
	Counter ValueType
	Gauge
	Untyped
	Summary
	Histogram
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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