-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Although we do not expose any of user-facing logic at this point, we register the "k6/experimental/tracing" module in k6 to prepare for further implementation of public APIs
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Package tracing implements a k6 JS module for instrumenting k6 scripts with tracing context information. | ||
package tracing | ||
|
||
import ( | ||
"go.k6.io/k6/js/modules" | ||
) | ||
|
||
type ( | ||
// RootModule is the global module instance that will create Client | ||
// instances for each VU. | ||
RootModule struct{} | ||
|
||
// ModuleInstance represents an instance of the JS module. | ||
ModuleInstance struct { | ||
vu modules.VU | ||
} | ||
) | ||
|
||
// Ensure the interfaces are implemented correctly | ||
var ( | ||
_ modules.Instance = &ModuleInstance{} | ||
_ modules.Module = &RootModule{} | ||
) | ||
|
||
// New returns a pointer to a new RootModule instance | ||
func New() *RootModule { | ||
return &RootModule{} | ||
} | ||
|
||
// NewModuleInstance implements the modules.Module interface and returns | ||
// a new instance for each VU. | ||
func (*RootModule) NewModuleInstance(vu modules.VU) modules.Instance { | ||
return &ModuleInstance{ | ||
vu: vu, | ||
} | ||
} | ||
|
||
// Exports implements the modules.Instance interface and returns | ||
// the exports of the JS module. | ||
func (mi *ModuleInstance) Exports() modules.Exports { | ||
return modules.Exports{} | ||
} |