localfile

package
v14.2.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: MIT Imports: 14 Imported by: 0

README

Local File Sink

The Local File Sink appends each flush as TSV data to a specified file on the local system. Since the file path is not parametrized with regards to date or time, the file with the TSV data should be rotated, processed, or removed to avoid problems with filling the disk.

Configuration

metric_sinks:
  - kind: localfile
    name: localfile
    config:
      # The file to flush metrics to
      flush_file: /path/to/file

The flush_file path must be writeable by Veneur, and if the file does not exist, Veneur will try to create it.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(
	server *veneur.Server, name string, logger *logrus.Entry,
	config veneur.Config, sinkConfig veneur.MetricSinkConfig,
) (sinks.MetricSink, error)

Create creates a new local file sink for metrics. This function should match the signature of a value in veneur.MetricSinkTypes, and is intended to be passed into veneur.NewFromConfig to be called based on the provided configuration.

func MigrateConfig

func MigrateConfig(config *veneur.Config)

TODO(arnavdugar): Remove this once the old configuration format has been removed.

func ParseConfig

func ParseConfig(
	name string, config interface{},
) (veneur.MetricSinkConfig, error)

ParseConfig decodes the map config for an local file sink into a LocalFileSinkConfig struct.

Types

type File

type File interface {
	Close() error
	Write(p []byte) (n int, err error)
}

type FileSystem

type FileSystem interface {
	OpenFile(name string, flag int, perm os.FileMode) (File, error)
}

type LocalFileSink

type LocalFileSink struct {
	Delimiter  rune
	FilePath   string
	FileSystem FileSystem

	Logger *logrus.Entry
	// contains filtered or unexported fields
}

LocalFileSink is the LocalFile plugin that we'll use in Veneur

func NewLocalFileSink

func NewLocalFileSink(
	config LocalFileSinkConfig, filesystem FileSystem, hostname string,
	logger *logrus.Entry, name string,
) *LocalFileSink

func (*LocalFileSink) Flush

func (sink *LocalFileSink) Flush(
	ctx context.Context, metrics []samplers.InterMetric,
) error

Flush the metrics from the LocalFilePlugin

func (*LocalFileSink) FlushOtherSamples

func (sink *LocalFileSink) FlushOtherSamples(
	ctx context.Context, samples []ssf.SSFSample,
)

func (*LocalFileSink) Name

func (sink *LocalFileSink) Name() string

Name is the name of the LocalFilePlugin, i.e., "localfile"

func (*LocalFileSink) Start

func (sink *LocalFileSink) Start(traceClient *trace.Client) error

type LocalFileSinkConfig

type LocalFileSinkConfig struct {
	Delimiter util.Rune `yaml:"delimiter"`
	FlushFile string    `yaml:"flush_file"`
}

Jump to

Keyboard shortcuts

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