prometheus

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package prometheus provides a client for Prometheus.

Index

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) Metadata

func (p *Client) Metadata(ctx context.Context, metric string) (*MetadataResponse, error)

func (*Client) Proxy

func (p *Client) Proxy(ctx context.Context, w http.ResponseWriter, r *http.Request, target string) error

func (*Client) Query

func (p *Client) Query(ctx context.Context, query string, time time.Time) (*QueryResponse, error)

func (*Client) QueryRange

func (p *Client) QueryRange(ctx context.Context, query string, start, end time.Time, step time.Duration) (*QueryRangeResponse, error)

func (*Client) Series

func (p *Client) Series(ctx context.Context, start, end time.Time, match []string) (*SeriesResponse, error)

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 MetadataResponseDataItem

type MetadataResponseDataItem struct {
	Help string `json:"help"`
	Unit string `json:"unit"`
	Type string `json:"type"`
}

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

type SeriesResponseData map[string]string

func (*SeriesResponseData) Labels

func (s *SeriesResponseData) Labels() map[string]string

func (*SeriesResponseData) Name

func (s *SeriesResponseData) Name() string

Jump to

Keyboard shortcuts

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