utils

package
v1.40.4 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 9 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldListToJSON

func FieldListToJSON(fieldList []*telegraf.Field) ([]byte, error)

func FullTableName

func FullTableName(schema, name string) pgx.Identifier

FullTableName returns a sanitized table name with its schema (if supplied)

func GetTagID

func GetTagID(metric telegraf.Metric) int64

func QuoteIdentifier

func QuoteIdentifier(name string) string

QuoteIdentifier returns a sanitized string safe to use in SQL as an identifier

func QuoteLiteral

func QuoteLiteral(name string) string

QuoteLiteral returns a sanitized string safe to use in sql as a string literal

func TagListToJSON

func TagListToJSON(tagList []*telegraf.Tag) []byte

Types

type Column

type Column struct {
	Name string
	// the data type of each column should have in the db. used when checking
	// if the schema matches or it needs updates
	Type string
	// the role each column has, helps properly map the metric to the db
	Role ColumnRole
}

type ColumnList

type ColumnList []Column

ColumnList implements sort.Interface. Columns are sorted first into groups of time,tag_id,tags,fields, and then alphabetically within each group.

func (ColumnList) Len

func (cl ColumnList) Len() int

func (ColumnList) Less

func (cl ColumnList) Less(i, j int) bool

func (ColumnList) Sort

func (cl ColumnList) Sort()

func (ColumnList) Swap

func (cl ColumnList) Swap(i, j int)

type ColumnRole

type ColumnRole int

ColumnRole specifies the role of a column in a metric. It helps map the columns to the DB.

const (
	TimeColType ColumnRole = iota + 1
	TagsIDColType
	TagColType
	FieldColType
)

type PGXLogger

type PGXLogger struct {
	telegraf.Logger
}

PGXLogger makes telegraf.Logger compatible with pgx.Logger

func (PGXLogger) Log

func (l PGXLogger) Log(_ context.Context, level tracelog.LogLevel, msg string, data map[string]any)

type WaitGroup

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

WaitGroup is similar to sync.WaitGroup, but allows interruptible waiting (e.g. a timeout).

func NewWaitGroup

func NewWaitGroup() *WaitGroup

func (*WaitGroup) Add

func (wg *WaitGroup) Add(i int32)

func (*WaitGroup) C

func (wg *WaitGroup) C() <-chan struct{}

func (*WaitGroup) Done

func (wg *WaitGroup) Done()

Jump to

Keyboard shortcuts

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