add configuration: BusiGroupLabelKey
This commit is contained in:
parent
8ce71de693
commit
5a9b8d6bd0
|
@ -4,6 +4,10 @@ RunMode = "release"
|
|||
# my cluster name
|
||||
ClusterName = "Default"
|
||||
|
||||
# Default busigroup Key name
|
||||
# do not change
|
||||
BusiGroupLabelKey = "busigroup"
|
||||
|
||||
# sleep x seconds, then start judge engine
|
||||
EngineDelay = 120
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package common
|
|||
|
||||
import (
|
||||
"github.com/didi/nightingale/v5/src/models"
|
||||
"github.com/didi/nightingale/v5/src/server/config"
|
||||
"github.com/didi/nightingale/v5/src/server/memsto"
|
||||
"github.com/prometheus/prometheus/prompb"
|
||||
)
|
||||
|
@ -18,7 +19,7 @@ func AppendLabels(pt *prompb.TimeSeries, target *models.Target) {
|
|||
})
|
||||
}
|
||||
|
||||
if target.GroupId > 0 {
|
||||
if target.GroupId > 0 && len(config.C.BusiGroupLabelKey) > 0 {
|
||||
bg := memsto.BusiGroupCache.GetByBusiGroupId(target.GroupId)
|
||||
if bg == nil {
|
||||
return
|
||||
|
@ -29,7 +30,7 @@ func AppendLabels(pt *prompb.TimeSeries, target *models.Target) {
|
|||
}
|
||||
|
||||
pt.Labels = append(pt.Labels, &prompb.Label{
|
||||
Name: "busigroup",
|
||||
Name: config.C.BusiGroupLabelKey,
|
||||
Value: bg.LabelValue,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -100,6 +100,7 @@ func MustLoad(fpaths ...string) {
|
|||
type Config struct {
|
||||
RunMode string
|
||||
ClusterName string
|
||||
BusiGroupLabelKey string
|
||||
EngineDelay int64
|
||||
Log logx.Config
|
||||
HTTP httpx.Config
|
||||
|
|
Loading…
Reference in New Issue