collector

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppTemplateExternalIDPrefix = "catalog://?"
	AppCatalogLibrary           = "library"
	AppCatalogSystemLibrary     = "system-library"
)
View Source
const (
	TELEMETRY_UID_SETTING      = "telemetry-uid"
	SERVER_VERSION_SETTING     = "server-version"
	UI_DEFAULT_LANDING_SETTING = "ui-default-landing"
	UI_LANDING_EXPLORER        = "vue"
	UI_LANDING_MANAGER         = "ember"
	UI_LANDING_DEFAULT         = UI_LANDING_MANAGER
)

Variables

View Source
var (
	AppRancherCatalogs  = []string{AppCatalogLibrary, AppCatalogSystemLibrary}
	AppGetProjectClient = GetProjectClient
)
View Source
var (
	ClusterClients          = map[string]*rancherCluster.Client{}
	ProjectClients          = map[string]*rancherProject.Client{}
	NewRancherClusterClient = rancherCluster.NewClient
	NewRancherProjectClient = rancherProject.NewClient
)
View Source
var (
	ClusterGetClusterClient = GetClusterClient
	ClusterGetProjectClient = GetProjectClient
)
View Source
var (
	ProjectGetClusterClient = GetClusterClient
	ProjectGetProjectClient = GetProjectClient
)

Functions

func Average

func Average(x []float64) float64

func Clamp

func Clamp(min, x, max int) int

func FromCatalog

func FromCatalog(s string) bool

func GetAppCatalogState added in v0.5.12

func GetAppCatalogState(c *CollectorOpts, id string) (string, error)

func GetCPU added in v0.5.12

func GetCPU(item string) int

func GetClusterClient added in v0.5.12

func GetClusterClient(c *CollectorOpts, id string) (*rancherCluster.Client, error)

func GetMem

func GetMem(item, unit string) int64

func GetMemMb

func GetMemMb(item string) int

func GetProjectClient added in v0.5.12

func GetProjectClient(c *CollectorOpts, id string) (*rancherProject.Client, error)

func GetRawInt

func GetRawInt(item, sep string) int

func GetRawInt64

func GetRawInt64(item, sep string) int64

func GetTelemetryUid added in v0.5.12

func GetTelemetryUid(c *CollectorOpts) (string, bool)

func IsNotFound added in v0.5.12

func IsNotFound(err error) bool

func Max

func Max(x, y int) int

func Min

func Min(x, y int) int

func MinButNotZero

func MinButNotZero(x, y int) int

func NonRemoved

func NonRemoved() norman.ListOpts

func Register

func Register(c Collector)

func Round

func Round(f float64) int

func Run

func Run(record *record.Record, opt *CollectorOpts)

func SetSetting

func SetSetting(client *rancher.Client, key string, value string) error

func SplitAppExternalID added in v0.5.12

func SplitAppExternalID(externalID string) (map[string]string, error)

func SplitExternalID added in v0.5.8

func SplitExternalID(externalID string) (string, string, string, error)

func SplitMultiClusterAppExternalID added in v0.5.12

func SplitMultiClusterAppExternalID(externalID string) (map[string]string, error)

Types

type App added in v0.5.12

type App struct {
	Total    int                     `json:"total"`
	Active   int                     `json:"active"`
	Catalogs map[string]*AppTemplate `json:"rancheCatalogs"`
}

func (App) Collect added in v0.5.12

func (a App) Collect(c *CollectorOpts) interface{}

func (App) RecordKey added in v0.5.12

func (a App) RecordKey() string

type AppTemplate added in v0.5.12

type AppTemplate struct {
	State string                 `json:"state"`
	Apps  map[string]*LabelCount `json:"apps"`
}

type Cluster

type Cluster struct {
	Active           int         `json:"active"`
	Total            int         `json:"total"`
	Ns               *NsInfo     `json:"namespace"`
	Cpu              *CpuInfo    `json:"cpu"`
	Mem              *MemoryInfo `json:"mem"`
	Pod              *PodInfo    `json:"pod"`
	Driver           LabelCount  `json:"driver"`
	IstioTotal       int         `json:"istio"`
	MonitoringTotal  int         `json:"monitoring"`
	LogProviderCount LabelCount  `json:"logging"`
	CloudProvider    LabelCount  `json:"cloudProvider"`
}

