Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tracing instrumentation #3445

Merged
merged 16 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 57 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ import (
"go.k6.io/k6/errext"
"go.k6.io/k6/errext/exitcodes"
"go.k6.io/k6/lib/consts"
"go.k6.io/k6/lib/trace"
"go.k6.io/k6/log"
)

const waitLoggerCloseTimeout = time.Second * 5
const (
waitLoggerCloseTimeout = time.Second * 5
waitForTracerProviderStopTimeout = time.Second * 5
)

// This is to keep all fields needed for the main/root k6 command
type rootCommand struct {
Expand Down Expand Up @@ -80,6 +84,12 @@ func (c *rootCommand) persistentPreRunE(cmd *cobra.Command, args []string) error
return err
}
c.globalState.Logger.Debugf("k6 version: v%s", consts.FullVersion())

err = c.setupTracerProvider()
if err != nil {
return err
}

mstoykov marked this conversation as resolved.
Show resolved Hide resolved
return nil
}

Expand All @@ -90,7 +100,21 @@ func (c *rootCommand) execute() {
exitCode := -1
defer func() {
cancel()
c.stopLoggers()

// Wait for loggers and tracer provider to stop.
// As both methods already use a timeout, just wait.
var wg sync.WaitGroup
ff := [...]func(){c.stopLoggers, c.stopTracerProvider}
wg.Add(len(ff))
for _, f := range ff {
f := f
go func() {
f()
mstoykov marked this conversation as resolved.
Show resolved Hide resolved
wg.Done()
}()
}
wg.Wait()

c.globalState.OSExit(exitCode)
}()

Expand Down Expand Up @@ -151,6 +175,17 @@ func (c *rootCommand) stopLoggers() {
}
}

func (c *rootCommand) stopTracerProvider() {
ctx, cancel := context.WithTimeout(context.Background(), waitForTracerProviderStopTimeout)
defer cancel()

if err := c.globalState.TracerProvider.Shutdown(ctx); err != nil {
c.globalState.FallbackLogger.Errorf(
"The tracer provider didn't stop gracefully: %v", err,
)
}
}

func rootCmdPersistentFlagSet(gs *state.GlobalState) *pflag.FlagSet {
flags := pflag.NewFlagSet("", pflag.ContinueOnError)
// TODO: refactor this config, the default value management with pflag is
Expand Down Expand Up @@ -196,6 +231,10 @@ func rootCmdPersistentFlagSet(gs *state.GlobalState) *pflag.FlagSet {
"enable profiling (pprof) endpoints, k6's REST API should be enabled as well",
)

flags.StringVar(&gs.Flags.TracesOutput, "traces-output", gs.Flags.TracesOutput,
"set the output for k6 traces, possible values are none,otel[=host:port]")
flags.Lookup("traces-output").DefValue = gs.DefaultFlags.TracesOutput

ka3de marked this conversation as resolved.
Show resolved Hide resolved
return flags
}

Expand Down Expand Up @@ -295,3 +334,19 @@ func (c *rootCommand) setLoggerHook(ctx context.Context, h log.AsyncHook) {
c.globalState.Logger.AddHook(h)
c.globalState.Logger.SetOutput(io.Discard) // don't output to anywhere else
}

func (c *rootCommand) setupTracerProvider() error {
switch line := c.globalState.Flags.TracesOutput; {
case line == "none":
// Use globalState default NoopTracerProvider.
return nil
default:
tp, err := trace.TracerProviderFromConfigLine(c.globalState.Ctx, line)
if err != nil {
return err
}
c.globalState.TracerProvider = tp
}

return nil
}
54 changes: 31 additions & 23 deletions cmd/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"go.k6.io/k6/event"
"go.k6.io/k6/lib/fsext"
"go.k6.io/k6/lib/trace"
"go.k6.io/k6/ui/console"
)

