MCPcopy
hub / github.com/prometheus/prometheus / FromStrings

Function FromStrings

model/labels/labels_dedupelabels.go:471–481  ·  view source on GitHub ↗

FromStrings creates new labels from pairs of strings.

(ss ...string)

Source from the content-addressed store, hash-verified

469
470// FromStrings creates new labels from pairs of strings.
471func FromStrings(ss ...string) Labels {
472 if len(ss)%2 != 0 {
473 panic("invalid number of strings")
474 }
475 ls := make([]Label, 0, len(ss)/2)
476 for i := 0; i < len(ss); i += 2 {
477 ls = append(ls, Label{Name: ss[i], Value: ss[i+1]})
478 }
479
480 return New(ls...)
481}
482
483// Compare compares the two label sets.
484// The result will be 0 if a==b, <0 if a < b, and >0 if a > b.

Calls 1

NewFunction · 0.70

Used in the wild real call sites across dependent graphs

searching dependent graphs…