cloud

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataTypeSingle             = "Point"
	DataTypeMap                = "Points"
	DataTypeAggregatedHTTPReqs = "AggregatedPoints"
)

DataType constants

View Source
const TestName = "k6 test"

TestName is the default Load Impact Cloud test name

Variables

This section is empty.

Functions

func New

func New(params output.Params) (output.Output, error)

New creates a new cloud output.

Types

type AggregatedMetric

type AggregatedMetric struct {

	// Updated by Calc() and used in the JSON output
	Min float64 `json:"min"`
	Max float64 `json:"max"`
	Avg float64 `json:"avg"`
	// contains filtered or unexported fields
}

AggregatedMetric is used to store aggregated information for a particular metric in an SampleDataAggregatedMap.

func (*AggregatedMetric) Add

func (am *AggregatedMetric) Add(t time.Duration)

Add the new duration to the internal sum and update Min and Max if necessary

func (*AggregatedMetric) Calc

func (am *AggregatedMetric) Calc(count float64)

Calc populates the float fields for min and max and calculates the average value

type AggregatedRate

type AggregatedRate struct {
	Count   float64 `json:"count"`
	NzCount float64 `json:"nz_count"`
}

AggregatedRate is an aggregation of a Rate metric

func (*AggregatedRate) Add

func (ar *AggregatedRate) Add(b bool)

Add a boolean to the aggregated rate

func (AggregatedRate) IsDefined

func (ar AggregatedRate) IsDefined() bool

IsDefined implements easyjson.Optional

type Output

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

Output sends result data to the Load Impact cloud service.

func (*Output) AddMetricSamples

func (out *Output) AddMetricSamples(sampleContainers []stats.SampleContainer)

AddMetricSamples receives a set of metric samples. This method is never called concurrently, so it defers as much of the work as possible to the asynchronous goroutines initialized in Start().

func (*Output) Description

func (out *Output) Description() string

Description returns the URL with the test run results.

func (*Output) PushMetric

func (out *Output) PushMetric(referenceID string, noCompress bool, s []*Sample) error

PushMetric pushes the provided metric samples for the given referenceID

func (*Output) SetRunStatus

func (out *Output) SetRunStatus(status lib.RunStatus)

SetRunStatus receives the latest run status from the Engine.

func (*Output) SetThresholds

func (out *Output) SetThresholds(scriptThresholds map[string]stats.Thresholds)

SetThresholds receives the thresholds before the output is Start()-ed.

func (*Output) Start

func (out *Output) Start() error

Start calls the k6 Cloud API to initialize the test run, and then starts the goroutine that would listen for metric samples and send them to the cloud.

func (*Output) Stop

func (out *Output) Stop() error

Stop gracefully stops all metric emission from the output and when all metric samples are emitted, it sends an API to the cloud to finish the test run.

type Sample

type Sample struct {
	Type   string      `json:"type"`
	Metric string      `json:"metric"`
	Data   interface{} `json:"data"`
}

Sample is the generic struct that contains all types of data that we send to the cloud.

func NewSampleFromTrail

func NewSampleFromTrail(trail *httpext.Trail) *Sample

NewSampleFromTrail just creates a ready-to-send Sample instance directly from a httpext.Trail.

func (Sample) MarshalEasyJSON

func (v Sample) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Sample) UnmarshalEasyJSON

func (v *Sample) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Sample) UnmarshalJSON

func (ct *Sample) UnmarshalJSON(p []byte) error

UnmarshalJSON decodes the Data into the corresponding struct

type SampleDataAggregatedHTTPReqs

type SampleDataAggregatedHTTPReqs struct {
	Time   int64             `json:"time,string"`
	Type   string            `json:"type"`
	Count  uint64            `json:"count"`
	Tags   *stats.SampleTags `json:"tags,omitempty"`
	Values struct {
		Duration       AggregatedMetric `json:"http_req_duration"`
		Blocked        AggregatedMetric `json:"http_req_blocked"`
		Connecting     AggregatedMetric `json:"http_req_connecting"`
		TLSHandshaking AggregatedMetric `json:"http_req_tls_handshaking"`
		Sending        AggregatedMetric `json:"http_req_sending"`
		Waiting        AggregatedMetric `json:"http_req_waiting"`
		Receiving      AggregatedMetric `json:"http_req_receiving"`
		Failed         AggregatedRate   `json:"http_req_failed,omitempty"`
	} `json:"values"`
}

SampleDataAggregatedHTTPReqs is used in aggregated samples for HTTP requests.

func (*SampleDataAggregatedHTTPReqs) Add

func (sdagg *SampleDataAggregatedHTTPReqs) Add(trail *httpext.Trail)

Add updates all agregated values with the supplied trail data

func (*SampleDataAggregatedHTTPReqs) CalcAverages

func (sdagg *SampleDataAggregatedHTTPReqs) CalcAverages()

CalcAverages calculates and sets all `Avg` properties in the `Values` struct

func (SampleDataAggregatedHTTPReqs) MarshalEasyJSON

func (v SampleDataAggregatedHTTPReqs) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*SampleDataAggregatedHTTPReqs) UnmarshalEasyJSON

func (v *SampleDataAggregatedHTTPReqs) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type SampleDataMap

type SampleDataMap struct {
	Time   int64              `json:"time,string"`
	Type   stats.MetricType   `json:"type"`
	Tags   *stats.SampleTags  `json:"tags,omitempty"`
	Values map[string]float64 `json:"values,omitempty"`
}

SampleDataMap is used by samples that contain multiple values, currently that's only iteration metrics (`iter_li_all`) and unaggregated HTTP requests (`http_req_li_all`).

func (SampleDataMap) MarshalEasyJSON

func (v SampleDataMap) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*SampleDataMap) UnmarshalEasyJSON

func (v *SampleDataMap) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type SampleDataSingle

type SampleDataSingle struct {
	Time  int64             `json:"time,string"`
	Type  stats.MetricType  `json:"type"`
	Tags  *stats.SampleTags `json:"tags,omitempty"`
	Value float64           `json:"value"`
}

SampleDataSingle is used in all simple un-aggregated single-value samples.

func (SampleDataSingle) MarshalEasyJSON

func (v SampleDataSingle) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*SampleDataSingle) UnmarshalEasyJSON

func (v *SampleDataSingle) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

Jump to

Keyboard shortcuts

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