コード例 #1
0
ファイル: send_queues.go プロジェクト: CMGS/transfer
func initSendQueues() {
	cfg := g.Config()
	for node, _ := range cfg.Judge.Cluster {
		Q := nlist.NewSafeListLimited(DefaultSendQueueMaxSize)
		JudgeQueues[node] = Q
	}

	for node, nitem := range cfg.Graph.Cluster2 {
		for _, addr := range nitem.Addrs {
			Q := nlist.NewSafeListLimited(DefaultSendQueueMaxSize)
			GraphQueues[node+addr] = Q
		}
	}

	if cfg.Graph.Migrating && cfg.Graph.ClusterMigrating != nil {
		for node, cnode := range cfg.Graph.ClusterMigrating2 {
			for _, addr := range cnode.Addrs {
				Q := nlist.NewSafeListLimited(DefaultSendQueueMaxSize)
				GraphMigratingQueues[node+addr] = Q
			}
		}
	}

	if cfg.Tsdb.Enabled {
		TsdbQueue = nlist.NewSafeListLimited(DefaultSendQueueMaxSize)
	}
}
コード例 #2
0
ファイル: collector.go プロジェクト: ketqi/nodata
func AddItem(key string, val *DataItem) {
	listv, found := ItemMap.Get(key)
	if !found {
		ll := tlist.NewSafeListLimited(3) //每个采集指标,缓存最新的3个数据点
		ll.PushFrontViolently(val)
		ItemMap.Put(key, ll)
		return
	}

	listv.(*tlist.SafeListLimited).PushFrontViolently(val)
}
コード例 #3
0
ファイル: history.go プロジェクト: peteryj/graph
func AddItem(key string, val *model.GraphItem) {
	itemlist, found := HistoryCache.Get(key)
	var slist *tlist.SafeListLimited
	if !found {
		slist = tlist.NewSafeListLimited(defaultHistorySize)
		HistoryCache.Put(key, slist)
	} else {
		slist = itemlist.(*tlist.SafeListLimited)
	}
	slist.PushFrontViolently(val)
}
コード例 #4
0
ファイル: history.go プロジェクト: beta-danche/graph
func AddItem(key string, val *cmodel.GraphItem) {
	itemlist, found := HistoryCache.Get(key)
	var slist *tlist.SafeListLimited
	if !found {
		slist = tlist.NewSafeListLimited(defaultHistorySize)
		HistoryCache.Put(key, slist)
	} else {
		slist = itemlist.(*tlist.SafeListLimited)
	}

	// old item should be drop
	first := slist.Front()
	if first == nil || first.(*cmodel.GraphItem).Timestamp < val.Timestamp { // first item or latest one
		slist.PushFrontViolently(val)
	}
}
コード例 #5
0
	pfc "github.com/niean/goperfcounter"
	cmodel "github.com/open-falcon/common/model"
	nlist "github.com/toolkits/container/list"
	nproc "github.com/toolkits/proc"

	"github.com/baishancloud/octopux-gateway/g"
	cpool "github.com/baishancloud/octopux-gateway/sender/conn_pool"
)

const (
	DefaultSendQueueMaxSize = 1024000 //102.4w
)

var (
	SenderQueue     = nlist.NewSafeListLimited(DefaultSendQueueMaxSize)
	SenderConnPools *cpool.SafeRpcConnPools

	TransferMap         = make(map[string]string, 0)
	TransferHostnames   = make([]string, 0)
	TransferSendCnt     = make(map[string]*nproc.SCounterQps, 0)
	TransferSendFailCnt = make(map[string]*nproc.SCounterQps, 0)
)

func Start() {
	initConnPools()
	startSendTasks()
	startSenderCron()
	log.Println("send.Start, ok")
}
コード例 #6
0
func InitIfstatsQ() {
	IfstatsQueue = nlist.NewSafeListLimited(DefaultSendQueueMaxSize)
}