client

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PropagatorW3C    = "w3c"
	HeaderNameW3C    = "Traceparent"
	PropagatorB3     = "b3"
	HeaderNameB3     = "b3"
	PropagatorJaeger = "jaeger"
	HeaderNameJaeger = "uber-trace-id"
)
View Source
const (
	K6Prefix     = 0756 // Being 075 the ASCII code for 'K' :)
	K6Code_Cloud = 12   // To ingest and process the related spans in k6 Cloud.
	K6Code_Local = 33   // To not ingest and process the related spans, b/c they are part of a non-cloud run.
)

Variables

This section is empty.

Functions

func EncodeTraceID added in v0.3.0

func EncodeTraceID(t TraceID) (string, []byte, error)

func FromBytesToString added in v0.3.0

func FromBytesToString(buf []byte) string

func GenerateHeaderBasedOnPropagator added in v0.3.0

func GenerateHeaderBasedOnPropagator(propagator string, traceID string) (http.Header, error)

func RandHexStringRunes added in v0.3.0

func RandHexStringRunes(n int) string

Types

type HTTPResponse

type HTTPResponse struct {
	*k6HTTP.Response `js:"-"`
	TraceID          string
}

type HttpFunc

type HttpFunc func(ctx context.Context, url goja.Value, args ...goja.Value) (*k6HTTP.Response, error)

type HttpRequestFunc

type HttpRequestFunc func(method string, url goja.Value, args ...goja.Value) (*k6HTTP.Response, error)

type Options added in v0.3.0

type Options struct {
	Propagator string
}

type TraceID added in v0.3.0

type TraceID struct {
	Prefix            int16
	Code              int8
	UnixTimestampNano uint64
}

TraceIDs of 16 bytes (128 bits) are supported by w3c, b3 and jaeger

func DecodeTraceID added in v0.3.0

func DecodeTraceID(buf []byte) *TraceID

func (*TraceID) IsValid added in v0.3.0

func (t *TraceID) IsValid() bool

func (*TraceID) IsValidCloud added in v0.3.0

func (t *TraceID) IsValidCloud() bool

type TracingClient

type TracingClient struct {
	// contains filtered or unexported fields
}

func New

func New(vu modules.VU, requestFunc HttpRequestFunc, options Options) *TracingClient

func (*TracingClient) Del

func (c *TracingClient) Del(url goja.Value, args ...goja.Value) (*HTTPResponse, error)

func (*TracingClient) Get

func (c *TracingClient) Get(url goja.Value, args ...goja.Value) (*HTTPResponse, error)

func (*TracingClient) Head

func (c *TracingClient) Head(url goja.Value, args ...goja.Value) (*HTTPResponse, error)

func (*TracingClient) Options

func (c *TracingClient) Options(url goja.Value, args ...goja.Value) (*HTTPResponse, error)

func (*TracingClient) Patch

func (c *TracingClient) Patch(url goja.Value, args ...goja.Value) (*HTTPResponse, error)

func (*TracingClient) Post

func (c *TracingClient) Post(url goja.Value, args ...goja.Value) (*HTTPResponse, error)

func (*TracingClient) Put

func (c *TracingClient) Put(url goja.Value, args ...goja.Value) (*HTTPResponse, error)

func (*TracingClient) WithTrace

func (c *TracingClient) WithTrace(fn HttpFunc, spanName string, url goja.Value, args ...goja.Value) (*HTTPResponse, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL