Package mmvdump
Overview ▹
Index ▹
Constants
const (
// NameMax is the maximum allowed length of a name
NameMax = 64
// StringMax is the maximum allowed length of a string
StringMax = 256
// NoIndom is a constant used to indicate absence of an indom from a metric
NoIndom = -1
)
Byte Lengths for Different Components
const (
HeaderLength uint64 = 40
TocLength uint64 = 16
Metric1Length uint64 = 104
Metric2Length uint64 = 48
ValueLength uint64 = 32
Instance1Length uint64 = 80
Instance2Length uint64 = 24
InstanceDomainLength uint64 = 32
StringLength uint64 = 256
)
MMVVersion is the current mmv format version
const MMVVersion = 1
func FixedVal ¶
func FixedVal(data uint64, t Type) (interface{}, error)
FixedVal will infer a fixed size value from the passed data
type Header ¶
Header describes the data in a MMV header
type Header struct {
Magic [4]byte
Version int32
G1, G2 uint64
Toc int32
Flag int32
Process, Cluster int32
}
func Dump ¶
func Dump(data []byte) (
h *Header,
tocs []*Toc,
metrics map[uint64]Metric,
values map[uint64]*Value,
instances map[uint64]Instance,
indoms map[uint64]*InstanceDomain,
strings map[uint64]*String,
err error,
)
Dump creates a data dump from the passed data
type Instance ¶
Instance is the base type for all instances
type Instance interface {
Indom() uint64
Internal() int32
Padding() uint32
}
type Instance1 ¶
Instance1 defines the contents in a valid mmv1 instance
type Instance1 struct {
InstanceBase
External [NameMax]byte
}
type Instance2 ¶
Instance2 defines the contents in a valid mmv2 instance
type Instance2 struct {
InstanceBase
External uint64
}
type InstanceBase ¶
InstanceBase defines the common contents in a valid instance
type InstanceBase struct {
// contains filtered or unexported fields
}
func (InstanceBase) Indom ¶
func (i InstanceBase) Indom() uint64
Indom returns the indom offset
func (InstanceBase) Internal ¶
func (i InstanceBase) Internal() int32
Internal returns the internal id
func (InstanceBase) Padding ¶
func (i InstanceBase) Padding() uint32
Padding returns the padding value
type InstanceDomain ¶
InstanceDomain defines the contents in a valid instance domain
type InstanceDomain struct {
Serial, Count uint32
Offset, Shorttext, Longtext uint64
}
type Metric ¶
Metric is the base type for all metrics
type Metric interface {
Item() uint32
Typ() Type
Sem() Semantics
Unit() Unit
Indom() int32
Padding() uint32
ShortText() uint64
LongText() uint64
}
type Metric1 ¶
Metric1 defines the contents in a valid Metric
type Metric1 struct {
Name [NameMax]byte
MetricBase
}
type Metric2 ¶
Metric2 defines the contents in a valid Metric
type Metric2 struct {
Name uint64
MetricBase
}
type MetricBase ¶
MetricBase defines the common contents in a valid Metric
type MetricBase struct {
// contains filtered or unexported fields
}
func (MetricBase) Indom ¶
func (m MetricBase) Indom() int32
Indom returns the indom id
func (MetricBase) Item ¶
func (m MetricBase) Item() uint32
Item returns the item id
func (MetricBase) LongText ¶
func (m MetricBase) LongText() uint64
LongText returns the longtext offset
func (MetricBase) Padding ¶
func (m MetricBase) Padding() uint32
Padding returns the padding value
func (MetricBase) Sem ¶
func (m MetricBase) Sem() Semantics
Sem returns the semantics
func (MetricBase) ShortText ¶
func (m MetricBase) ShortText() uint64
ShortText returns the shorttext offset
func (MetricBase) Typ ¶
func (m MetricBase) Typ() Type
Typ returns the type
func (MetricBase) Unit ¶
func (m MetricBase) Unit() Unit
Unit returns the unit
type Semantics ¶
Semantics represents an enumerated type representing all possible semantics of a metric
type Semantics int32
Values for Semantics
const (
NoSemantics Semantics = 0
CounterSemantics
InstantSemantics
DiscreteSemantics
)
func (Semantics) String ¶
func (i Semantics) String() string
type String ¶
String wraps the payload for a PCP String
type String struct {
Payload [StringMax]byte
}
type Toc ¶
Toc defines the contents in a valid TOC
type Toc struct {
Type TocType
Count int32
Offset uint64
}
type TocType ¶
TocType is an enumerated type with different types as values
type TocType int32
Values for TocType
const (
TocIndoms TocType = iota + 1
TocInstances
TocMetrics
TocValues
TocStrings
)
func (TocType) String ¶
func (i TocType) String() string
type Type ¶
Type is an enumerated type representing all valid types for a metric
type Type int32
Possible values for a Type
const (
NoSupportType Type = iota - 1
Int32Type
Uint32Type
Int64Type
Uint64Type
FloatType
DoubleType
StringType
UnknownType Type = 255
)
func (Type) String ¶
func (i Type) String() string
type Unit ¶
Unit is an enumerated type with all possible units as values
type Unit uint32
Values for Space Units
const (
ByteUnit Unit = 1<<28 | iota<<16
KilobyteUnit
MegabyteUnit
GigabyteUnit
TerabyteUnit
PetabyteUnit
ExabyteUnit
)
Values for Time Units
const (
NanosecondUnit Unit = 1<<24 | iota<<12
MicrosecondUnit
MillisecondUnit
SecondUnit
MinuteUnit
HourUnit
)
Values for Count Units
const (
OneUnit Unit = 1<<20 | iota<<8
)
func (Unit) String ¶
func (i Unit) String() string
type Value ¶
Value defines the contents in a PCP Value
type Value struct {
// uint64 is a holder type here, while printing it is expected that
// the user will infer the value using the Val functions
Val uint64
Extra int64
Metric uint64
Instance uint64
}
ActiveGo 1.8