Documentation
¶
Overview ¶
Package prometheus provides a client for Prometheus.
Index ¶
- type Client
- func (p *Client) Metadata(ctx context.Context, metric string) (*MetadataResponse, error)
- func (p *Client) Proxy(ctx context.Context, w http.ResponseWriter, r *http.Request, target string) error
- func (p *Client) Query(ctx context.Context, query string, time time.Time) (*QueryResponse, error)
- func (p *Client) QueryRange(ctx context.Context, query string, start, end time.Time, step time.Duration) (*QueryRangeResponse, error)
- func (p *Client) Series(ctx context.Context, start, end time.Time, match []string) (*SeriesResponse, error)
- type MetadataResponse
- type MetadataResponseData
- type MetadataResponseDataItem
- type QueryRangeResponse
- type QueryRangeResponseData
- type QueryRangeResponseDataResultItem
- type QueryRangeValues
- type QueryResponse
- type QueryResponseData
- type QueryResponseDataResultItem
- type QueryResponseValue
- type ResultType
- type SeriesResponse
- type SeriesResponseData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(c datasource.MetricConfig) *Client
func (*Client) QueryRange ¶
type MetadataResponse ¶
type MetadataResponse struct {
Status string `json:"status"`
Data *MetadataResponseData `json:"data"`
}
func (*MetadataResponse) Error ¶
func (m *MetadataResponse) Error() string
type MetadataResponseData ¶
type MetadataResponseData map[string][]*MetadataResponseDataItem
type QueryRangeResponse ¶
type QueryRangeResponse struct {
Status string `json:"status"`
Data *QueryRangeResponseData `json:"data"`
}
func (*QueryRangeResponse) Error ¶
func (q *QueryRangeResponse) Error() string
type QueryRangeResponseData ¶
type QueryRangeResponseData struct {
ResultType ResultType `json:"resultType"`
Result []*QueryRangeResponseDataResultItem `json:"result"`
}
type QueryRangeResponseDataResultItem ¶
type QueryRangeResponseDataResultItem struct {
Metric SeriesResponseData `json:"metric"`
Values QueryRangeValues `json:"values"`
}
type QueryRangeValues ¶
type QueryRangeValues []QueryResponseValue
type QueryResponse ¶
type QueryResponse struct {
Status string `json:"status"`
Data *QueryResponseData `json:"data"`
}
func (*QueryResponse) Error ¶
func (q *QueryResponse) Error() string
type QueryResponseData ¶
type QueryResponseData struct {
ResultType ResultType `json:"resultType"`
Result []*QueryResponseDataResultItem `json:"result"`
}
type QueryResponseDataResultItem ¶
type QueryResponseDataResultItem struct {
Metric SeriesResponseData `json:"metric"`
Value QueryResponseValue `json:"value"`
}
type QueryResponseValue ¶
type QueryResponseValue []any
func (QueryResponseValue) Timestamp ¶
func (q QueryResponseValue) Timestamp() float64
func (QueryResponseValue) Value ¶
func (q QueryResponseValue) Value() float64
type ResultType ¶
type ResultType string
const ( ResultTypeMatrix ResultType = "matrix" ResultTypeVector ResultType = "vector" )
type SeriesResponse ¶
type SeriesResponse struct {
Status string `json:"status"`
Data []*SeriesResponseData `json:"data"`
}
func (*SeriesResponse) Error ¶
func (s *SeriesResponse) Error() string
type SeriesResponseData ¶
func (*SeriesResponseData) Labels ¶
func (s *SeriesResponseData) Labels() map[string]string
func (*SeriesResponseData) Name ¶
func (s *SeriesResponseData) Name() string
Click to show internal directories.
Click to hide internal directories.