func (Cluster) Collect

func (h Cluster) Collect(c *CollectorOpts) interface{}

func (Cluster) RecordKey

func (h Cluster) RecordKey() string

type ClusterTemplate added in v0.5.7

type ClusterTemplate struct {
	TotalClusterTemplates  int    `json:"total"`
	TotalTemplateRevisions int    `json:"revisions"`
	Enforcement            string `json:"enforcement"`
}

func (ClusterTemplate) Collect added in v0.5.7

func (ct ClusterTemplate) Collect(c *CollectorOpts) interface{}

func (ClusterTemplate) RecordKey added in v0.5.7

func (ct ClusterTemplate) RecordKey() string

type Collector

type Collector interface {
	RecordKey() string
	Collect(opt *CollectorOpts) interface{}
}

type CollectorOpts

type CollectorOpts struct {
	Client *rancher.Client
}

type CpuInfo

type CpuInfo struct {
	CoresMin   int `json:"cores_min"`
	CoresMax   int `json:"cores_max"`
	CoresTotal int `json:"cores_total"`
	UtilMin    int `json:"util_min"`
	UtilAvg    int `json:"util_avg"`
	UtilMax    int `json:"util_max"`
}

func (*CpuInfo) Update

func (c *CpuInfo) Update(total, util int)

func (*CpuInfo) UpdateAvg

func (c *CpuInfo) UpdateAvg(i []float64)

type HPAInfo added in v0.5.7

type HPAInfo struct {
	Min   int `json:"min"`
	Max   int `json:"max"`
	Total int `json:"total"`
	Avg   int `json:"avg"`
}

func (*HPAInfo) Update added in v0.5.7

func (h *HPAInfo) Update(i int)

func (*HPAInfo) UpdateAvg added in v0.5.7

func (h *HPAInfo) UpdateAvg(i []float64)

type Installation

type Installation struct {
	Uid                  string     `json:"uid"`
	Version              string     `json:"version"`
	UiLanding            string     `json:"uiLanding"`
	AuthConfig           LabelCount `json:"auth"`
	Users                LabelCount `json:"users"`
	KontainerDriverCount int        `json:"kontainerDriverCount"`
	KontainerDrivers     LabelCount `json:"kontainerDrivers"`
	NodeDriverCount      int        `json:"nodeDriverCount"`
	NodeDrivers          LabelCount `json:"nodeDrivers"`
	HasInternal          bool       `json:"hasInternal"`
}

func (Installation) Collect

func (i Installation) Collect(c *CollectorOpts) interface{}

func (*Installation) GetUILanding added in v0.5.13

func (i *Installation) GetUILanding(c *CollectorOpts)

func (*Installation) GetUid

func (i *Installation) GetUid(c *CollectorOpts)

func (*Installation) GetVersion added in v0.5.12

func (i *Installation) GetVersion(c *CollectorOpts)

func (Installation) RecordKey

func (i Installation) RecordKey() string

type LabelCount

type LabelCount map[string]int

func (*LabelCount) Increment

func (m *LabelCount) Increment(k string)

type MemoryInfo

type MemoryInfo struct {
	MinMb   int `json:"mb_min"`
	MaxMb   int `json:"mb_max"`
	TotalMb int `json:"mb_total"`
	UtilMin int `json:"util_min"`
	UtilAvg int `json:"util_avg"`
	UtilMax int `json:"util_max"`
}

func (*MemoryInfo) Update

func (m *MemoryInfo) Update(total, util int)

func (*MemoryInfo) UpdateAvg

func (m *MemoryInfo) UpdateAvg(i []float64)

type MultiClusterApp added in v0.5.5

type MultiClusterApp struct {
	Total        int                     `json:"total"`
	Active       int                     `json:"active"`
	TargetMin    int                     `json:"targetMin"`
	TargetMax    int                     `json:"targetMax"`
	TargetAvg    float64                 `json:"targetAvg"`
	TargetTotal  int                     `json:"targetTotal"`
	DnsProviders int                     `json:"dnsProviders"`
	DnsEntries   int                     `json:"dnsEntries"`
	Catalogs     map[string]*AppTemplate `json:"rancheCatalogs"`
}

