metrics

package
v0.0.0-...-9250c3b Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLoaderContext

func NewLoaderContext(ctx context.Context, client promclient.QueryClient, log logrus.FieldLogger) context.Context

NewLoaderContext creates a new context with the metrics loaders

Types

type MetricLabel

type MetricLabel struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

MetricLabel represents a key-value pair for a Prometheus label.

type MetricSeries

type MetricSeries struct {
	Labels []*MetricLabel `json:"labels"`
	Values []*MetricValue `json:"values"`
}

MetricSeries represents a time series with its labels and data points.

type MetricValue

type MetricValue struct {
	Timestamp time.Time `json:"timestamp"`
	Value     float64   `json:"value"`
}

MetricValue represents a single data point in a time series.

type MetricsQueryInput

type MetricsQueryInput struct {
	Query string             `json:"query"`
	Time  *time.Time         `json:"time,omitempty"`
	Range *MetricsRangeInput `json:"range,omitempty"`
}

MetricsQueryInput represents the input for querying Prometheus metrics.

type MetricsQueryResult

type MetricsQueryResult struct {
	Series   []*MetricSeries `json:"series"`
	Warnings []string        `json:"warnings,omitempty"`
}

MetricsQueryResult represents the result from a Prometheus metrics query.

func Query

func Query(ctx context.Context, input MetricsQueryInput, environmentName string) (*MetricsQueryResult, error)

Query executes a Prometheus query based on the input

type MetricsRangeInput

type MetricsRangeInput struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
	Step  int       `json:"step"`
}

MetricsRangeInput represents the input for Prometheus range queries.

Jump to

Keyboard shortcuts

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