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

Method prepareMetadataKeys

pkg/distributor/distributor.go:1000–1019  ·  view source on GitHub ↗
(req *cortexpb.WriteRequest, limits *validation.Limits, userID string, firstPartialErr error)

Source from the content-addressed store, hash-verified

998}
999
1000func (d *Distributor) prepareMetadataKeys(req *cortexpb.WriteRequest, limits *validation.Limits, userID string, firstPartialErr error) ([]uint32, []*cortexpb.MetricMetadata, error) {
1001 validatedMetadata := make([]*cortexpb.MetricMetadata, 0, len(req.Metadata))
1002 metadataKeys := make([]uint32, 0, len(req.Metadata))
1003
1004 for _, m := range req.Metadata {
1005 err := validation.ValidateMetadata(d.validateMetrics, limits, userID, m)
1006
1007 if err != nil {
1008 if firstPartialErr == nil {
1009 firstPartialErr = err
1010 }
1011
1012 continue
1013 }
1014
1015 metadataKeys = append(metadataKeys, d.tokenForMetadata(userID, m.MetricFamilyName))
1016 validatedMetadata = append(validatedMetadata, m)
1017 }
1018 return metadataKeys, validatedMetadata, firstPartialErr
1019}
1020
1021type samplesLabelSetEntry struct {
1022 floatSamples int64

Callers 1

PushMethod · 0.95

Calls 2

tokenForMetadataMethod · 0.95
ValidateMetadataFunction · 0.92

Tested by

no test coverage detected