insights

package
v0.0.0-...-6202178 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package insights contains the domain data structures and client logic for the k6 cloud Insights API.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrClientAlreadyInitialized is returned when the client is already initialized.
	ErrClientAlreadyInitialized = errors.New("insights client already initialized")

	// ErrClientClosed is returned when the client is closed.
	ErrClientClosed = errors.New("insights client closed")
)

Functions

This section is empty.

Types

type Client

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

Client is the client for the k6 Insights ingester service.

func NewClient

func NewClient(cfg ClientConfig) *Client

NewClient creates a new client.

func (*Client) Close

func (c *Client) Close() error

Close closes the client.

func (*Client) Dial

func (c *Client) Dial(ctx context.Context) error

Dial creates a client connection using ClientConfig.

func (*Client) IngestRequestMetadatasBatch

func (c *Client) IngestRequestMetadatasBatch(ctx context.Context, requestMetadatas RequestMetadatas) error

IngestRequestMetadatasBatch ingests a batch of request metadatas.

type ClientAuthConfig

type ClientAuthConfig struct {
	Enabled                  bool
	TestRunID                int64
	Token                    string
	RequireTransportSecurity bool
}

ClientAuthConfig is the configuration for the client authentication.

type ClientBackoffConfig

type ClientBackoffConfig struct {
	Enabled        bool
	JitterFraction float64
	WaitBetween    time.Duration
}

ClientBackoffConfig is the configuration for the client retries using the backoff exponential with jitter algorithm.

type ClientConfig

type ClientConfig struct {
	IngesterHost  string
	Timeout       time.Duration
	ConnectConfig ClientConnectConfig
	AuthConfig    ClientAuthConfig
	TLSConfig     ClientTLSConfig
	RetryConfig   ClientRetryConfig
}

ClientConfig is the configuration for the client.

func NewDefaultClientConfigForTestRun

func NewDefaultClientConfigForTestRun(ingesterHost, authToken string, testRunID int64) ClientConfig

NewDefaultClientConfigForTestRun creates a new default client config for a test run.

type ClientConnectConfig

type ClientConnectConfig struct {
	Block                  bool
	FailOnNonTempDialError bool
	Timeout                time.Duration
	Dialer                 func(context.Context, string) (net.Conn, error)
}

ClientConnectConfig is the configuration for the client connection.

type ClientRetryConfig

type ClientRetryConfig struct {
	RetryableStatusCodes string
	MaxAttempts          uint
	PerRetryTimeout      time.Duration
	BackoffConfig        ClientBackoffConfig
}

ClientRetryConfig is the configuration for the client retries.

type ClientTLSConfig

type ClientTLSConfig struct {
	Insecure bool
	CertFile string
}

ClientTLSConfig is the configuration for the client TLS.

type ProtocolHTTPLabels

type ProtocolHTTPLabels struct {
	URL        string
	Method     string
	StatusCode int64
}

ProtocolHTTPLabels describes labels associated with a single HTTP request.

func (ProtocolHTTPLabels) IsProtocolLabels

func (ProtocolHTTPLabels) IsProtocolLabels()

IsProtocolLabels is a dummy implementation to satisfy the ProtocolLabels interface.

type ProtocolLabels

type ProtocolLabels interface {
	IsProtocolLabels()
}

ProtocolLabels is a dummy interface that is used for compile-time type checking.

type RequestMetadata

type RequestMetadata struct {
	TraceID        string
	Start          time.Time
	End            time.Time
	TestRunLabels  TestRunLabels
	ProtocolLabels ProtocolLabels
}

RequestMetadata describes metadata associated with a single *traced* request.

type RequestMetadatas

type RequestMetadatas []RequestMetadata

RequestMetadatas is a slice of RequestMetadata.

type TestRunLabels

type TestRunLabels struct {
	ID       int64
	Scenario string
	Group    string
}

TestRunLabels describes labels associated with a single test run.

Directories

Path Synopsis
Package proto contains the Protobuf definitions used by the k6 Insights.
Package proto contains the Protobuf definitions used by the k6 Insights.

Jump to

Keyboard shortcuts

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