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

Method GetIDByKey

server/controller/prometheus/cache/label.go:127–143  ·  view source on GitHub ↗
(key LabelKey)

Source from the content-addressed store, hash-verified

125}
126
127func (l *label) GetIDByKey(key LabelKey) (int, bool) {
128 idk, ok := l.toIDKey(key)
129 if !ok {
130 return 0, false
131 }
132
133 if item, ok := l.getActive()[idk]; ok {
134 return item, true
135 }
136
137 l.mu.RLock()
138 defer l.mu.RUnlock()
139 if item, ok := l.pending[idk]; ok {
140 return item, true
141 }
142 return 0, false
143}
144
145func (l *label) Add(batch []*controller.PrometheusLabel) {
146 l.mu.Lock()

Calls 2

toIDKeyMethod · 0.95
getActiveMethod · 0.95