132
// tagsCacheKey builds a compact string key from a tag slice for use as a
133
// map lookup key.
135
>
size := 0
136
>
for i := range tags {
137
>
size += len(tags[i].Key) + len(tags[i].Value) + 2*binary.MaxVarintLen64
138
>
}
139
>
var sb strings.Builder
140
>
sb.Grow(size)
141
>
for _, t := range tags {
142
>
appendCacheKeyPart(&sb, t.Key)
143
>
appendCacheKeyPart(&sb, t.Value)
144
>
}
145
>
return sb.String()
146
}
147
149
>
var lenBuf [binary.MaxVarintLen64]byte
150
>
n := binary.PutUvarint(lenBuf[:], uint64(len(value)))
151
>
_, _ = sb.Write(lenBuf[:n])
152
>
sb.WriteString(value)
153
>
}
154
155
// WithTags creates a new MetricProvider with provided []Tag