Documentation
¶
Overview ¶
Package suanlicpu implements the store node API on top of the Prometheus remote read API.
Index ¶
- Variables
- type Config
- type SeriesQuery
- type Store
- func (p *Store) FetchAndSendGPU(ctx context.Context, r *storepb.SeriesRequest, s storepb.Store_SeriesServer, ...) error
- func (p *Store) FetchAndSendGPUSeries(ctx context.Context, r *storepb.SeriesRequest, s storepb.Store_SeriesServer) error
- func (p *Store) FetchAndSendPromSeries(ctx context.Context, r *storepb.SeriesRequest, s storepb.Store_SeriesServer) error
- func (p *Store) GetSeriesQueryList(ctx context.Context, r *storepb.SeriesRequest) ([]*SeriesQuery, error)
- func (p *Store) MakeNamespaceMatcher(ctx context.Context) (*storepb.LabelMatcher, error)
- func (p *Store) QueryRangeInGRPC(ctx context.Context, base *url.URL, matchers []storepb.LabelMatcher, ...) (model.Matrix, []string, error)
- func (p *Store) Series(r *storepb.SeriesRequest, s storepb.Store_SeriesServer) error
Constants ¶
This section is empty.
Variables ¶
var IgnoreGPULabels = map[string]string{
"cluster_id": "",
"cluster_display_name": "",
"pod_type": "",
"namespace": "",
"pod_name": "",
"vm_id": "",
}
IgnoreGPULabels 需要过滤的 labels
var MetricNames = []string{
"k8s_container_bs_fs_write_times",
"k8s_container_bs_fs_read_times",
"k8s_container_bs_fs_write_bytes",
"k8s_container_bs_fs_read_bytes",
"k8s_container_bs_network_transmit_packets",
"k8s_container_bs_network_receive_packets",
"k8s_container_bs_network_transmit_bytes_bw",
"k8s_container_bs_network_receive_bytes_bw",
"k8s_container_bs_mem_no_cache_bytes",
"k8s_container_bs_mem_usage_bytes",
"k8s_container_bs_cpu_core_used",
"k8s_container_bs_rate_mem_no_cache_request",
"k8s_container_bs_rate_mem_usage_request",
"k8s_container_bs_rate_cpu_core_used_request",
"k8s_container_bs_network_transmit_bit_bw",
"k8s_container_bs_network_receive_bit_bw",
"k8s_container_bs_network_transmit_packets_dropped_total",
"k8s_container_bs_network_receive_packets_dropped_total",
}
MetricNames 可选的 metrics
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Name string `yaml:"name"` URL string `yaml:"url"` ClusterID string `yaml:"cluster_id"` // 对应的集群 ExtNamespaces []string `yaml:"ext_namespaces,omitempty"` // 额外的namespaces 对应算力实际的namespace }
Config 配置
type SeriesQuery ¶
type SeriesQuery struct {
// contains filtered or unexported fields
}
SeriesQuery series query
type Store ¶
type Store struct { staticmetrics.StaticMetricsStore // contains filtered or unexported fields }
Store implements the store node API on top of the Prometheus remote read API.
func NewSuanLiCPUStore ¶
func NewSuanLiCPUStore(reg *prometheus.Registry, conf []byte) (*Store, error)
NewSuanLiCPUStore returns a new SuanLiCPUStore that uses the given HTTP client to talk to Prometheus. It attaches the provided external labels to all results.
func (*Store) FetchAndSendGPU ¶
func (p *Store) FetchAndSendGPU(ctx context.Context, r *storepb.SeriesRequest, s storepb.Store_SeriesServer, query *SeriesQuery) error
FetchAndSendGPU 单个数据查询
func (*Store) FetchAndSendGPUSeries ¶
func (p *Store) FetchAndSendGPUSeries(ctx context.Context, r *storepb.SeriesRequest, s storepb.Store_SeriesServer) error
FetchAndSendGPUSeries 并发数据查询
func (*Store) FetchAndSendPromSeries ¶
func (p *Store) FetchAndSendPromSeries(ctx context.Context, r *storepb.SeriesRequest, s storepb.Store_SeriesServer) error
FetchAndSendPromSeries 算力原始数据
func (*Store) GetSeriesQueryList ¶
func (p *Store) GetSeriesQueryList(ctx context.Context, r *storepb.SeriesRequest) ([]*SeriesQuery, error)
GetSeriesQueryList get series query list
func (*Store) MakeNamespaceMatcher ¶
MakeNamespaceMatcher 把集群namspace转换为label match规则
func (*Store) QueryRangeInGRPC ¶
func (p *Store) QueryRangeInGRPC(ctx context.Context, base *url.URL, matchers []storepb.LabelMatcher, queryTime *clientutil.PromQueryTime) (model.Matrix, []string, error)
QueryRangeInGRPC query range in grpc
func (*Store) Series ¶
func (p *Store) Series(r *storepb.SeriesRequest, s storepb.Store_SeriesServer) error
Series returns all series for a requested time range and label matcher.