prom

package
v0.0.0-...-22d48cd Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPrometheusAPIClient

func NewPrometheusAPIClient(logger logrus.FieldLogger, cfg PrometheusImporterConfig) (v1.API, error)

NewPrometheusAPIClient is a helper function responsible for setting up an API client to the Prometheus instance at the @address URL.

Types

type PrometheusImporterConfig

type PrometheusImporterConfig struct {
	Hostname            string
	Address             *url.URL
	BearerToken         string
	BearerTokenFile     string
	SkipTLSVerification bool
}

PrometheusImporterConfig is holds the configuration needed to establish a connection to Prometheus to import metrics into Postgres.

type PrometheusMetric

type PrometheusMetric struct {
	Labels    map[string]string `json:"labels"`
	Amount    float64           `json:"amount"`
	StepSize  time.Duration     `json:"stepSize"`
	Timestamp time.Time         `json:"timestamp"`
	Dt        string            `json:"dt"`
}

PrometheusMetric is a receipt of a usage determined by a query within a specific time range.

func ExecPromQuery

func ExecPromQuery(ctx context.Context, logger logrus.FieldLogger, apiClient v1.API, query string) ([]*PrometheusMetric, error)

ExecPromQuery is responsible for firing off a promQL query to the query_range Prometheus API endpoint and returning an initialized list of the PrometheusMetric type based on the matrix the promQL had returned.

Jump to

Keyboard shortcuts

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