transformation

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryTransform

type BinaryTransform func(prev, curr Datapoint) Datapoint

BinaryTransform is a binary transformation that takes the previous and the current datapoint as input and produces a single datapoint as the transformation result.

type Datapoint

type Datapoint struct {
	TimeNanos int64
	Value     float64
}

Datapoint is a metric data point containing a timestamp in Unix nanoseconds since epoch and a value.

func (Datapoint) IsEmpty

func (dp Datapoint) IsEmpty() bool

IsEmpty returns whether this is an empty datapoint.

type Type

type Type int

Type defines a transformation function.

const (
	UnknownType Type = iota
	Absolute
	PerSecond
)

Supported transformation types.

func ParseType

func ParseType(str string) (Type, error)

ParseType parses a transformation type.

func (Type) BinaryTransform

func (t Type) BinaryTransform() (BinaryTransform, error)

BinaryTransform returns the binary transformation function associated with the transformation type if applicable, or an error otherwise.

func (*Type) FromProto

func (t *Type) FromProto(pb transformationpb.TransformationType) error

FromProto converts the protobuf message to a transformation type in place.

func (Type) IsBinaryTransform

func (t Type) IsBinaryTransform() bool

IsBinaryTransform returns whether this is a binary transformation.

func (Type) IsUnaryTransform

func (t Type) IsUnaryTransform() bool

IsUnaryTransform returns whether this is a unary transformation.

func (Type) IsValid

func (t Type) IsValid() bool

IsValid checks if the transformation type is valid.

func (Type) MarshalJSON

func (t Type) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of a transformation type.

func (Type) MustBinaryTransform

func (t Type) MustBinaryTransform() BinaryTransform

MustBinaryTransform returns the binary transformation function associated with the transformation type if applicable, or an error otherwise.

func (Type) MustUnaryTransform

func (t Type) MustUnaryTransform() UnaryTransform

MustUnaryTransform returns the unary transformation function associated with the transformation type if applicable, or panics otherwise.

func (Type) String

func (i Type) String() string

func (Type) ToProto

ToProto converts the transformation type to a protobuf message in place.

func (Type) UnaryTransform

func (t Type) UnaryTransform() (UnaryTransform, error)

UnaryTransform returns the unary transformation function associated with the transformation type if applicable, or an error otherwise.

func (*Type) UnmarshalJSON

func (t *Type) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals JSON-encoded data into a transformation type.

func (*Type) UnmarshalYAML

func (t *Type) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals YAML-encoded data into a transformation type.

type UnaryTransform

type UnaryTransform func(dp Datapoint) Datapoint

UnaryTransform is a unary transformation that takes a single datapoint as input and transforms it into a datapoint as output.

Jump to

Keyboard shortcuts

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