luci: go.chromium.org/luci/common/tsmon/field Index | Files

package field

import "go.chromium.org/luci/common/tsmon/field"

Package field contains constructors for metric field definitions.

When you create a metric you must specify the names and types of the fields that can appear on that metric. When you increment the metric's value you must then pass values for all the fields you defined earlier.

Index

Package Files

doc.go field.go serialize.go utils.go

func Canonicalize Uses

func Canonicalize(fields []Field, fieldVals []interface{}) ([]interface{}, error)

Canonicalize returns a copy of fieldVals converted to the canonical types for the metric's fields (string, int64, or bool). Canonicalize returns an error if fieldVals is the wrong length or contains value of the wrong type.

func Hash Uses

func Hash(fieldVals []interface{}) uint64

Hash returns a uint64 hash of fieldVals.

func Serialize Uses

func Serialize(fields []Field, values []interface{}) []*pb.MetricsData_MetricField

Serialize returns a slice of ts_mon_proto.MetricsData.MetricsField messages representing the field names and values.

func SerializeDescriptor Uses

func SerializeDescriptor(fields []Field) []*pb.MetricsDataSet_MetricFieldDescriptor

SerializeDescriptor returns a slice of field descriptors, representing just the names and types of fields.

type Field Uses

type Field struct {
    Name string
    Type Type
}

Field is the definition of a metric field. It has a name and a type (string, int or bool).

func Bool Uses

func Bool(name string) Field

Bool returns a new bool-typed field.

func Int Uses

func Int(name string) Field

Int returns a new int-typed field. Internally values for these fields are stored as int64s.

func String Uses

func String(name string) Field

String returns a new string-typed field.

func (Field) String Uses

func (f Field) String() string

type Type Uses

type Type int
const (
    StringType Type = iota + 1
    IntType
    BoolType
)

func (Type) String Uses

func (t Type) String() string

Package field imports 4 packages (graph) and is imported by 47 packages. Updated 2018-10-24. Refresh now. Tools for package owners.