Skip to content

Commit 95dd25e

Browse files
authored
add random instrumentation scope values (#29)
1 parent c088e8e commit 95dd25e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pkg/tracegen/parameterized.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"encoding/hex"
55
"fmt"
66
"math/rand"
7+
"strconv"
78
"time"
89
"unsafe"
910

@@ -71,7 +72,8 @@ func (g *ParameterizedGenerator) Traces() ptrace.Traces {
7172
ilss := rspan.ScopeSpans()
7273
ilss.EnsureCapacity(1)
7374
ils := ilss.AppendEmpty()
74-
ils.Scope().SetName("k6")
75+
ils.Scope().SetName("k6-scope-name/" + random.String(15))
76+
ils.Scope().SetVersion("k6-scope-version:v" + strconv.Itoa(random.IntBetween(0, 99)) + "." + strconv.Itoa(random.IntBetween(0, 99)))
7577

7678
if te.ID == "" {
7779
te.ID = random.TraceID().String()

pkg/tracegen/templated.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"net/http"
66
"net/url"
7+
"strconv"
78
"strings"
89
"time"
910

@@ -233,7 +234,8 @@ func (g *TemplatedGenerator) generateResourceSpans(resSpanSlice ptrace.ResourceS
233234
resSpans.Resource().Attributes().PutStr("service.name", tmpl.service)
234235

235236
scopeSpans := resSpans.ScopeSpans().AppendEmpty()
236-
scopeSpans.Scope().SetName("k6")
237+
scopeSpans.Scope().SetName("k6-scope-name/" + random.String(15))
238+
scopeSpans.Scope().SetVersion("k6-scope-version:v" + strconv.Itoa(random.IntBetween(0, 99)) + "." + strconv.Itoa(random.IntBetween(0, 99)))
237239
return resSpans
238240
}
239241

0 commit comments

Comments
 (0)