Documentation ¶
Index ¶
- Variables
- func GetAllCounter(tags []*TagPair) []string
- func IndexList() []*model.Instance
- func InitDB(cfg CacheSection)
- func OverMaxLimit(tagMap map[string][]string, limit int) bool
- func Persist(mode string) error
- func Rebuild(persistenceDir string, concurrency int)
- func RebuildFromDisk(indexFileDir string, concurrency int) error
- func ReportEndpoint()
- func StartCleaner(interval int, cacheDuration int)
- func StartPersist(interval int)
- func TagPairToMap(tagPairs []*TagPair) map[string][]string
- func WriteIndexToFile(indexDir, endpoint string) error
- type CacheSection
- type CounterTsMap
- type EndpointIndexMap
- func (e *EndpointIndexMap) Clean(timeDuration int64)
- func (e *EndpointIndexMap) DelByEndpoint(endpoint string)
- func (e *EndpointIndexMap) GetEndpoints() []string
- func (e *EndpointIndexMap) GetIndexByClude(endpoint, metric string, include, exclude []*TagPair) ([]string, error)
- func (e *EndpointIndexMap) GetMetricIndex(endpoint, metric string) (*MetricIndex, bool)
- func (e *EndpointIndexMap) GetMetricIndexMap(endpoint string) (*MetricIndexMap, bool)
- func (e *EndpointIndexMap) GetMetricsBy(endpoint string) []string
- func (e *EndpointIndexMap) Push(item dataobj.IndexModel, now int64)
- func (e *EndpointIndexMap) SetMetricIndexMap(endpoint string, metricIndex *MetricIndexMap)
- type MetricIndex
- type MetricIndexMap
- func (m *MetricIndexMap) Clean(now, timeDuration int64, endpoint string)
- func (m *MetricIndexMap) DelMetric(metric string)
- func (m *MetricIndexMap) GetMetricIndex(metric string) (*MetricIndex, bool)
- func (m *MetricIndexMap) GetMetrics() []string
- func (m *MetricIndexMap) IsReported() bool
- func (m *MetricIndexMap) Len() int
- func (m *MetricIndexMap) SetMetricIndex(metric string, metricIndex *MetricIndex)
- func (m *MetricIndexMap) SetReported()
- type TagPair
- type TagPairs
- type TagkvIndex
Constants ¶
This section is empty.
Variables ¶
View Source
var NewEndpoints *list.SafeListLimited
Functions ¶
func GetAllCounter ¶
GetAllCounter returns all possible tags combination. But not all of them will be in the CounterMaps.
func InitDB ¶
func InitDB(cfg CacheSection)
func OverMaxLimit ¶
OverMaxLimit check whether it can over limit or not.
func RebuildFromDisk ¶
func ReportEndpoint ¶
func ReportEndpoint()
func StartCleaner ¶
func StartPersist ¶
func StartPersist(interval int)
func TagPairToMap ¶
func WriteIndexToFile ¶
Types ¶
type CacheSection ¶
type CacheSection struct { CacheDuration int `yaml:"cacheDuration"` CleanInterval int `yaml:"cleanInterval"` PersistInterval int `yaml:"persistInterval"` PersistDir string `yaml:"persistDir"` RebuildWorker int `yaml:"rebuildWorker"` MaxQueryCount int `yaml:"maxQueryCount"` ReportEndpoint bool `yaml:"reportEndpoint"` }
var Config CacheSection
type CounterTsMap ¶
Counter: sorted tags
func NewCounterTsMap ¶
func NewCounterTsMap() *CounterTsMap
func (*CounterTsMap) Clean ¶
func (c *CounterTsMap) Clean(now, timeDuration int64, endpoint, metric string)
func (*CounterTsMap) GetCounters ¶
func (c *CounterTsMap) GetCounters() map[string]int64
func (*CounterTsMap) Len ¶
func (c *CounterTsMap) Len() int
func (*CounterTsMap) Set ¶
func (c *CounterTsMap) Set(counter string, ts int64)
type EndpointIndexMap ¶
type EndpointIndexMap struct { sync.RWMutex M map[string]*MetricIndexMap `json:"endpoint_index"` //map[endpoint]metricMap{map[metric]Index} }
var IndexDB *EndpointIndexMap
func (*EndpointIndexMap) Clean ¶
func (e *EndpointIndexMap) Clean(timeDuration int64)
func (*EndpointIndexMap) DelByEndpoint ¶ added in v1.4.0
func (e *EndpointIndexMap) DelByEndpoint(endpoint string)
func (*EndpointIndexMap) GetEndpoints ¶
func (e *EndpointIndexMap) GetEndpoints() []string
func (*EndpointIndexMap) GetIndexByClude ¶
func (e *EndpointIndexMap) GetIndexByClude(endpoint, metric string, include, exclude []*TagPair) ([]string, error)
func (*EndpointIndexMap) GetMetricIndex ¶
func (e *EndpointIndexMap) GetMetricIndex(endpoint, metric string) (*MetricIndex, bool)
func (*EndpointIndexMap) GetMetricIndexMap ¶
func (e *EndpointIndexMap) GetMetricIndexMap(endpoint string) (*MetricIndexMap, bool)
func (*EndpointIndexMap) GetMetricsBy ¶
func (e *EndpointIndexMap) GetMetricsBy(endpoint string) []string
func (*EndpointIndexMap) Push ¶
func (e *EndpointIndexMap) Push(item dataobj.IndexModel, now int64)
Push 索引数据
func (*EndpointIndexMap) SetMetricIndexMap ¶
func (e *EndpointIndexMap) SetMetricIndexMap(endpoint string, metricIndex *MetricIndexMap)
type MetricIndex ¶
type MetricIndex struct { sync.RWMutex Metric string `json:"metric"` Step int `json:"step"` DsType string `json:"dstype"` TagkvMap *TagkvIndex `json:"tags"` CounterMap *CounterTsMap `json:"counters"` Ts int64 `json:"ts"` }
func NewMetricIndex ¶
func NewMetricIndex(item dataobj.IndexModel, counter string, now int64) *MetricIndex
func (*MetricIndex) Set ¶
func (m *MetricIndex) Set(item dataobj.IndexModel, counter string, now int64)
type MetricIndexMap ¶
type MetricIndexMap struct { sync.RWMutex Reported bool // 用于判断 endpoint 是否已成功上报给 monapi Data map[string]*MetricIndex }
func ReadIndexFromFile ¶
func ReadIndexFromFile(indexDir, endpoint string) (*MetricIndexMap, error)
func (*MetricIndexMap) Clean ¶
func (m *MetricIndexMap) Clean(now, timeDuration int64, endpoint string)
func (*MetricIndexMap) DelMetric ¶
func (m *MetricIndexMap) DelMetric(metric string)
func (*MetricIndexMap) GetMetricIndex ¶
func (m *MetricIndexMap) GetMetricIndex(metric string) (*MetricIndex, bool)
func (*MetricIndexMap) GetMetrics ¶
func (m *MetricIndexMap) GetMetrics() []string
func (*MetricIndexMap) IsReported ¶
func (m *MetricIndexMap) IsReported() bool
func (*MetricIndexMap) Len ¶
func (m *MetricIndexMap) Len() int
func (*MetricIndexMap) SetMetricIndex ¶
func (m *MetricIndexMap) SetMetricIndex(metric string, metricIndex *MetricIndex)
func (*MetricIndexMap) SetReported ¶
func (m *MetricIndexMap) SetReported()
type TagPair ¶
func GetSortTags ¶
type TagkvIndex ¶
type TagkvIndex struct { sync.RWMutex Tagkv map[string]map[string]int64 `json:"tagkv"` // map[tagk]map[tagv]ts }
TagKeys
func NewTagkvIndex ¶
func NewTagkvIndex() *TagkvIndex
func (*TagkvIndex) Clean ¶
func (t *TagkvIndex) Clean(now, timeDuration int64)
func (*TagkvIndex) DelTag ¶
func (t *TagkvIndex) DelTag(tagk, tagv string)
func (*TagkvIndex) GetTagkv ¶
func (t *TagkvIndex) GetTagkv() []*TagPair
func (*TagkvIndex) GetTagkvMap ¶
func (t *TagkvIndex) GetTagkvMap() map[string][]string
func (*TagkvIndex) Len ¶
func (t *TagkvIndex) Len() int
func (*TagkvIndex) Set ¶
func (t *TagkvIndex) Set(tagk, tagv string, now int64)
Click to show internal directories.
Click to hide internal directories.