Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Address string `json:"address"` Username string `json:"username"` Password string `json:"password"` Token string `json:"token"` }
Config is the structure of the configuration for a single Prometheus instance.
type Datum ¶
Datum is the structure of a single data point of a metric. The y value must be a pointer, because when the value is NaN we can not set the value (NaN in the JSON representation will throw an error). For that NaN values will always be null.
type Instance ¶
type Instance interface { GetName() string GetVariable(ctx context.Context, label, query, queryType string, timeStart, timeEnd int64) ([]string, error) GetMetrics(ctx context.Context, queries []Query, resolution string, timeStart, timeEnd int64) (*Metrics, error) GetTableData(ctx context.Context, queries []Query, timeEnd int64) (map[string]map[string]string, error) GetLabelValues(ctx context.Context, searchTerm string) ([]string, error) }
Instance is the interface for a single Prometheus instance, which can be added via the configuration file.
type Metric ¶
type Metric struct { ID string `json:"id"` Label string `json:"label"` Min float64 `json:"min"` Max float64 `json:"max"` Avg float64 `json:"avg"` Data []Datum `json:"data"` }
Metric is the response format for a single metric. Each metric must have an ID and label. We also add the min, max and average for the returned data.
type Metrics ¶
type Metrics struct { StartTime int64 `json:"startTime"` EndTime int64 `json:"endTime"` Min float64 `json:"min"` Max float64 `json:"max"` Metrics []Metric `json:"metrics"` }
Metrics is the structure for the returned metrics from the Prometheus metrics API endpoint. It contains a list of metrics, the start and end time for the query and the min and max value accross all time series.