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)
| 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). |
| 227 | func (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 | |
| 246 | func stringPtr(s string) *string { return &s } |
| 247 |
no test coverage detected