bigquerydb

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CoreColumns = []string{"value", "metricname", "timestamp", "tags"}

CoreColumns are the column names every row always carries. Promoted columns may never use these names, so a promoted key can never shadow a core field.

Functions

This section is empty.

Types

type BigqueryClient

type BigqueryClient struct {
	// contains filtered or unexported fields
}

BigqueryClient allows sending batches of Prometheus samples to Bigquery.

func NewClient

func NewClient(logger *slog.Logger, googleAPIjsonkeypath, googleProjectID, googleAPIdatasetID, googleAPItableID string, remoteTimeout time.Duration, opts ...ClientOption) *BigqueryClient

NewClient creates a new Client.

func (*BigqueryClient) Collect

func (c *BigqueryClient) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*BigqueryClient) Describe

func (c *BigqueryClient) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector.

func (BigqueryClient) Name

func (c BigqueryClient) Name() string

Name identifies the client as a BigQuery client.

func (*BigqueryClient) Read added in v0.2.0

Read queries the database and returns the results to Prometheus

func (*BigqueryClient) Write

func (c *BigqueryClient) Write(timeseries []*prompb.TimeSeries) error

Write sends a batch of samples to BigQuery via the client.

type ClientOption added in v0.10.0

type ClientOption func(*BigqueryClient)

ClientOption customizes a BigqueryClient. Options are variadic so that the existing NewClient signature stays source-compatible for current callers.

func WithPromotedLabels added in v0.10.0

func WithPromotedLabels(cols []PromotedColumn) ClientOption

WithPromotedLabels configures labels to be promoted into their own columns.

type Item

type Item struct {
	// contains filtered or unexported fields
}

Item represents a row item.

func (*Item) Save

func (i *Item) Save() (map[string]bigquery.Value, string, error)

Save implements the ValueSaver interface.

type PromotedColumn added in v0.10.0

type PromotedColumn struct {
	Column    string
	Label     string
	StripPort bool
	OmitEmpty bool
}

PromotedColumn maps a Prometheus label onto a dedicated top-level BigQuery column. StripPort removes a trailing :port from the value. OmitEmpty drops the key entirely when the label is absent, so the column is stored as NULL; without it the column is written on every row (empty string when the label is absent) so that a REQUIRED column can never be violated.

Jump to

Keyboard shortcuts

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