Expand All @@ -35,12 +36,13 @@ const defaultConfigFileName = "config.json"
type GlobalState struct {
Ctx context.Context

FS fsext.Fs
Getwd func() (string, error)
BinaryName string
CmdArgs []string
Env map[string]string
Events *event.System
FS fsext.Fs
Getwd func() (string, error)
BinaryName string
CmdArgs []string
Env map[string]string
Events *event.System
TracerProvider *trace.TracerProvider

DefaultFlags, Flags GlobalFlags

Expand Down Expand Up @@ -106,23 +108,24 @@ func NewGlobalState(ctx context.Context) *GlobalState {
defaultFlags := GetDefaultFlags(confDir)

return &GlobalState{
Ctx: ctx,
FS: fsext.NewOsFs(),
Getwd: os.Getwd,
BinaryName: filepath.Base(binary),
CmdArgs: os.Args,
Env: env,
Events: event.NewEventSystem(100, logger),
DefaultFlags: defaultFlags,
Flags: getFlags(defaultFlags, env),
OutMutex: outMutex,
Stdout: stdout,
Stderr: stderr,
Stdin: os.Stdin,
OSExit: os.Exit,
SignalNotify: signal.Notify,
SignalStop: signal.Stop,
Logger: logger,
Ctx: ctx,
FS: fsext.NewOsFs(),
Getwd: os.Getwd,
BinaryName: filepath.Base(binary),
CmdArgs: os.Args,
Env: env,
Events: event.NewEventSystem(100, logger),
TracerProvider: trace.NewNoopTracerProvider(),
DefaultFlags: defaultFlags,
Flags: getFlags(defaultFlags, env),
OutMutex: outMutex,
Stdout: stdout,
Stderr: stderr,
Stdin: os.Stdin,
OSExit: os.Exit,
SignalNotify: signal.Notify,
SignalStop: signal.Stop,
Logger: logger,
FallbackLogger: &logrus.Logger{ // we may modify the other one
Out: stderr,
Formatter: new(logrus.TextFormatter), // no fancy formatting here
Expand All @@ -140,6 +143,7 @@ type GlobalFlags struct {
Address string
ProfilingEnabled bool
LogOutput string
TracesOutput string
LogFormat string
Verbose bool
}
Expand All @@ -151,6 +155,7 @@ func GetDefaultFlags(homeDir string) GlobalFlags {
ProfilingEnabled: false,
ConfigFilePath: filepath.Join(homeDir, "loadimpact", "k6", defaultConfigFileName),
LogOutput: "stderr",
TracesOutput: "none",
}
}

Expand All @@ -177,5 +182,8 @@ func getFlags(defaultFlags GlobalFlags, env map[string]string) GlobalFlags {
if _, ok := env["NO_COLOR"]; ok {
result.NoColor = true
}
if val, ok := env["K6_TRACES_OUTPUT"]; ok {
result.TracesOutput = val
}
return result
}
1 change: 1 addition & 0 deletions cmd/test_load.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func loadTest(gs *state.GlobalState, cmd *cobra.Command, args []string) (*loaded
val, ok := gs.Env[key]
return val, ok
},
TracerProvider: gs.TracerProvider,
}

test := &loadedTest{
Expand Down
22 changes: 12 additions & 10 deletions cmd/tests/test_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"go.k6.io/k6/event"
"go.k6.io/k6/lib/fsext"
"go.k6.io/k6/lib/testutils"
"go.k6.io/k6/lib/trace"
"go.k6.io/k6/ui/console"
)

Expand Down Expand Up @@ -85,16 +86,17 @@ func NewGlobalTestState(tb testing.TB) *GlobalTestState {
defaultFlags.Address = getFreeBindAddr(tb)

ts.GlobalState = &state.GlobalState{
Ctx: ctx,
FS: fs,
Getwd: func() (string, error) { return ts.Cwd, nil },
BinaryName: "k6",
CmdArgs: []string{},
Env: map[string]string{"K6_NO_USAGE_REPORT": "true"},
Events: event.NewEventSystem(100, logger),
DefaultFlags: defaultFlags,
Flags: defaultFlags,
OutMutex: outMutex,
Ctx: ctx,
FS: fs,
Getwd: func() (string, error) { return ts.Cwd, nil },
BinaryName: "k6",
CmdArgs: []string{},
Env: map[string]string{"K6_NO_USAGE_REPORT": "true"},
Events: event.NewEventSystem(100, logger),
TracerProvider: trace.NewNoopTracerProvider(),
DefaultFlags: defaultFlags,
Flags: defaultFlags,
OutMutex: outMutex,
Stdout: &console.Writer{
Mutex: outMutex,
Writer: ts.Stdout,
Expand Down
13 changes: 13 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.4
github.com/tidwall/gjson v1.17.0
go.opentelemetry.io/otel v1.19.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0
go.opentelemetry.io/otel/sdk v1.19.0
go.opentelemetry.io/otel/trace v1.19.0
go.uber.org/goleak v1.2.1
golang.org/x/crypto v0.14.0
golang.org/x/net v0.17.0
Expand All @@ -55,15 +61,19 @@ require (
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bufbuild/protocompile v0.6.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chromedp/cdproto v0.0.0-20221023212508-67ada9507fb2 // indirect
github.com/chromedp/sysutil v1.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dlclark/regexp2 v1.9.0 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/google/pprof v0.0.0-20230728192033-2ba5b33183c6 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
Expand All @@ -76,8 +86,11 @@ require (
github.com/redis/go-redis/v9 v9.0.5 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731193218-e0aa005b6bdf // indirect
)
29 changes: 29 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ github.com/bsm/ginkgo/v2 v2.7.0 h1:ItPMPH90RbmZJt5GtkcNvIRuGEdwlBItdNVoyzaNQao=
github.com/bsm/gomega v1.26.0 h1:LhQm+AFcgV2M0WyKroMASzAzCAJVpAxQXv4SaI9a69Y=
github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY=
github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE=
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
Expand Down Expand Up @@ -61,12 +63,18 @@ github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwV
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
github.com/go-sourcemap/sourcemap v2.1.4-0.20211119122758-180fcef48034+incompatible h1:bopx7t9jyUNX1ebhr0G4gtQWmUOgwQRI0QsYhdYLgkU=
github.com/go-sourcemap/sourcemap v2.1.4-0.20211119122758-180fcef48034+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
Expand Down Expand Up @@ -101,6 +109,8 @@ github.com/grafana/xk6-websockets v0.2.1 h1:99tuI5g9UPTCpGbiEo/9E7VFKQIOvTLq231q
github.com/grafana/xk6-websockets v0.2.1/go.mod h1:f0XN0IGHx6m8jWh/w8ZFG6mZlRgzpztSHmvd4uK9RJo=
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI=
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg=
github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
Expand Down Expand Up @@ -192,6 +202,22 @@ github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhso
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs=
go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 h1:Mne5On7VWdx7omSrSSZvM4Kw7cS7NQkOOmLcgscI51U=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0/go.mod h1:IPtUMKL4O3tH5y+iXVyAXqpAwMuzC1IrxVS81rummfE=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 h1:3d+S281UTjM+AbF31XSOYn1qXn3BgIdWl8HNEpx08Jk=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0/go.mod h1:0+KuTDyKL4gjKCF75pHOX4wuzYDUZYfAQdSu43o+Z2I=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 h1:IeMeyr1aBvBiPVYihXIaeIZba6b8E1bYp7lbdxK8CQg=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0/go.mod h1:oVdCUtjq9MK9BlS7TtucsQwUcXcymNiEDjgDD2jMtZU=
go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE=
go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8=
go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o=
go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A=
go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg=
go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo=
go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I=
go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
Expand Down Expand Up @@ -289,6 +315,9 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20230726155614-23370e0ffb3e h1:xIXmWJ303kJCuogpj0bHq+dcjcZHU+XFyc1I0Yl9cRg=
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw=
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731193218-e0aa005b6bdf h1:guOdSPaeFgN+jEJwTo1dQ71hdBm+yKSCCKuTRkJzcVo=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731193218-e0aa005b6bdf/go.mod h1:zBEcrKX2ZOcEkHWxBPAIvYUWOKKMIhYcmNiUIu2ji3I=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
Expand Down
1 change: 1 addition & 0 deletions js/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ func (r *Runner) newVU(
Tags: lib.NewVUStateTags(vu.Runner.RunTags),
Group: r.defaultGroup,
BuiltinMetrics: r.preInitState.BuiltinMetrics,
TracerProvider: r.preInitState.TracerProvider,
}
vu.moduleVUImpl.state = vu.state
_ = vu.Runtime.Set("console", vu.Console)
Expand Down
2 changes: 2 additions & 0 deletions lib/test_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/sirupsen/logrus"
"go.k6.io/k6/event"
"go.k6.io/k6/lib/trace"
"go.k6.io/k6/metrics"
)

Expand All @@ -18,6 +19,7 @@ type TestPreInitState struct {
KeyLogger io.Writer
LookupEnv func(key string) (val string, ok bool)
Logger logrus.FieldLogger
TracerProvider *trace.TracerProvider
}

// TestRunState contains the pre-init state as well as all of the state and
Expand Down
2 changes: 2 additions & 0 deletions lib/trace/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package trace provides functionalities for tracing instrumentation.
package trace
Loading