Documentation ¶
Index ¶
- func NewPrometheusDatasource(opts ...Option) agent.Datasource
- type Data
- type MetadataResponse
- type MetricInfo
- type MetricLabel
- type MetricSeriesResponse
- type Option
- type PrometheusDatasource
- func (p *PrometheusDatasource) GetBasicAuth() *agent.BasicAuth
- func (p *PrometheusDatasource) GetCategory() agent.Category
- func (p *PrometheusDatasource) GetEndpoint() string
- func (p *PrometheusDatasource) IsReady() bool
- func (p *PrometheusDatasource) Metadata(ctx context.Context) (*agent.Metadata, error)
- func (p *PrometheusDatasource) Query(ctx context.Context, expr string, duration int64) (*agent.QueryResponse, error)
- func (p *PrometheusDatasource) WithBasicAuth(basicAuth *agent.BasicAuth) agent.Datasource
- type QueryResponse
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPrometheusDatasource ¶
func NewPrometheusDatasource(opts ...Option) agent.Datasource
NewPrometheusDatasource 创建 prometheus 数据源
Types ¶
type MetadataResponse ¶
type MetadataResponse struct { Status string `json:"status"` Data map[string][]MetricInfo `json:"data"` }
func (*MetadataResponse) GetData ¶
func (m *MetadataResponse) GetData() map[string][]MetricInfo
func (*MetadataResponse) GetMetricInfo ¶
func (m *MetadataResponse) GetMetricInfo(metric string) []MetricInfo
func (*MetadataResponse) GetStatus ¶
func (m *MetadataResponse) GetStatus() string
type MetricInfo ¶
type MetricInfo struct { Type string `json:"type"` Help string `json:"help"` Unit string `json:"unit"` }
func (*MetricInfo) GetHelp ¶
func (m *MetricInfo) GetHelp() string
func (*MetricInfo) GetType ¶
func (m *MetricInfo) GetType() string
func (*MetricInfo) GetUnit ¶
func (m *MetricInfo) GetUnit() string
type MetricLabel ¶
func (MetricLabel) GetMetricName ¶
func (m MetricLabel) GetMetricName() string
GetMetricName get metric name
type MetricSeriesResponse ¶
type MetricSeriesResponse struct { Status string `json:"status"` Data []MetricLabel `json:"data"` Error string `json:"error"` ErrorType string `json:"errorType"` }
func (*MetricSeriesResponse) GetData ¶
func (m *MetricSeriesResponse) GetData() []MetricLabel
GetData get data
type Option ¶
type Option func(*PrometheusDatasource)
func WithBasicAuth ¶
WithBasicAuth set basic auth
type PrometheusDatasource ¶
type PrometheusDatasource struct {
// contains filtered or unexported fields
}
PrometheusDatasource 数据源模型定义
func (*PrometheusDatasource) GetBasicAuth ¶
func (p *PrometheusDatasource) GetBasicAuth() *agent.BasicAuth
func (*PrometheusDatasource) GetCategory ¶
func (p *PrometheusDatasource) GetCategory() agent.Category
GetCategory 获取数据源类型
func (*PrometheusDatasource) GetEndpoint ¶
func (p *PrometheusDatasource) GetEndpoint() string
func (*PrometheusDatasource) Query ¶
func (p *PrometheusDatasource) Query(ctx context.Context, expr string, duration int64) (*agent.QueryResponse, error)
Query 实现数据源查询接口
func (*PrometheusDatasource) WithBasicAuth ¶
func (p *PrometheusDatasource) WithBasicAuth(basicAuth *agent.BasicAuth) agent.Datasource
type QueryResponse ¶
type QueryResponse struct { Status string `json:"status"` Data *Data `json:"data"` ErrorType string `json:"errorType"` Error string `json:"error"` }
func (*QueryResponse) GetErrorType ¶
func (r *QueryResponse) GetErrorType() string
GetErrorType get error type
Click to show internal directories.
Click to hide internal directories.