cloud

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2018 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Default request timeout
	RequestTimeout = 10 * time.Second
	// Retry interval
	RetryInterval = 500 * time.Millisecond
	// Retry attempts
	MaxRetries = 3
)
View Source
const (
	TestName          = "k6 test"
	MetricPushinteral = 1 * time.Second
)

Variables

View Source
var (
	ErrNotAuthorized    = errors.New("Not allowed to upload result to Load Impact cloud")
	ErrNotAuthenticated = errors.New("Failed to authenticate with Load Impact cloud")
	ErrUnknown          = errors.New("An error occurred talking to Load Impact cloud")
)

Functions

func URLForResults added in v0.19.0

func URLForResults(refID string, config Config) string

Types

type Client

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

Client handles communication with Load Impact cloud API.

func NewClient

func NewClient(token, host, version string) *Client

func (*Client) CreateTestRun

func (c *Client) CreateTestRun(testRun *TestRun) (*CreateTestRunResponse, error)

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) error

func (*Client) GetTestProgress added in v0.20.0

func (c *Client) GetTestProgress(referenceID string) (*TestProgressResponse, error)

func (*Client) Login added in v0.19.0

func (c *Client) Login(email string, password string) (*LoginResponse, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method, url string, data interface{}) (*http.Request, error)

func (*Client) PushMetric

func (c *Client) PushMetric(referenceID string, noCompress bool, samples []*Sample) error

func (*Client) StartCloudTestRun added in v0.19.0

func (c *Client) StartCloudTestRun(name string, projectID int, arc *lib.Archive) (string, error)

func (*Client) StopCloudTestRun added in v0.20.0

func (c *Client) StopCloudTestRun(referenceID string) error

func (*Client) TestFinished

func (c *Client) TestFinished(referenceID string, thresholds ThresholdResult, tained bool) error

func (*Client) ValidateOptions added in v0.19.0

func (c *Client) ValidateOptions(options lib.Options) error

type Collector

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

Collector sends result data to the Load Impact cloud service.

func New

func New(conf Config, src *lib.SourceData, opts lib.Options, version string) (*Collector, error)

New creates a new cloud collector

func (*Collector) Collect

func (c *Collector) Collect(samples []stats.Sample)

func (*Collector) GetRequiredSystemTags added in v0.20.0

func (c *Collector) GetRequiredSystemTags() lib.TagSet

GetRequiredSystemTags returns which sample tags are needed by this collector

func (*Collector) Init

func (c *Collector) Init() error

func (*Collector) IsReady added in v0.17.0

func (c *Collector) IsReady() bool
func (c *Collector) Link() string

func (*Collector) Run

func (c *Collector) Run(ctx context.Context)

type Config added in v0.18.0

type Config ConfigFields

func (Config) Apply added in v0.18.0

func (c Config) Apply(cfg Config) Config

func (Config) MarshalJSON added in v0.18.0

func (c Config) MarshalJSON() ([]byte, error)

func (*Config) UnmarshalJSON added in v0.18.0

func (c *Config) UnmarshalJSON(data []byte) error

func (*Config) UnmarshalText added in v0.18.0

func (c *Config) UnmarshalText(data []byte) error

type ConfigFields added in v0.18.0

type ConfigFields struct {
	Token           string `json:"token" mapstructure:"token" envconfig:"CLOUD_TOKEN"`
	Name            string `json:"name" mapstructure:"name" envconfig:"CLOUD_NAME"`
	Host            string `json:"host" mapstructure:"host" envconfig:"CLOUD_HOST"`
	NoCompress      bool   `json:"no_compress" mapstructure:"no_compress" envconfig:"CLOUD_NO_COMPRESS"`
	ProjectID       int    `json:"project_id" mapstructure:"projectID" envconfig:"CLOUD_PROJECT_ID"`
	DeprecatedToken string `envconfig:"K6CLOUD_TOKEN"`
}

type CreateTestRunResponse

type CreateTestRunResponse struct {
	ReferenceID string `json:"reference_id"`
}

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response `json:"-"`

	Code    int               `json:"code"`
	Message string            `json:"message"`
	Details map[string]string `json:"details"`
}

ErrorResponse represents an error cause by talking to the API

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

type LoginResponse added in v0.19.0

type LoginResponse struct {
	Token string `json:"token"`
}

type Sample added in v0.17.0

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

type SampleData added in v0.17.0

type SampleData struct {
	Type   stats.MetricType   `json:"type"`
	Time   time.Time          `json:"time"`
	Value  float64            `json:"value"`
	Values map[string]float64 `json:"values,omitempty"`
	Tags   map[string]string  `json:"tags,omitempty"`
}

type TestProgressResponse added in v0.20.0

type TestProgressResponse struct {
	RunStatusText string  `json:"run_status_text"`
	RunStatus     int     `json:"run_status"`
	ResultStatus  int     `json:"result_status"`
	Progress      float64 `json:"progress"`
}

type TestRun

type TestRun struct {
	Name       string              `json:"name"`
	ProjectID  int                 `json:"project_id,omitempty"`
	Thresholds map[string][]string `json:"thresholds"`
	// Duration of test in seconds. -1 for unknown length, 0 for continuous running.
	Duration int64 `json:"duration"`
}

type ThresholdResult

type ThresholdResult map[string]map[string]bool

Jump to

Keyboard shortcuts

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