transform

package
v0.0.0-...-621658c Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVWriter

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

func NewCSVWriter

func NewCSVWriter(w *bytes.Buffer, columns []string) *CSVWriter

NewCSVWriter returns a new CSVWriter that writes to the given buffer. The columns, if specified, are label keys that will be promoted to columns.

func (*CSVWriter) Bytes

func (w *CSVWriter) Bytes() []byte

func (*CSVWriter) InitColumns

func (w *CSVWriter) InitColumns(columns []string)

InitColumns initializes the labels that will be promoted to columns in the CSV file. This can be done once on the *Writer and subsequent calls are no-ops.

func (*CSVWriter) MarshalLog

func (w *CSVWriter) MarshalLog(logs *otlp.Logs) error

func (*CSVWriter) Reset

func (w *CSVWriter) Reset()

type Field

type Field struct {
	Name   string
	Type   string
	Source string
}

Field defines a label or attribute that is lifted to a column.

type Fields

type Fields []Field

type MetricsCSVWriter

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

func NewMetricsCSVWriter

func NewMetricsCSVWriter(w *bytes.Buffer, lifted Fields) *MetricsCSVWriter

NewMetricsCSVWriter returns a new CSVWriter that writes to the given buffer. The columns, if specified, are label keys that will be promoted to columns.

func NewMetricsCSVWriterWithSchema

func NewMetricsCSVWriterWithSchema(w *bytes.Buffer, lifted Fields, mapping schema.SchemaMapping) *MetricsCSVWriter

NewMetricsCSVWriter returns a new CSVWriter that writes to the given buffer. The columns, if specified, are label keys that will be promoted to columns.

func (*MetricsCSVWriter) Bytes

func (w *MetricsCSVWriter) Bytes() []byte

func (*MetricsCSVWriter) InitColumns

func (w *MetricsCSVWriter) InitColumns(columns []string)

InitColumns initializes the labels that will be promoted to columns in the CSV file. This can be done once on the *Writer and subsequent calls are no-ops.

func (*MetricsCSVWriter) MarshalCSV

func (w *MetricsCSVWriter) MarshalCSV(ts *prompb.TimeSeries) error

func (*MetricsCSVWriter) Reset

func (w *MetricsCSVWriter) Reset()

func (*MetricsCSVWriter) SchemaHash

func (w *MetricsCSVWriter) SchemaHash() uint64

type NativeLogsCSVWriter

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

func NewCSVNativeLogsCSVWriter

func NewCSVNativeLogsCSVWriter(w *bytes.Buffer, columns []string) *NativeLogsCSVWriter

NewCSVNativeLogsCSVWriter returns a new CSVWriter that writes to the given buffer. The columns, if specified, are label keys that will be promoted to columns.

func NewCSVNativeLogsCSVWriterWithSchema

func NewCSVNativeLogsCSVWriterWithSchema(w *bytes.Buffer, columns []string, mapping schema.SchemaMapping) *NativeLogsCSVWriter

NewCSVNativeLogsCSVWriterWithSchema returns a new CSVWriter that writes to the given buffer. The columns, if specified, are label keys that will be promoted to columns.

func (*NativeLogsCSVWriter) Bytes

func (w *NativeLogsCSVWriter) Bytes() []byte

func (*NativeLogsCSVWriter) InitColumns

func (w *NativeLogsCSVWriter) InitColumns(columns []string)

InitColumns initializes the labels that will be promoted to columns in the CSV file. This can be done once on the *Writer and subsequent calls are no-ops.

func (*NativeLogsCSVWriter) MarshalNativeLog

func (w *NativeLogsCSVWriter) MarshalNativeLog(log *types.Log) error

func (*NativeLogsCSVWriter) Reset

func (w *NativeLogsCSVWriter) Reset()

func (*NativeLogsCSVWriter) SchemaHash

func (w *NativeLogsCSVWriter) SchemaHash() uint64

type RequestTransformer

type RequestTransformer struct {
	// DefaultDropMetrics is a flag that indicates whether metrics should be dropped by default unless they match
	// a keep rule.
	DefaultDropMetrics bool

	// KeepMetrics is a slice of regexes that keeps metrics when the metric name matches.  A metric matching a
	// Keep rule will not be dropped even if it matches a drop rule.
	KeepMetrics []*regexp.Regexp

	// KeepMetricsWithLabelValue is a map of regexes of label names to regexes of label values.  When both match,
	// the metric will be kept.
	KeepMetricsWithLabelValue map[*regexp.Regexp]*regexp.Regexp

	// DropLabels is a map of metric names regexes to label name regexes.  When both match, the label will be dropped.
	DropLabels map[*regexp.Regexp]*regexp.Regexp

	// DropMetrics is a slice of regexes that drops metrics when the metric name matches.  The metric name format
	// should match the Prometheus naming style before the metric is translated to a Kusto table name.
	DropMetrics []*regexp.Regexp

	// AddLabels is a map of label names to label values that will be added to all metrics.
	AddLabels map[string]string

	// AllowedDatabase is a map of database names that are allowed to be written to.
	AllowedDatabase map[string]struct{}
	// contains filtered or unexported fields
}

func (*RequestTransformer) ShouldDropMetric

func (f *RequestTransformer) ShouldDropMetric(v *prompb.TimeSeries, name []byte) bool

func (*RequestTransformer) TransformTimeSeries

func (f *RequestTransformer) TransformTimeSeries(v *prompb.TimeSeries) *prompb.TimeSeries

func (*RequestTransformer) TransformWriteRequest

func (f *RequestTransformer) TransformWriteRequest(req *prompb.WriteRequest) *prompb.WriteRequest

Jump to

Keyboard shortcuts

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