Codebase list golang-github-go-kit-kit / 2fb53d48-7f67-4645-ba70-f8304edfe7b2/main metrics / internal / lv / labelvalues.go
2fb53d48-7f67-4645-ba70-f8304edfe7b2/main

Tree @2fb53d48-7f67-4645-ba70-f8304edfe7b2/main (Download .tar.gz)

labelvalues.go @2fb53d48-7f67-4645-ba70-f8304edfe7b2/mainraw · history · blame

package lv

// LabelValues is a type alias that provides validation on its With method.
// Metrics may include it as a member to help them satisfy With semantics and
// save some code duplication.
type LabelValues []string

// With validates the input, and returns a new aggregate labelValues.
func (lvs LabelValues) With(labelValues ...string) LabelValues {
	if len(labelValues)%2 != 0 {
		labelValues = append(labelValues, "unknown")
	}
	return append(lvs, labelValues...)
}