config

package
v0.0.0-...-81ccbf4 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Average latency is not a good metric, percentile latency is the way to go
	// But percentiles cannot be aggregated, so we need seperate latency vector for individual observations
	CollectionLatencySummary = promauto.NewSummaryVec(prometheus.SummaryOpts{
		Namespace:  "shibuya",
		Name:       "latency_collection",
		Help:       "Percentile latency of a collection",
		Objectives: map[float64]float64{0.9: 0.01, 0.99: 0.001},
	}, []string{"collection_id", "run_id"})
	PlanLatencySummary = promauto.NewSummaryVec(prometheus.SummaryOpts{
		Namespace:  "shibuya",
		Name:       "latency_plan",
		Help:       "Percentile latency of a collection",
		Objectives: map[float64]float64{0.9: 0.01, 0.99: 0.001},
	}, []string{"collection_id", "plan_id", "run_id"})
	LabelLatencySummary = promauto.NewSummaryVec(prometheus.SummaryOpts{
		Namespace:  "shibuya",
		Name:       "latency_label",
		Help:       "Percentile latency of a collection",
		Objectives: map[float64]float64{0.9: 0.01, 0.99: 0.001},
	}, []string{"collection_id", "label", "run_id"})

	// This is similar to Latency but cannot use histogram here because we need a very accurate count of every status error that occured.
	// So 200s are different bucket than 201s responses.
	StatusCounter = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: "shibuya",
		Name:      "status_counter",
		Help:      "stores count of responses and groups in buckets of response codes",
	}, []string{"collection_id", "plan_id", "run_id", "engine_no", "label", "status"})

	// Gauge is the most intuitive way to count threads here.
	// We don't care about accuracy and there's no use of rate of threads
	ThreadsGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: "shibuya",
		Name:      "threads_gauge",
		Help:      "Current number of threads running in JMeter",
	}, []string{"collection_id", "plan_id", "run_id", "engine_no"})

	CpuGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: "shibuya",
		Name:      "cpu_gauge",
		Help:      "CPU used by engine",
	}, []string{"collection_id", "plan_id", "engine_no"})

	MemGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: "shibuya",
		Name:      "mem_gauge",
		Help:      "Memory used by engine",
	}, []string{"collection_id", "plan_id", "engine_no"})
)

Functions

func GetKubeClient

func GetKubeClient() (*kubernetes.Clientset, error)

GetKubeClient creates a Kubernetes config and client for a given kubeconfig context.

func GetMetricsClient

func GetMetricsClient() (*metricsc.Clientset, error)

Types

type AuthConfig

type AuthConfig struct {
	AdminUsers []string `json:"admin_users"`
	NoAuth     bool     `json:"no_auth"`
	SessionKey string   `json:"session_key"`
	*LdapConfig
}

type ClusterConfig

type ClusterConfig struct {
	Project     string  `json:"project"`
	Zone        string  `json:"zone"`
	Region      string  `json:"region"`
	ClusterID   string  `json:"cluster_id"`
	Kind        string  `json:"kind"`
	APIEndpoint string  `json:"api_endpoint"`
	NodeCPUSpec int     `json:"node_cpu_spec"`
	OnDemand    bool    `json:"on_demand"`
	GCDuration  float64 `json:"gc_duration"` // in minutes
	ServiceType string  `json:"service_type"`
}

type DashboardConfig

type DashboardConfig struct {
	Url              string `json:"url"`
	RunDashboard     string `json:"run_dashboard"`
	EnginesDashboard string `json:"engine_dashboard"`
}

type ExecutorConfig

type ExecutorConfig struct {
	InCluster              bool                `json:"in_cluster"`
	Namespace              string              `json:"namespace"`
	Cluster                *ClusterConfig      `json:"cluster"`
	ImagePullSecret        string              `json:"pull_secret"`
	ImagePullPolicy        apiv1.PullPolicy    `json:"pull_policy"`
	JmeterContainer        *JmeterContainer    `json:"jmeter"`
	HostAliases            []*HostAlias        `json:"host_aliases,omitempty"`
	NodeAffinity           []map[string]string `json:"node_affinity"`
	Tolerations            []Toleration        `json:"tolerations"`
	MaxEnginesInCollection int                 `json:"max_engines_in_collection"`
}

type ExecutorContainer

type ExecutorContainer struct {
	Image string `json:"image"`
	CPU   string `json:"cpu"`
	Mem   string `json:"mem"`
}

type HostAlias

type HostAlias struct {
	Hostname string `json:"hostname"`
	IP       string `json:"IP"`
}

type HttpConfig

type HttpConfig struct {
	Proxy string `json:"proxy"`
}

type IngressConfig

type IngressConfig struct {
	Image    string `json:"image"`
	Replicas int32  `json:"replicas"`
	CPU      string `json:"cpu"`
	Mem      string `json:"mem"`

	//Ingress controllers should be kept longer than then engines
	Lifespan   string `json:"lifespan"`
	GCInterval string `json:"gc_period"`
}

type JmeterContainer

type JmeterContainer struct {
	*ExecutorContainer
}

type LdapConfig

type LdapConfig struct {
	BaseDN         string `json:"base_dn"`
	SystemUser     string `json:"system_user"`
	SystemPassword string `json:"system_password"`
	LdapServer     string `json:"ldap_server"`
	LdapPort       string `json:"ldap_port"`
}

type LogFormat

type LogFormat struct {
	Json     bool   `json:"json"`
	JsonPath string `json:"path"`
}

type MySQLConfig

type MySQLConfig struct {
	Host     string `json:"host"`
	User     string `json:"user"`
	Password string `json:"password"`
	Database string `json:"database"`
	Keypairs string `json:"keypairs"`
	Endpoint string
}

type ObjectStorage

type ObjectStorage struct {
	Provider     string `json:"provider"`
	Url          string `json:"url"`
	User         string `json:"user"`
	Password     string `json:"password"`
	Bucket       string `json:"bucket"`
	RequireProxy bool   `json:"require_proxy"`
}

type ShibuyaConfig

type ShibuyaConfig struct {
	ProjectHome      string           `json:"project_home"`
	UploadFileHelp   string           `json:"upload_file_help"`
	DBConf           *MySQLConfig     `json:"db"`
	ExecutorConfig   *ExecutorConfig  `json:"executors"`
	DashboardConfig  *DashboardConfig `json:"dashboard"`
	HttpConfig       *HttpConfig      `json:"http_config"`
	AuthConfig       *AuthConfig      `json:"auth_config"`
	ObjectStorage    *ObjectStorage   `json:"object_storage"`
	LogFormat        *LogFormat       `json:"log_format"`
	BackgroundColour string           `json:"bg_color"`
	IngressConfig    *IngressConfig   `json:"ingress"`
	EnableSid        bool             `json:"enable_sid"`

	// below are configs generated from above values
	DevMode         bool
	Context         string
	HTTPClient      *http.Client
	HTTPProxyClient *http.Client
	DBC             *sql.DB
	DBEndpoint      string
}
var SC *ShibuyaConfig

type Toleration

type Toleration struct {
	Key    string            `json:"key"`
	Value  string            `json:"value"`
	Effect apiv1.TaintEffect `json:"effect"`
}

Jump to

Keyboard shortcuts

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