promclient

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

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
}

Client is a minimal HTTP client for the Prometheus query API.

func NewClient

func NewClient(baseURL string, timeout time.Duration) *Client

NewClient creates a new Client. If timeout is 0 or negative, defaultTimeout (30s) is used.

func (*Client) QueryRange

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

QueryRange executes a range query against the Prometheus HTTP API v1. step must be >= 1µs and end must be after start.

type QueryRangeResponse

type QueryRangeResponse struct {
	Status string `json:"status"`
	Data   struct {
		ResultType string         `json:"resultType"`
		Result     []SeriesResult `json:"result"`
	} `json:"data"`
}

QueryRangeResponse is the top-level response from the Prometheus /api/v1/query_range endpoint.

type SeriesResult

type SeriesResult struct {
	Metric map[string]string `json:"metric"`
	// Values contains [timestamp, value] pairs where timestamp is a float64
	// and value is a string-encoded float.
	Values [][2]any `json:"values"`
}

SeriesResult holds one time series from a matrix query result.

Jump to

Keyboard shortcuts

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