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.
Click to show internal directories.
Click to hide internal directories.