MCPcopy Create free account
hub / github.com/deepflowio/deepflow / newCache

Function newCache

server/controller/prometheus/cache/cache.go:53–74  ·  view source on GitHub ↗
(orgID int)

Source from the content-addressed store, hash-verified

51}
52
53func newCache(orgID int) (*Cache, error) {
54 org, err := common.NewORG(orgID)
55 if err != nil {
56 log.Errorf("failed to create org object: %s", orgID, err.Error())
57 return nil, err
58 }
59 log.Infof("new prometheus cache", org.LogPrefix)
60 mn := newMetricName(org)
61 ln := newLabelName(org)
62 lv := newLabelValue(org)
63 c := &Cache{
64 org: org,
65 canRefresh: make(chan bool, 1),
66 MetricName: mn,
67 LabelName: ln,
68 LabelValue: lv,
69 MetricAndAPPLabelLayout: newMetricAndAPPLabelLayout(org),
70 Label: newLabel(org, ln, lv),
71 }
72 c.canRefresh <- true
73 return c, nil
74}
75
76func (c *Cache) GetORG() *common.ORG {
77 return c.org

Callers 1

Calls 8

newMetricNameFunction · 0.70
newLabelNameFunction · 0.70
newLabelValueFunction · 0.70
newLabelFunction · 0.70
ErrorMethod · 0.65
ErrorfMethod · 0.45
InfofMethod · 0.45

Tested by

no test coverage detected