workspacetraffic

package
v2.10.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig added in v2.7.0

type AppConfig struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

type Config

type Config struct {
	// AgentID is the workspace agent ID to which to connect.
	AgentID uuid.UUID `json:"agent_id"`

	// BytesPerTick is the number of bytes to send to the agent per tick.
	BytesPerTick int64 `json:"bytes_per_tick"`

	// Duration is the total duration for which to send traffic to the agent.
	Duration time.Duration `json:"duration"`

	// TickInterval specifies the interval between ticks (that is, attempts to
	// send data to workspace agents).
	TickInterval time.Duration `json:"tick_interval"`

	ReadMetrics  ConnMetrics `json:"-"`
	WriteMetrics ConnMetrics `json:"-"`

	SSH bool `json:"ssh"`

	// Echo controls whether the agent should echo the data it receives.
	// If false, the agent will discard the data. Note that setting this
	// to true will double the amount of data read from the agent for
	// PTYs (e.g. reconnecting pty or SSH connections that request PTY).
	Echo bool `json:"echo"`

	App AppConfig `json:"app"`
}

func (Config) Validate

func (c Config) Validate() error

type ConnMetrics

type ConnMetrics interface {
	AddError(float64)
	ObserveLatency(float64)
	AddTotal(float64)
}

type Metrics

type Metrics struct {
	BytesReadTotal      prometheus.CounterVec
	BytesWrittenTotal   prometheus.CounterVec
	ReadErrorsTotal     prometheus.CounterVec
	WriteErrorsTotal    prometheus.CounterVec
	ReadLatencySeconds  prometheus.HistogramVec
	WriteLatencySeconds prometheus.HistogramVec
	LabelNames          []string
}

func NewMetrics

func NewMetrics(reg prometheus.Registerer, labelNames ...string) *Metrics

func (*Metrics) ReadMetrics

func (m *Metrics) ReadMetrics(lvs ...string) ConnMetrics

func (*Metrics) WriteMetrics

func (m *Metrics) WriteMetrics(lvs ...string) ConnMetrics

type Runner

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

func NewRunner

func NewRunner(client *codersdk.Client, cfg Config) *Runner

func NewRunner(client *codersdk.Client, cfg Config, metrics *Metrics) *Runner {

func (*Runner) Cleanup

func (*Runner) Cleanup(context.Context, string, io.Writer) error

Cleanup does nothing, successfully.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, _ string, logs io.Writer) (err error)

Jump to

Keyboard shortcuts

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