cratedb

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 14 Imported by: 11

README

CrateDB Output Plugin

This plugin writes to CrateDB via its PostgreSQL protocol.

Table Schema

The plugin requires a table with the following schema.

CREATE TABLE IF NOT EXISTS my_metrics (
  "hash_id" LONG INDEX OFF,
  "timestamp" TIMESTAMP,
  "name" STRING,
  "tags" OBJECT(DYNAMIC),
  "fields" OBJECT(DYNAMIC),
  "day" TIMESTAMP GENERATED ALWAYS AS date_trunc('day', "timestamp"),
  PRIMARY KEY ("timestamp", "hash_id","day")
) PARTITIONED BY("day");

The plugin can create this table for you automatically via the table_create config option, see below.

Global configuration options

In addition to the plugin-specific configuration settings, plugins support additional global and plugin configuration settings. These settings are used to modify metrics, tags, and field or create aliases and configure ordering, etc. See the CONFIGURATION.md for more details.

Configuration

# Configuration for CrateDB to send metrics to.
[[outputs.cratedb]]
  # A github.com/jackc/pgx/v4 connection string.
  # See https://pkg.go.dev/github.com/jackc/pgx/v4#ParseConfig
  url = "postgres://user:password@localhost/schema?sslmode=disable"
  # Timeout for all CrateDB queries.
  timeout = "5s"
  # Name of the table to store metrics in.
  table = "metrics"
  # If true, and the metrics table does not exist, create it automatically.
  table_create = true
  # The character(s) to replace any '.' in an object key with
  key_separator = "_"

Documentation

Index

Constants

View Source
const MaxInt64 = int64(^uint64(0) >> 1)

Variables

This section is empty.

Functions

This section is empty.

Types

type CrateDB

type CrateDB struct {
	URL          string
	Timeout      config.Duration
	Table        string
	TableCreate  bool   `toml:"table_create"`
	KeySeparator string `toml:"key_separator"`
	DB           *sql.DB
}

func (*CrateDB) Close

func (c *CrateDB) Close() error

func (*CrateDB) Connect

func (c *CrateDB) Connect() error

func (*CrateDB) SampleConfig

func (*CrateDB) SampleConfig() string

func (*CrateDB) Write

func (c *CrateDB) Write(metrics []telegraf.Metric) error

Jump to

Keyboard shortcuts

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