bigquery

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: MIT Imports: 12 Imported by: 0

README

Google BigQuery Output Plugin

This plugin writes to the Google Cloud BigQuery and requires authentication with Google Cloud using either a service account or user credentials.

Be aware that this plugin accesses APIs that are chargeable and might incur costs.

Configuration
[[outputs.bigquery]]
  ## GCP Project
  project = "erudite-bloom-151019"

  ## The BigQuery dataset
  dataset = "telegraf"

  ## Timeout for BigQuery operations.
  # timeout = "5s"

  ## Character to replace hyphens on Metric name
  # replace_hyphen_to = "_"

Requires project to specify where BigQuery entries will be persisted.

Requires dataset to specify under which BigQuery dataset the corresponding metrics tables reside.

Each metric should have a corresponding table to BigQuery. The schema of the table on BigQuery:

  • Should contain the field timestamp which is the timestamp of a telegraph metrics
  • Should contain the metric's tags with the same name and the column type should be set to string.
  • Should contain the metric's fields with the same name and the column type should match the field type.
Restrictions

Avoid hyphens on BigQuery tables, underlying SDK cannot handle streaming inserts to Table with hyphens.

In cases of metrics with hyphens please use the Rename Processor Plugin.

In case of a metric with hyphen by default hyphens shall be replaced with underscores (_). This can be altered using the replace_hyphen_to configuration property.

Available data type options are:

  • integer
  • float or long
  • string
  • boolean

All field naming restrictions that apply to BigQuery should apply to the measurements to be imported.

Tables on BigQuery should be created beforehand and they are not created during persistence

Pay attention to the column timestamp since it is reserved upfront and cannot change. If partitioning is required make sure it is applied beforehand.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BigQuery

type BigQuery struct {
	CredentialsFile string `toml:"credentials_file"`
	Project         string `toml:"project"`
	Dataset         string `toml:"dataset"`

	Timeout         config.Duration `toml:"timeout"`
	ReplaceHyphenTo string          `toml:"replace_hyphen_to"`

	Log telegraf.Logger `toml:"-"`
	// contains filtered or unexported fields
}

func (*BigQuery) Close

func (s *BigQuery) Close() error

Close will terminate the session to the backend, returning error if an issue arises.

func (*BigQuery) Connect

func (s *BigQuery) Connect() error

func (*BigQuery) Description

func (s *BigQuery) Description() string

Description returns the human-readable function definition of the plugin.

func (*BigQuery) SampleConfig

func (s *BigQuery) SampleConfig() string

SampleConfig returns the formatted sample configuration for the plugin.

func (*BigQuery) Write

func (s *BigQuery) Write(metrics []telegraf.Metric) error

Write the metrics to Google Cloud BigQuery.

Jump to

Keyboard shortcuts

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