示例#1
0
func setMockExpressions() {
	expr1 := cfg.AnalyticExpr{
		Name:    "expr1",
		Expr:    "(M1 + M2) / 2",
		Metrics: []string{"M1", "M2"},
	}
	expr2 := cfg.AnalyticExpr{
		Name:        "expr2",
		Expr:        "M1 / C1 + M2 / C2",
		Metrics:     []string{"M1", "M2"},
		Constraints: []string{"C1", "C2"},
	}
	expr3 := cfg.AnalyticExpr{
		Name:        "expr3",
		Expr:        "M1 * C1 + M3 / C3",
		Metrics:     []string{"M1", "M3"},
		Constraints: []string{"C1", "C3"},
	}

	expressions := map[string]cfg.AnalyticExpr{
		"expr1": expr1,
		"expr2": expr2,
		"expr3": expr3,
	}

	cfg.SetAnalyticExpr(expressions)
}
示例#2
0
文件: join.go 项目: elleFlorio/gru
func initializeAnalytics(clusterName string) {
	remote := c_GRU_REMOTE + clusterName + "/" + c_ANALYTIC_REMOTE
	expressions := cfg.ReadAnalytics(remote)
	cfg.SetAnalyticExpr(expressions)
	log.WithField("exprs", expressions).Debugln("Analytics read from remote")
}