func (MultiClusterApp) Collect added in v0.5.5

func (mca MultiClusterApp) Collect(c *CollectorOpts) interface{}

func (MultiClusterApp) RecordKey added in v0.5.5

func (mca MultiClusterApp) RecordKey() string

type Node

type Node struct {
	Active    int        `json:"active"`
	Imported  int        `json:"imported"`
	FromTmpl  int        `json:"from_template"`
	Total     int        `json:"total"`
	Cpu       CpuInfo    `json:"cpu"`
	Mem       MemoryInfo `json:"mem"`
	Pod       PodInfo    `json:"pod"`
	Kernel    LabelCount `json:"kernel"`
	Kubelet   LabelCount `json:"kubelet"`
	Kubeproxy LabelCount `json:"kubeproxy"`
	Os        LabelCount `json:"os"`
	Docker    LabelCount `json:"docker"`
	Driver    LabelCount `json:"driver"`
	Role      LabelCount `json:"role"`
}

func (Node) Collect

func (h Node) Collect(c *CollectorOpts) interface{}

func (Node) RecordKey

func (m Node) RecordKey() string

type NsInfo

type NsInfo struct {
	NsMin       int `json:"min"`
	NsMax       int `json:"max"`
	NsTotal     int `json:"total"`
	NsAvg       int `json:"avg"`
	FromCatalog int `json:"from_catalog,omitempty"`
	NoProject   int `json:"no_project,omitempty"`
}

func (*NsInfo) Update

func (n *NsInfo) Update(i int)

func (*NsInfo) UpdateAvg

func (n *NsInfo) UpdateAvg(i []float64)

func (*NsInfo) UpdateDetails

func (n *NsInfo) UpdateDetails(nsc []rancher.Namespace)

type PipelineInfo added in v0.5.7

type PipelineInfo struct {
	Enabled        int        `json:"enabled"` // 1 if user has any # pipeline provider enabled
	SourceProvider LabelCount `json:"source"`
	TotalPipelines int        `json:"total"`
}

type PodData

type PodData struct {
	PodMin   int `json:"min"`
	PodMax   int `json:"max"`
	PodTotal int `json:"total"`
	PodAvg   int `json:"avg"`
}

func (*PodData) Update

func (w *PodData) Update(i int)

func (*PodData) UpdateAvg

func (w *PodData) UpdateAvg(i []float64)

type PodInfo

type PodInfo struct {
	PodsMin   int `json:"pods_min"`
	PodsMax   int `json:"pods_max"`
	PodsTotal int `json:"pods_total"`
	UtilMin   int `json:"util_min"`
	UtilAvg   int `json:"util_avg"`
	UtilMax   int `json:"util_max"`
}

func (*PodInfo) Update

func (p *PodInfo) Update(total, util int)

func (*PodInfo) UpdateAvg

func (p *PodInfo) UpdateAvg(i []float64)

type Project

type Project struct {
	Total         int          `json:"total"`
	Ns            NsInfo       `json:"namespace"`
	Workload      WorkloadInfo `json:"workload"`
	Pipeline      PipelineInfo `json:"pipeline"`
	LibraryCharts LabelCount   `json:"charts"`
	HPA           HPAInfo      `json:"hpa"`
	Pod           PodData      `json:"pod"`
	Orchestration LabelCount   `json:"orch"`
}

func (Project) Collect

func (p Project) Collect(c *CollectorOpts) interface{}

func (Project) RecordKey

func (p Project) RecordKey() string

type WorkloadInfo

type WorkloadInfo struct {
	WorkloadMin   int `json:"min"`
	WorkloadMax   int `json:"max"`
	WorkloadTotal int `json:"total"`
	WorkloadAvg   int `json:"avg"`
}

func (*WorkloadInfo) Update

func (w *WorkloadInfo) Update(i int)

func (*WorkloadInfo) UpdateAvg

func (w *WorkloadInfo) UpdateAvg(i []float64)

Jump to

Keyboard shortcuts

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