transformation

package
v0.0.0-...-9649366 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

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) MarshalText

func (t Type) MarshalText() (text []byte, err error)

MarshalText serializes this type to its textual representation.

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) UnmarshalText

func (t *Type) UnmarshalText(text []byte) error

UnmarshalText extracts this type from the textual representation

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