dtypes

package
v0.0.0-...-b53a1a1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONST_max_workers   = 256
	CONST_max_stvar_len = 256

	CONST_kvpair_instance_name = "instance" // Instance key name in kvpairs

	CONST_kvpairs_to_allocate_in_batch = 1000 // Kv pairs to allocate in a batch.
)
View Source
const (
	// NormalNaN is a quiet NaN. This is also math.NaN().
	NormalNaN uint64 = 0x7ff8000000000001

	// StaleNaN is a signaling NaN, due to the MSB of the mantissa being 0.
	// This value is chosen with many leading 0s, so we have scope to store more
	// complicated values in the future. It is 2 rather than 1 to make
	// it easier to distinguish from the NormalNaN by a human when debugging.
	StaleNaN uint64 = 0x7ff0000000000002
)

Variables

This section is empty.

Functions

func GetStFeReqStatusStr

func GetStFeReqStatusStr(status StFeReqStatus) string

func GetStypeStr

func GetStypeStr(stype StRecordType) string

func IsStaleNaN

func IsStaleNaN(v float64) bool

IsStaleNaN returns true when the provided NaN value is a stale marker.

func SterrorcodeString

func SterrorcodeString(e StErrorCode) string

Types

type DiRecord

type DiRecord struct {
	Snm   string       // Stat's group name (aka view or aka etype in logs).
	Suidx int          // Stat's group unique index.
	Tp    StRecordType // Record type.
	Kid   uint64       // Hash of all keys together (not values) sorted.
	SKvid uint64       // Hash of snm, keys and values (snm first)
	Ts    int64        // Sample time stamp in epoch.
	Lts   int64        // Last time stamp in epoch.
	Cs    []float64    // Counter values, either diff'd or actual values.
	// Ds    []string        // Dimensions, values for each key.
	Vid [sha1.Size]byte // Sha1 of all the Values (not the keys).
}

type KvPair

type KvPair struct {
	N string `json:"key"`   // Name.
	V string `json:"value"` // Value.
}

type KvPairs

type KvPairs []KvPair

func (KvPairs) Len

func (kvs KvPairs) Len() int

func (KvPairs) Less

func (kvs KvPairs) Less(i, j int) bool

func (KvPairs) Swap

func (kvs KvPairs) Swap(i, j int)

type MtRecord

type MtRecord struct {
	Snm      string          // Stat's group name (aka view or aka etype in logs).
	Suidx    int             // Stat's group unique index.
	Svar_num int             // svar number in the all_stats database.
	Kid      uint64          // Hash of all keys together (not values) sorted.
	Mid      uint64          // Metric id (hash of metric name and type, just computed one).
	Kvid     uint64          // Hash of all the keys and values together sorted (just computed once).
	MKvid    uint64          // Hash of metric name and all the keys and values (time-series ID).
	SKvid    uint64          // Hash of stat group name and all keys and values (stat generator ID).
	Vid      [sha1.Size]byte // Sha1 of all the Values (not the keys).
	Lsv      float64         // Last sample value.
	Lts      int64           // Last sample's time stamp.
	Drop     RecordDropType  // Should we drop this record?
}

type RecordDropType

type RecordDropType int8
const (
	RecordDrop_NODROP  RecordDropType = 0
	RecordDrop_MISSING RecordDropType = 1
	RecordDrop_STALE   RecordDropType = 2
)

type StBeReq

type StBeReq struct {
	Account string // Account.
	DFpath  string // Data file path.
	MFpath  string // Metadata file path.
	Iid     string // Unique Instance id per account  (instance + "." + job).
}

type StErrorCode

type StErrorCode int32
const (
	ErrorCode_OK                StErrorCode = 0
	ErrorCode_DB_FAILURE        StErrorCode = 1
	ErrorCode_PROMPARSER_FAILED StErrorCode = 2
	ErrorCode_NAMING_FAILED     StErrorCode = 3
	ErrorCode_DIFFCACHER_FAILED StErrorCode = 4
	ErrorCode_BEQ_Q_FAILED      StErrorCode = 5
)

type StFeReq

type StFeReq struct {
	Account string         // Account.
	DFpath  string         // Data file path.
	MFpath  string         // Metadata file path.
	Iid     string         // Unique Instance id per account  (instance + "." + job).
	DTs     int64          // Default time stamp to use for all records, epoch in msecs.
	Ftype   string         // File data type. eg: "prometheus".
	IidHash uint64         // xxhash64 of account and iid.
	Epoch   int64          // Last update to request
	Status  StFeReqStatus  // Status of the request
	Bytes   int            // Size of request payload (data+metadata)
	ResCh   *chan *StFeRes // Completion channel to reply for this request.
	OLabels []string       // Optional label names.
}

type StFeReqStatus

type StFeReqStatus int32
const (
	StFeReqStatusQueued  StFeReqStatus = 0
	StFeReqStatusActive  StFeReqStatus = 1
	StFeReqStatusUnknown StFeReqStatus = 2
)

type StFeRes

type StFeRes struct {
	Req *StFeReq    // Original request.
	Err StErrorCode // Error code.
}

type StFileMeta

type StFileMeta struct {
	Account      string   `json:"account"`       // Account
	Filetype     string   `json:"type"`          // File type, eg: "prometheus"
	Iid          string   `json:"iid"`           // Unique instance id  (instance + "." + job).
	IsCompressed bool     `json:"is_compressed"` // Is the data file compressed.
	Kvs          []KvPair `json:"kvs"`           // Global kvs to append to all records.
	DTs          int64    `json:"dts"`           // Global timestamp for all samples, if the sample is not there.
	OLabels      []string `json:"olabels"`       // Optional label names.
}

Metadata file format.

type StRecord

type StRecord struct {
	Mnm  string       // Metric full name.
	Mhlp []byte       // Metric help name.
	Kvs  KvPairs      // Vector of key/value pairs, sorted alphabetically by key.
	Ts   int64        // Sample time stamp in epoch.
	Sv   float64      // Sample value.
	Tp   StRecordType // Record type.
}

type StRecordType

type StRecordType int8
const (
	StRecord_COUNTER   StRecordType = 0
	StRecord_GAUGE     StRecordType = 1
	StRecord_HISTOGRAM StRecordType = 2
	StRecord_SUMMARY   StRecordType = 3
)

Jump to

Keyboard shortcuts

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