util

package
v14.2.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// the order in which these appear determines the
	// order of the fields in the resultant TSV
	TsvName tsvField = iota
	TsvTags
	TsvMetricType

	// The hostName of the server flushing the data
	TsvVeneurHostname

	TsvInterval

	TsvTimestamp
	TsvValue

	// This is the _partition field
	// required by the Redshift IncrementalLoader.
	// For our purposes, the current date is a good partition.
	TsvPartition
)
View Source
const PartitionDateFormat = "20060102"
View Source
const Redacted = "REDACTED"
View Source
const RedshiftDateFormat = "2006-01-02 03:04:05"

Variables

View Source
var PrintSecrets = flag.Bool(
	"print-secrets", false, "Disables redacting config secrets")

Functions

func DecodeConfig

func DecodeConfig(name string, input interface{}, output interface{}) error

DecodeConfig wraps the mapstructure decoder to unpack a map into a struct and the envconfig decoder to read environment variables.

This method provides logic to handle decoding into structs that implement the stringUnmarshaler interface and is intended to be used by sources and sinks while unpacking the configuration specific to that source or sink from within the entire config.

func EncodeInterMetricCSV

func EncodeInterMetricCSV(
	d samplers.InterMetric, w *csv.Writer, partitionDate *time.Time,
	hostName string, interval int,
) error

EncodeInterMetricCSV generates a newline-terminated CSV row that describes the data represented by the InterMetric. The caller is responsible for setting w.Comma as the appropriate delimiter. For performance, encodeCSV does not flush after every call; the caller is expected to flush at the end of the operation cycle

func EncodeInterMetricsCSV

func EncodeInterMetricsCSV(
	metrics []samplers.InterMetric, delimiter rune, includeHeaders bool,
	hostname string, interval int,
) (io.ReadSeeker, error)

EncodeInterMetricsCSV returns a reader containing the gzipped CSV representation of the InterMetric data, one row per InterMetric. the AWS sdk requires seekable input, so we return a ReadSeeker here

Types

type Regexp

type Regexp struct {
	Value *regexp.Regexp
}

func (*Regexp) Decode

func (r *Regexp) Decode(value string) error

func (Regexp) MarshalJSON

func (r Regexp) MarshalJSON() ([]byte, error)

func (Regexp) MarshalYAML

func (r Regexp) MarshalYAML() (interface{}, error)

func (*Regexp) UnmarshalYAML

func (r *Regexp) UnmarshalYAML(unmarshal func(interface{}) error) error

type Rune

type Rune rune

func (*Rune) UnmarshalText

func (r *Rune) UnmarshalText(text []byte) error

func (*Rune) UnmarshalYAML

func (r *Rune) UnmarshalYAML(unmarshal func(interface{}) error) error

type StringSecret

type StringSecret struct {
	Value string
}

func (*StringSecret) Decode

func (s *StringSecret) Decode(value string) error

implement Decode so that envconfig can read in StringSecrets

func (StringSecret) MarshalJSON

func (s StringSecret) MarshalJSON() ([]byte, error)

func (StringSecret) MarshalYAML

func (s StringSecret) MarshalYAML() (interface{}, error)

func (StringSecret) String

func (s StringSecret) String() string

func (*StringSecret) UnmarshalYAML

func (s *StringSecret) UnmarshalYAML(unmarshal func(interface{}) error) error

type Url

type Url struct {
	Value *url.URL
}

func (*Url) Decode

func (u *Url) Decode(s string) error

func (Url) MarshalJSON

func (u Url) MarshalJSON() ([]byte, error)

func (Url) MarshalYAML

func (u Url) MarshalYAML() (interface{}, error)

func (*Url) UnmarshalYAML

func (u *Url) UnmarshalYAML(unmarshal func(interface{}) error) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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