Documentation
¶
Index ¶
- type MetricsFilter
- type MetricsFilterSumBy
- type NodeMetrics
- type NodeMetricsFilter
- type PVCVolumeStats
- type PrometheusClient
- func (self *PrometheusClient) GetNodeMetrics(ctx context.Context, start time.Time, end time.Time, step time.Duration, ...) (map[string]*NodeMetrics, error)
- func (self *PrometheusClient) GetPVCsVolumeStats(ctx context.Context, pvcNames []string, namespace string, ...) ([]*PVCVolumeStats, error)
- func (self *PrometheusClient) GetResourceMetrics(ctx context.Context, sumBy MetricsFilterSumBy, start time.Time, end time.Time, ...) (map[string]*ResourceMetrics, error)
- func (self *PrometheusClient) GetVolumeStatsWithHistory(ctx context.Context, pvcName string, start time.Time, end time.Time, ...) (*VolumeStatsWithHistory, error)
- type ResourceMetrics
- type VolumeStatsWithHistory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetricsFilter ¶
type MetricsFilterSumBy ¶
type MetricsFilterSumBy string
const ( MetricsFilterSumByProject MetricsFilterSumBy = "project" MetricsFilterSumByEnvironment MetricsFilterSumBy = "environment" MetricsFilterSumByService MetricsFilterSumBy = "service" )
func (MetricsFilterSumBy) Label ¶
func (m MetricsFilterSumBy) Label() string
type NodeMetrics ¶
type NodeMetrics struct { CPU []model.SamplePair RAM []model.SamplePair Network []model.SamplePair Disk []model.SamplePair FileSystem []model.SamplePair Load []model.SamplePair }
type NodeMetricsFilter ¶
type NodeMetricsFilter struct {
NodeName []string
}
NodeMetricsFilter contains filtering options for node metrics
type PVCVolumeStats ¶
type PVCVolumeStats struct { PVCName string `json:"pvc_name"` UsedGB *float64 `json:"used_gb,omitempty"` CapacityGB float64 `json:"capacity_gb,omitempty"` }
PVCVolumeStats holds the used and capacity stats for a PVC.
type PrometheusClient ¶
type PrometheusClient struct {
// contains filtered or unexported fields
}
func NewPrometheusClient ¶
func NewPrometheusClient(cfg *config.Config) (*PrometheusClient, error)
func (*PrometheusClient) GetNodeMetrics ¶
func (self *PrometheusClient) GetNodeMetrics( ctx context.Context, start time.Time, end time.Time, step time.Duration, filter *NodeMetricsFilter, ) (map[string]*NodeMetrics, error)
Get metrics for specific nodes
func (*PrometheusClient) GetPVCsVolumeStats ¶
func (self *PrometheusClient) GetPVCsVolumeStats(ctx context.Context, pvcNames []string, namespace string, client *kubernetes.Clientset) ([]*PVCVolumeStats, error)
GetPVCsVolumeStats queries Prometheus for volume usage and gets all PVC info from Kubernetes. Returns stats for all requested PVCs from K8s, with UsedGB attached from Prometheus when available.
func (*PrometheusClient) GetResourceMetrics ¶
func (self *PrometheusClient) GetResourceMetrics( ctx context.Context, sumBy MetricsFilterSumBy, start time.Time, end time.Time, step time.Duration, filter *MetricsFilter, ) (map[string]*ResourceMetrics, error)
Get metrics for specific resources (team, project, environment, service)
func (*PrometheusClient) GetVolumeStatsWithHistory ¶
func (self *PrometheusClient) GetVolumeStatsWithHistory( ctx context.Context, pvcName string, start time.Time, end time.Time, step time.Duration, namespace string, client *kubernetes.Clientset, ) (*VolumeStatsWithHistory, error)
GetVolumeStatsWithHistory gets both current PVC stats and historical usage data for a specific volume. This is equivalent to the diskQuery but targeted at a specific volume by name.
type ResourceMetrics ¶
type ResourceMetrics struct { CPU []model.SamplePair RAM []model.SamplePair Network []model.SamplePair Disk []model.SamplePair }
type VolumeStatsWithHistory ¶
type VolumeStatsWithHistory struct { Stats *PVCVolumeStats `json:"stats"` History []model.SamplePair `json:"history"` }
VolumeStatsWithHistory combines current PVC stats with historical usage data.