sql

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Overview

Package sql implements the prometheus.Collector interface for bigquery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {

	// RegisterErr contains any error during registration. This should be considered fatal.
	RegisterErr error
	// contains filtered or unexported fields
}

Collector manages a prometheus.Collector for queries performed by a QueryRunner.

func NewCollector

func NewCollector(runner QueryRunner, valType prometheus.ValueType, metricName, query string) *Collector

NewCollector creates a new BigQuery Collector instance.

func (*Collector) Collect

func (col *Collector) Collect(ch chan<- prometheus.Metric)

Collect satisfies the prometheus.Collector interface. Collect reports values from cached metrics.

func (*Collector) Describe

func (col *Collector) Describe(ch chan<- *prometheus.Desc)

Describe satisfies the prometheus.Collector interface. Describe is called immediately after registering the collector.

func (*Collector) String

func (col *Collector) String() string

String satisfies the Stringer interface. String returns the metric name.

func (*Collector) Update

func (col *Collector) Update() error

Update runs the collector query and atomically updates the cached metrics. Update is called automaticlly after the collector is registered.

type Metric

type Metric struct {
	LabelKeys   []string
	LabelValues []string
	Values      map[string]float64
}

Metric holds raw data from query results needed to create a prometheus.Metric.

func NewMetric

func NewMetric(labelKeys []string, labelValues []string, values map[string]float64) Metric

NewMetric creates a Metric with given values.

type QueryRunner

type QueryRunner interface {
	Query(q string) ([]Metric, error)
}

QueryRunner defines the interface used to run a query and return an array of metrics.

Jump to

Keyboard shortcuts

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