Documentation ¶
Overview ¶
Package tracing implements a k6 JS module for instrumenting k6 scripts with tracing context information.
Index ¶
- Constants
- type Client
- func (c *Client) AsyncRequest(method string, url goja.Value, args ...goja.Value) (*goja.Promise, error)
- func (c *Client) Configure(opts options) error
- func (c *Client) Del(url goja.Value, args ...goja.Value) (*httpmodule.Response, error)
- func (c *Client) Get(url goja.Value, args ...goja.Value) (*httpmodule.Response, error)
- func (c *Client) Head(url goja.Value, args ...goja.Value) (*httpmodule.Response, error)
- func (c *Client) Options(url goja.Value, args ...goja.Value) (*httpmodule.Response, error)
- func (c *Client) Patch(url goja.Value, args ...goja.Value) (*httpmodule.Response, error)
- func (c *Client) Post(url goja.Value, args ...goja.Value) (*httpmodule.Response, error)
- func (c *Client) Put(url goja.Value, args ...goja.Value) (*httpmodule.Response, error)
- func (c *Client) Request(method string, url goja.Value, args ...goja.Value) (*httpmodule.Response, error)
- type HTTPAsyncRequestFunc
- type HTTPRequestFunc
- type JaegerPropagator
- type ModuleInstance
- type Propagator
- type RootModule
- type TraceID
- type W3CPropagator
Constants ¶
const ( // W3CPropagatorName is the name of the W3C trace context propagator W3CPropagatorName = "w3c" // W3CHeaderName is the name of the W3C trace context header W3CHeaderName = "traceparent" // W3CVersion is the version of the supported W3C trace context header. // The current specification assumes the version is set to 00. W3CVersion = "00" // W3CUnsampledTraceFlag is the trace-flag value for an unsampled trace. W3CUnsampledTraceFlag = "00" // W3CSampledTraceFlag is the trace-flag value for a sampled trace. W3CSampledTraceFlag = "01" )
const ( // JaegerPropagatorName is the name of the Jaeger trace context propagator JaegerPropagatorName = "jaeger" // JaegerHeaderName is the name of the Jaeger trace context header JaegerHeaderName = "uber-trace-id" // JaegerRootSpanID is the universal span ID of the root span. // Its value is zero, which is described in the Jaeger documentation as: // "0 value is valid and means “root span” (when not ignored)" JaegerRootSpanID = "0" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a HTTP Client instrumenting the requests it performs with tracing information.
func (*Client) AsyncRequest ¶
func (c *Client) AsyncRequest(method string, url goja.Value, args ...goja.Value) (*goja.Promise, error)
AsyncRequest instruments the http module's asyncRequest function with tracing headers, and ensures the trace_id is emitted as part of the output's data points metadata.
type HTTPAsyncRequestFunc ¶
type HTTPAsyncRequestFunc func(method string, url goja.Value, args ...goja.Value) (*goja.Promise, error)
HTTPRequestFunc is a type alias representing the prototype of k6's http module's request function
type HTTPRequestFunc ¶
type HTTPRequestFunc func(method string, url goja.Value, args ...goja.Value) (*httpmodule.Response, error)
HTTPRequestFunc is a type alias representing the prototype of k6's http module's request function
type JaegerPropagator ¶
type JaegerPropagator struct{}
JaegerPropagator is a Propagator for the Jaeger trace context header
type ModuleInstance ¶
type ModuleInstance struct { // Client holds the module's default tracing client. *Client // contains filtered or unexported fields }
ModuleInstance represents an instance of the JS module.
func (*ModuleInstance) Exports ¶
func (mi *ModuleInstance) Exports() modules.Exports
Exports implements the modules.Instance interface and returns the exports of the JS module.
type Propagator ¶
Propagator is an interface for trace context propagation
type RootModule ¶
type RootModule struct{}
RootModule is the global module instance that will create Client instances for each VU.
func (*RootModule) NewModuleInstance ¶
func (*RootModule) NewModuleInstance(vu modules.VU) modules.Instance
NewModuleInstance implements the modules.Module interface and returns a new instance for each VU.
type TraceID ¶
type TraceID struct { // Prefix is the first 2 bytes of the trace-id, and is used to identify the // vendor of the trace-id. Prefix int16 // Code is the third byte of the trace-id, and is used to identify the // vendor's specific trace-id format. Code int8 // Time is the time at which the trace-id was generated. // // The time component is used as a source of randomness, and to ensure // uniqueness of the trace-id. // // When encoded, it should be in a format occupying the last 8 bytes of // the trace-id, and should ideally be encoded as nanoseconds. Time time.Time }
TraceID represents a trace-id as defined by the W3c specification, and used by w3c, b3 and jaeger propagators. See Considerations for trace-id field generation for more information.
func (TraceID) Encode ¶
Encode encodes the TraceID into a hex string.
The trace id is first encoded as a 16 bytes sequence, as follows: 1. Up to 2 bytes are encoded as the Prefix 2. The third byte is the Code. 3. Up to the following 8 bytes are UnixTimestampNano. 4. The remaining bytes are filled with random bytes.
The resulting 16 bytes sequence is then encoded as a hex string.
type W3CPropagator ¶
type W3CPropagator struct{}
W3CPropagator is a Propagator for the W3C trace context header