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

Method toIDKey

server/controller/prometheus/cache/label.go:87–97  ·  view source on GitHub ↗

toIDKey converts a string-based LabelKey to an int-based IDLabelKey. Returns false if either name or value is not found in the caches.

(key LabelKey)

Source from the content-addressed store, hash-verified

85// toIDKey converts a string-based LabelKey to an int-based IDLabelKey.
86// Returns false if either name or value is not found in the caches.
87func (l *label) toIDKey(key LabelKey) (IDLabelKey, bool) {
88 nameID, ok := l.labelName.GetIDByName(key.Name)
89 if !ok {
90 return IDLabelKey{}, false
91 }
92 valueID, ok := l.labelValue.GetIDByValue(key.Value)
93 if !ok {
94 return IDLabelKey{}, false
95 }
96 return IDLabelKey{NameID: nameID, ValueID: valueID}, true
97}
98
99// GetKeyToID returns a snapshot of all labels as string-based LabelKey map.
100// This is an infrequent operation (debug, full assembly); it converts

Callers 2

GetIDByKeyMethod · 0.95

Calls 2

GetIDByValueMethod · 0.80
GetIDByNameMethod · 0.45

Tested by 1