MCPcopy
hub / github.com/grafana/tempo / CloseAndBuildLabels

Method CloseAndBuildLabels

modules/generator/registry/builder.go:67–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65}
66
67func (b *labelBuilder) CloseAndBuildLabels() (labels.Labels, bool) {
68 // We always run sanitizer first and then run per label limiter to ensure that
69 // per label limits are always applied after sanitizer.
70 // Pipeline: sanitize labels --> per-label cardinality limit --> entity/series limit
71 lbls := b.sanitizer.Sanitize(b.builder.Labels())
72 lbls = b.perLabelLimiter.Limit(lbls)
73 // it's no longer safe to use the builder after this point, so we drop our
74 // reference to it. this may cause a nil panic if the builder is used after
75 // this point, but it's better than memory corruption.
76 builderPool.Put(b.builder)
77 b.builder = nil
78
79 if !lbls.IsValid(model.UTF8Validation) {
80 return lbls, false
81 }
82
83 return lbls, true
84}

Callers

nothing calls this directly

Calls 3

SanitizeMethod · 0.65
LimitMethod · 0.65
PutMethod · 0.45

Tested by

no test coverage detected