MCPcopy Create free account
hub / github.com/cortexproject/cortex / LabelsToKeyString

Function LabelsToKeyString

pkg/ingester/client/compat.go:308–314  ·  view source on GitHub ↗

LabelsToKeyString is used to form a string to be used as the hashKey. Don't print, use l.String() for printing.

(l labels.Labels)

Source from the content-addressed store, hash-verified

306// LabelsToKeyString is used to form a string to be used as
307// the hashKey. Don't print, use l.String() for printing.
308func LabelsToKeyString(l labels.Labels) string {
309 // We are allocating 1024, even though most series are less than 600b long.
310 // But this is not an issue as this function is being inlined when called in a loop
311 // and buffer allocated is a static buffer and not a dynamic buffer on the heap.
312 b := make([]byte, 0, 1024)
313 return string(l.Bytes(b))
314}

Callers 2

SelectMethod · 0.92
benchmarkSeriesMapFunction · 0.85

Calls 1

BytesMethod · 0.65

Tested by 2

SelectMethod · 0.74
benchmarkSeriesMapFunction · 0.68