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

Method generateFixedAttributesWithPrefix

pkg/util/trace_info.go:227–244  ·  view source on GitHub ↗

generateFixedAttributesWithPrefix returns the fixed attributes with a prefix. Keys are lowercase with a hyphen before the numeric suffix (e.g. string-01, int-01, blob-01).

(prefix string)

Source from the content-addressed store, hash-verified

225
226// generateFixedAttributesWithPrefix returns the fixed attributes with a prefix. Keys are lowercase with a hyphen before the numeric suffix (e.g. string-01, int-01, blob-01).
227func (t *TraceInfo) generateFixedAttributesWithPrefix(prefix string) []*jaeger.Tag {
228 var (
229 numStrings = t.r.Intn(6)
230 numBlobs = t.r.Intn(2)
231 numInts = t.r.Intn(6)
232 tags = make([]*jaeger.Tag, 0, numStrings+numBlobs+numInts)
233 )
234 for i := 0; i < numStrings; i++ {
235 tags = append(tags, &jaeger.Tag{Key: fmt.Sprintf("%s-string-%02d", prefix, i+1), VType: jaeger.TagType_STRING, VStr: stringPtr(t.generateRandomString())})
236 }
237 for i := 0; i < numBlobs; i++ {
238 tags = append(tags, &jaeger.Tag{Key: fmt.Sprintf("%s-blob-%02d", prefix, i+1), VType: jaeger.TagType_STRING, VStr: stringPtr(t.generateRandomBlob(vultureBlobSize))})
239 }
240 for i := 0; i < numInts; i++ {
241 tags = append(tags, &jaeger.Tag{Key: fmt.Sprintf("%s-int-%02d", prefix, i+1), VType: jaeger.TagType_LONG, VLong: int64Ptr(t.generateRandomInt(1, 1000000))})
242 }
243 return tags
244}
245
246func stringPtr(s string) *string { return &s }
247

Callers 2

makeThriftBatchMethod · 0.95
generateRandomLogsMethod · 0.95

Calls 5

generateRandomStringMethod · 0.95
generateRandomBlobMethod · 0.95
generateRandomIntMethod · 0.95
int64PtrFunction · 0.85
stringPtrFunction · 0.70

Tested by

no test coverage detected