core

package
v0.0.0-...-dfed6a9 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GAUGE    = "GAUGE"
	COUNTER  = "COUNTER"
	SUBTRACT = "SUBTRACT"
	DERIVE   = "DERIVE"
	SPLIT    = "/"
)
View Source
const (
	MachineDep   = 1
	MachineIndep = 2
)

Variables

This section is empty.

Functions

func DictedTagstring

func DictedTagstring(s string) map[string]string

func GetCounter

func GetCounter(metric, tag string, tagMap map[string]string) (counter string, err error)

func HasReservedWords

func HasReservedWords(str string) bool

func InitRpcClients

func InitRpcClients()

func NidToEndpoint

func NidToEndpoint(nid string) string

func PKWhitEndpointAndTags

func PKWhitEndpointAndTags(endpoint, metric, tags string) string

func PKWithCounter

func PKWithCounter(endpoint, counter string) string

func PKWithTags

func PKWithTags(metric, tags string) string

func Push

func Push(metricItems []*MetricValue) error

func SortedTags

func SortedTags(tags map[string]string) string

func SplitTagsString

func SplitTagsString(s string) (tags map[string]string, err error)

Types

type BuiltinMetric

type BuiltinMetric struct {
	Metric string
	Tags   string
}

e.g. tcp.port.listen or proc.num

func (*BuiltinMetric) String

func (bm *BuiltinMetric) String() string

type BuiltinMetricRequest

type BuiltinMetricRequest struct {
	Ty       int
	IP       string
	Checksum string
}

type BuiltinMetricResponse

type BuiltinMetricResponse struct {
	Metrics   []*BuiltinMetric
	Checksum  string
	Timestamp int64
	ErrCode   int
}

func (*BuiltinMetricResponse) String

func (br *BuiltinMetricResponse) String() string

type BuiltinMetricSlice

type BuiltinMetricSlice []*BuiltinMetric

func (BuiltinMetricSlice) Len

func (bm BuiltinMetricSlice) Len() int

func (BuiltinMetricSlice) Less

func (bm BuiltinMetricSlice) Less(i, j int) bool

func (BuiltinMetricSlice) Swap

func (bm BuiltinMetricSlice) Swap(i, j int)

type MetricValue

type MetricValue struct {
	Nid          string            `json:"nid"`
	Metric       string            `json:"metric"`
	Endpoint     string            `json:"endpoint"`
	Timestamp    int64             `json:"timestamp"`
	Step         int64             `json:"step"`
	ValueUntyped interface{}       `json:"value"`
	Value        float64           `json:"-"`
	CounterType  string            `json:"counterType"`
	Tags         string            `json:"tags"`
	TagsMap      map[string]string `json:"tagsMap"` //保留2种格式,方便后端组件使用
	Extra        string            `json:"extra"`
}

func GenProbeMetric

func GenProbeMetric(nid, metric string, val interface{}, tags map[string]string) *MetricValue

func (*MetricValue) CheckValidity

func (m *MetricValue) CheckValidity(now int64) (err error)

func (*MetricValue) PK

func (m *MetricValue) PK() string

type NullRpcRequest

type NullRpcRequest struct {
}

type RpcClientContainer

type RpcClientContainer struct {
	M map[string]*rpc.Client
	sync.RWMutex
}

func (*RpcClientContainer) Del

func (rcc *RpcClientContainer) Del(addr string)

func (*RpcClientContainer) Get

func (rcc *RpcClientContainer) Get(addr string) *rpc.Client

func (*RpcClientContainer) Put

func (rcc *RpcClientContainer) Put(addr string, client *rpc.Client) bool

Put 返回的bool表示affected,确实把自己塞进去了

type SimpleRpcResponse

type SimpleRpcResponse struct {
	Code int `json:"code"`
}

code == 0 => success code == 1 => bad request

type TransferResp

type TransferResp struct {
	Msg     string
	Total   int
	Invalid int
	Latency int64
}

func (*TransferResp) String

func (t *TransferResp) String() string

Jump to

Keyboard shortcuts

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