Documentation
¶
Index ¶
- Constants
- Variables
- func AlignDuration(tm time.Time, interval time.Duration) time.Duration
- func AlignTime(tm time.Time, interval time.Duration) time.Time
- func CloseIdleConnections(c *http.Client)
- func CompressWithGzip(data io.Reader) (io.Reader, error)
- func ExitStatus(err error) (int, bool)
- func ProductToken() string
- func RandomDuration(max time.Duration) time.Duration
- func SetVersion(v string) error
- func SleepContext(ctx context.Context, duration time.Duration) error
- func Version() string
- type Duration
- type Field
- type Metric
- type Number
- type Size
- type Tag
- type ValueType
Constants ¶
const Usage = `` /* 158-byte string literal not displayed */
Variables ¶
var (
VersionAlreadySetError = errors.New("version has already been set")
)
Functions ¶
func AlignDuration ¶
AlignDuration returns the duration until next aligned interval. If the current time is aligned a 0 duration is returned.
func AlignTime ¶
AlignTime returns the time of the next aligned interval. If the current time is aligned the current time is returned.
func CloseIdleConnections ¶
func CompressWithGzip ¶
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 ¶
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 ¶
RandomDuration returns a random duration between 0 and max.
func SetVersion ¶
func SleepContext ¶
SleepContext sleeps until the context is closed or the duration is reached.
Types ¶
type Duration ¶
Duration just wraps time.Duration
func (*Duration) UnmarshalTOML ¶
UnmarshalTOML parses the duration from the TOML config file
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() }