Skip to content

Commit

Permalink
add random instrumentation scope values
Browse files Browse the repository at this point in the history
  • Loading branch information
ie-pham committed Jun 18, 2024
1 parent c088e8e commit 8e623ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pkg/tracegen/parameterized.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/hex"
"fmt"
"math/rand"
"strconv"
"time"
"unsafe"

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

if te.ID == "" {
te.ID = random.TraceID().String()
Expand Down
4 changes: 3 additions & 1 deletion pkg/tracegen/templated.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"net/http"
"net/url"
"strconv"
"strings"
"time"

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

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

Expand Down

0 comments on commit 8e623ca

Please sign in to comment.