Documentation ¶
Index ¶
- Constants
- Variables
- func GetConcurrentOfUpdateIndexAll() int
- func GetCounterFromCache(endpointId int64, counter string) (dsType string, step int, found bool)
- func GetEndpointFromCache(endpoint string) (int64, bool)
- func GetTypeAndStep(endpoint string, counter string) (dsType string, step int, found bool)
- func InitCache()
- func ReceiveItem(item *cmodel.GraphItem, md5 string)
- func RemoveItem(item *cmodel.GraphItem)
- func Start()
- func StartIndexUpdateIncrTask()
- func UpdateIndexAll(updateStepInSec int64)
- func UpdateIndexAllByDefaultStep()
- func UpdateIndexOne(endpoint string, metric string, tags map[string]string, dstype string, ...) error
- type IndexCacheBase
- func (this *IndexCacheBase) ContainsKey(key string) bool
- func (this *IndexCacheBase) Get(key string) interface{}
- func (this *IndexCacheBase) GetMaxSize() int
- func (this *IndexCacheBase) Keys() []string
- func (this *IndexCacheBase) Put(key string, item interface{})
- func (this *IndexCacheBase) Remove(key string)
- func (this *IndexCacheBase) Size() int
- type IndexCacheItem
Constants ¶
View Source
const ( DefaultMaxCacheSize = 5000000 // 默认 最多500w个,太大了内存会耗尽 DefaultCacheProcUpdateTaskSleepInterval = time.Duration(1) * time.Second )
View Source
const ( DefaultUpdateStepInSec = 2 * 24 * 3600 //更新步长,一定不能大于删除步长. 两天内的数据,都可以用来建立索引 ConcurrentOfUpdateIndexAll = 1 )
View Source
const (
IndexUpdateIncrTaskSleepInterval = time.Duration(1) * time.Second // 增量更新间隔时间, 默认30s
)
Variables ¶
View Source
var (
IndexedItemCache = NewIndexCacheBase(DefaultMaxCacheSize)
)
item缓存
Functions ¶
func GetCounterFromCache ¶
Return DsType Step if Found
func GetEndpointFromCache ¶
Return EndpointId if Found
func GetTypeAndStep ¶
USED WHEN QUERY
func ReceiveItem ¶
index收到一条新上报的监控数据,尝试用于增量更新索引
func RemoveItem ¶
从graph cache中删除掉某个item, 并删除指定的counter对应的rrd文件
func StartIndexUpdateIncrTask ¶
func StartIndexUpdateIncrTask()
启动索引的 异步、增量更新 任务, 每隔一定时间,刷新cache中的数据到数据库中
func UpdateIndexAll ¶
func UpdateIndexAll(updateStepInSec int64)
Types ¶
type IndexCacheBase ¶
索引缓存-基本缓存容器
func NewIndexCacheBase ¶
func NewIndexCacheBase(max int) *IndexCacheBase
func (*IndexCacheBase) ContainsKey ¶
func (this *IndexCacheBase) ContainsKey(key string) bool
func (*IndexCacheBase) Get ¶
func (this *IndexCacheBase) Get(key string) interface{}
func (*IndexCacheBase) GetMaxSize ¶
func (this *IndexCacheBase) GetMaxSize() int
func (*IndexCacheBase) Keys ¶
func (this *IndexCacheBase) Keys() []string
func (*IndexCacheBase) Put ¶
func (this *IndexCacheBase) Put(key string, item interface{})
func (*IndexCacheBase) Remove ¶
func (this *IndexCacheBase) Remove(key string)
func (*IndexCacheBase) Size ¶
func (this *IndexCacheBase) Size() int
type IndexCacheItem ¶
INDEX CACHE 索引缓存的元素数据结构
func NewIndexCacheItem ¶
func NewIndexCacheItem(uuid string, item *cmodel.GraphItem) *IndexCacheItem
Click to show internal directories.
Click to hide internal directories.