bkmonitor

package
v0.0.0-...-c91c74a Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package bkmonitor bk_monitor query

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFirstValue

func GetFirstValue(series []*Series) string

GetFirstValue 获取第一个值

func GetMetricsSeries

func GetMetricsSeries(ctx context.Context, host, clusterID, bizID string) ([]*prompb.TimeSeries, error)

GetMetricsSeries 获取 metrics series 列表

func IsBKMonitorEnabled

func IsBKMonitorEnabled(clusterID string) bool

IsBKMonitorEnabled 集群是否接入到蓝鲸监控

func QueryByPromQL

func QueryByPromQL(ctx context.Context, rawURL, bkBizID string, start, end, step int64,
	labelMatchers []storepb.LabelMatcher, rawPromql string) ([]*prompb.TimeSeries, error)

QueryByPromQL unifyquery 查询, promql 语法 start, end, step 单位秒

func QueryMultiValues

func QueryMultiValues(ctx context.Context, rawURL, bkBizID string, start int64, promqlMap map[string]string,
	params map[string]interface{}) (map[string]string, error)

QueryMultiValues unifyquery 查询, promql 语法

Types

type BKUnifyQueryResult

type BKUnifyQueryResult struct {
	Series []*Series `json:"series"`
}

BKUnifyQueryResult 蓝鲸监控UnifyQuery返回结果

func QueryByPromQLRaw

func QueryByPromQLRaw(ctx context.Context, rawURL, bkBizID string, start, end, step int64,
	labelMatchers []storepb.LabelMatcher, rawPromql string) (*BKUnifyQueryResult, error)

QueryByPromQLRaw unifyquery 查询, promql 语法

func (*BKUnifyQueryResult) ToPromSeriesSet

func (r *BKUnifyQueryResult) ToPromSeriesSet() ([]*prompb.TimeSeries, error)

ToPromSeriesSet 转换为 prom 时序

type BaseResponse

type BaseResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Result  bool   `json:"result"`
}

BaseResponse base response

type MetricLabel

type MetricLabel struct {
	Key   string `json:"field_name"`
	Value string `json:"type"`
}

MetricLabel metrics label

type MetricList

type MetricList struct {
	Metric string        `json:"field_name"`
	Labels []MetricLabel `json:"dimensions"`
}

MetricList metrics list

func GetMetricsList

func GetMetricsList(ctx context.Context, host, clusterID, bizID string) ([]MetricList, error)

GetMetricsList 获取 metrics 列表

type MetricListSlice

type MetricListSlice []MetricList

MetricListSlice metrics list slice

func (MetricListSlice) ToSeries

func (m MetricListSlice) ToSeries() []*prompb.TimeSeries

ToSeries trans metrics to series

type MetricsListResult

type MetricsListResult struct {
	BaseResponse
	Data []MetricList `json:"data"`
}

MetricsListResult metrics 列表

type Sample

type Sample struct {
	Timestamp int64   `json:"timestamp"`
	Value     float64 `json:"value"`
}

Sample 返回的点

func (Sample) MarshalJSON

func (s Sample) MarshalJSON() ([]byte, error)

MarshalJSON 序列化interface

func (*Sample) UnmarshalJSON

func (s *Sample) UnmarshalJSON(b []byte) error

UnmarshalJSON 反序列化interface

type Series

type Series struct {
	Name        string    `json:"name"`
	Columns     []string  `json:"columns"`
	Types       []string  `json:"types"`
	GroupKeys   []string  `json:"group_keys"`
	GroupValues []string  `json:"group_values"`
	Values      []*Sample `json:"values"`
}

Series 蓝鲸监控返回数据

func (*Series) ToPromSeries

func (s *Series) ToPromSeries() (*prompb.TimeSeries, error)

ToPromSeries 转换为 prom 时序

Jump to

Keyboard shortcuts

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