monitor.go 435 字节
Newer Older
Y
Your Name 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
package monitor

import (
	"github.com/eolinker/goku-api-gateway/diting"
	"github.com/eolinker/goku-api-gateway/goku-labels"
	"strings"
	"sync"
)


var (
	once =sync.Once{}

)

func Init(cluster string,instance string)  {

	once.Do(func() {
		constLabels := make(diting.Labels)
		constLabels[goku_labels.Cluster] = cluster
		constLabels[goku_labels.Instance] = strings.ReplaceAll(instance,".","_")

		initCollector(constLabels)
	})
}