Documentation
¶
Overview ¶
Package fileexporter exports data to files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFactory ¶
NewFactory creates a factory for OTLP exporter.
Types ¶
type Config ¶
type Config struct {
// Path of the file to write to. Path is relative to current directory.
Path string `mapstructure:"path"`
// Mode defines whether the exporter should append to the file.
// Options:
// - false[default]: truncates the file
// - true: appends to the file.
Append bool `mapstructure:"append"`
// Rotation defines an option about rotation of telemetry files.
Rotation *Rotation `mapstructure:"rotation"`
// FormatType define the data format of encoded telemetry data
// Options:
// - json[default]: OTLP json bytes.
// - proto: OTLP binary protobuf bytes.
FormatType string `mapstructure:"format"`
// Encoding defines the encoding of the telemetry data.
// If specified, it overrides `FormatType` and applies an encoding extension.
Encoding *component.ID `mapstructure:"encoding"`
// Compression Codec used to export telemetry data
// Supported compression algorithms:`zstd`
Compression string `mapstructure:"compression"`
// FlushInterval is the duration between flushes.
// See time.ParseDuration for valid values.
FlushInterval time.Duration `mapstructure:"flush_interval"`
// GroupBy enables writing to separate files based on a resource attribute.
GroupBy *GroupBy `mapstructure:"group_by"`
// CreateDirectory specifies that the parent directory of the output file should be created automatically on start.
CreateDirectory bool `mapstructure:"create_directory"`
// DirectoryPermissions specifies permissions used when creating directories (minus process umask).
// Value must be an octal string like "0755".
DirectoryPermissions string `mapstructure:"directory_permissions"`
// contains filtered or unexported fields
}
Config defines configuration for file exporter.
type FileExporter ¶ added in v0.95.0
type GroupBy ¶ added in v0.97.0
type GroupBy struct {
// Enables group_by. Default is false.
Enabled bool `mapstructure:"enabled"`
// ResourceAttribute specifies the name of the resource attribute that
// contains the path segment of the file to write to. The final path will be
// the Path config value, with the * replaced with the value of this resource
// attribute. Default is "fileexporter.path_segment".
ResourceAttribute string `mapstructure:"resource_attribute"`
// MaxOpenFiles specifies the maximum number of open file descriptors for the output files.
// The default is 100.
MaxOpenFiles int `mapstructure:"max_open_files"`
}
type Rotation ¶ added in v0.60.0
type Rotation struct {
// MaxMegabytes is the maximum size in megabytes of the file before it gets
// rotated. It defaults to 100 megabytes.
MaxMegabytes int `mapstructure:"max_megabytes"`
// MaxDays is the maximum number of days to retain old log files based on the
// timestamp encoded in their filename. Note that a day is defined as 24
// hours and may not exactly correspond to calendar days due to daylight
// savings, leap seconds, etc. The default is not to remove old log files
// based on age.
MaxDays int `mapstructure:"max_days" `
// MaxBackups is the maximum number of old log files to retain. The default
// is to 100 files.
MaxBackups int `mapstructure:"max_backups" `
// LocalTime determines if the time used for formatting the timestamps in
// backup files is the computer's local time. The default is to use UTC
// time.
LocalTime bool `mapstructure:"localtime"`
}
Rotation an option to rolling log files
Source Files
¶
Click to show internal directories.
Click to hide internal directories.