MCPcopy Index your code
hub / github.com/coder/coder / fingerprintLabels

Function fingerprintLabels

coderd/notifications/metrics_test.go:476–489  ·  view source on GitHub ↗

fingerprintLabels produces a fingerprint unique to the given pairs of label values. MUST contain an even number of arguments (key:value), otherwise it will panic.

(lbs ...string)

Source from the content-addressed store, hash-verified

474// fingerprintLabels produces a fingerprint unique to the given pairs of label values.
475// MUST contain an even number of arguments (key:value), otherwise it will panic.
476func fingerprintLabels(lbs ...string) model.Fingerprint {
477 if len(lbs)%2 != 0 {
478 panic("imbalanced set of label pairs given")
479 }
480
481 lbsSet := make(model.LabelSet, len(lbs)/2)
482 for i := 0; i < len(lbs); i += 2 {
483 k := lbs[i]
484 v := lbs[i+1]
485 lbsSet[model.LabelName(k)] = model.LabelValue(v)
486 }
487
488 return lbsSet.Fingerprint() // FastFingerprint does not sort the labels.
489}
490
491// updateSignallingInterceptor intercepts bulk update calls to the store, and waits on the "proceed" condition to be
492// signaled by the caller so it can continue.

Callers 2

TestMetricsFunction · 0.85
fingerprintLabelPairsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected