Documentation ¶
Overview ¶
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 ¶
- func Canonicalize(fields []Field, fieldVals []interface{}) ([]interface{}, error)
- func Hash(fieldVals []interface{}) uint64
- func Serialize(fields []Field, values []interface{}) []*pb.MetricsData_MetricField
- func SerializeDescriptor(fields []Field) []*pb.MetricsDataSet_MetricFieldDescriptor
- type Field
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Canonicalize ¶
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 Serialize ¶
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 ¶
func SerializeDescriptor(fields []Field) []*pb.MetricsDataSet_MetricFieldDescriptor
SerializeDescriptor returns a slice of field descriptors, representing just the names and types of fields.