config

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: Apache-2.0 Imports: 8 Imported by: 27

Documentation

Index

Constants

View Source
const (
	V3ioConfigEnvironmentVariable = "V3IO_TSDB_CONFIG"
	DefaultConfigurationFileName  = "v3io-tsdb-config.yaml"
	SchemaConfigFileName          = ".schema"

	DefaultShardingBucketsCount          = 8
	DefaultStorageClass                  = "local"
	DefaultIngestionRate                 = ""
	DefaultAggregates                    = "" // no aggregates by default
	DefaultAggregationGranularity        = "1h"
	DefaultLayerRetentionTime            = "1y"
	DefaultSampleRetentionTime           = 0
	DefaultLogLevel                      = "info"
	DefaultVerboseLevel                  = "debug"
	DefaultUseServerAggregateCoefficient = 3

	// KV attribute names
	MaxTimeAttrName         = "_maxtime"
	LabelSetAttrName        = "_lset"
	EncodingAttrName        = "_enc"
	OutOfOrderAttrName      = "_ooo"
	MetricNameAttrName      = "_name"
	ObjectNameAttrName      = "__name"
	ChunkAttrPrefix         = "_v"
	AggregateAttrPrefix     = "_v_"
	MtimeSecsAttributeName  = "__mtime_secs"
	MtimeNSecsAttributeName = "__mtime_nsecs"

	PrometheusMetricNameAttribute = "__name__"

	NamesDirectory = "names"

	MetricCacheSize = 131072
)

Variables

View Source
var (
	BuildMetadta = &BuildInfo{
		BuildTime:    buildTime,
		Os:           osys,
		Architecture: architecture,
		Version:      version,
		CommitHash:   commitHash,
		Branch:       branch,
	}
)

Functions

func Error added in v0.0.12

func Error() error

func UpdateConfig added in v0.9.0

func UpdateConfig(path string)

Eagerly reloads TSDB configuration. Note: not thread-safe

Types

type BuildInfo added in v0.8.3

type BuildInfo struct {
	BuildTime    string `json:"buildTime,omitempty"`
	Os           string `json:"os,omitempty"`
	Architecture string `json:"architecture,omitempty"`
	Version      string `json:"version,omitempty"`
	CommitHash   string `json:"commitHash,omitempty"`
	Branch       string `json:"branch,omitempty"`
}

func (*BuildInfo) String added in v0.8.3

func (bi *BuildInfo) String() string

type MetricConfig

type MetricConfig struct {
	Rollups       string `json:"rollups,omitempty"`
	RollupMin     int    `json:"rollupMin,omitempty"`
	DelRawSamples bool   `json:"delRawSamples,omitempty"`
	// Dimensions to pre aggregate (vertical aggregation)
	PreAggragate []string `json:"preAggragate,omitempty"`
}

type MetricsReporterConfig added in v0.0.12

type MetricsReporterConfig struct {
	// Report on shutdown (Boolean)
	ReportOnShutdown bool `json:"reportOnShutdown,omitempty"`
	// Output destination - "stdout" or "stderr"
	Output string `json:"output"`
	// Report periodically (Boolean)
	ReportPeriodically bool `json:"reportPeriodically,omitempty"`
	// Interval between consequence reports (in seconds)
	RepotInterval int `json:"reportInterval"`
}

type Partition added in v0.0.3

type Partition struct {
	StartTime int64 `json:"startTime"`
}

type PartitionSchema added in v0.0.3

type PartitionSchema struct {
	Version                int      `json:"version"`
	Aggregates             []string `json:"aggregates"`
	AggregationGranularity string   `json:"aggregationGranularity"`
	StorageClass           string   `json:"storageClass"`
	SampleRetention        int      `json:"sampleRetention"`
	PartitionerInterval    string   `json:"partitionerInterval"`
	ChunckerInterval       string   `json:"chunckerInterval"`
}

type PreAggregate added in v0.8.5

type PreAggregate struct {
	Labels      []string `json:"labels"`
	Granularity string   `json:"granularity"`
	Aggregates  []string `json:"aggregates"`
}

type Rollup added in v0.0.3

type Rollup struct {
	Aggregates             []string `json:"aggregates"`
	AggregationGranularity string   `json:"aggregationGranularity"`
	// Storage class for the aggregates and sample chunks - "cloud" | "local"
	StorageClass string `json:"storageClass"`
	// [FUTURE] Sample retention period, in hours. 0 means no need to save samples.
	SampleRetention int `json:"sampleRetention"`
	// Layer retention time, in months ('m'), days ('d'), or hours ('h').
	// Format: "[0-9]+[hmd]". For example: "3h", "7d", "1m"
	LayerRetentionTime string `json:"layerRetentionTime"`
}

type Schema added in v0.0.3

type Schema struct {
	TableSchemaInfo     TableSchema     `json:"tableSchemaInfo"`
	PartitionSchemaInfo PartitionSchema `json:"partitionSchemaInfo"`
	Partitions          []*Partition    `json:"partitions"`
	Fields              []SchemaField   `json:"fields"`
}

type SchemaField added in v0.0.3

type SchemaField struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Nullable bool   `json:"nullable"`
	Items    string `json:"items,omitempty"`
}

type TableSchema added in v0.0.3

type TableSchema struct {
	Version              int            `json:"version"`
	RollupLayers         []Rollup       `json:"rollupLayers"`
	ShardingBucketsCount int            `json:"shardingBucketsCount"`
	PartitionerInterval  string         `json:"partitionerInterval"`
	ChunckerInterval     string         `json:"chunckerInterval"`
	PreAggregates        []PreAggregate `json:"preAggregates"`
}

type V3ioConfig

type V3ioConfig struct {
	// V3IO TSDB connection information - web-gateway service endpoint,
	// TSDB data container, relative TSDB table path within the container, and
	// authentication credentials for the web-gateway service
	WebAPIEndpoint string `json:"webApiEndpoint"`
	Container      string `json:"container"`
	TablePath      string `json:"tablePath"`
	Username       string `json:"username,omitempty"`
	Password       string `json:"password,omitempty"`
	AccessKey      string `json:"accessKey,omitempty"`

	HTTPTimeout string `json:"httpTimeout,omitempty"`

	// Disabled = true disables the V3IO TSDB configuration in Prometheus and
	// enables the internal Prometheus TSDB instead
	Disabled bool `json:"disabled,omitempty"`
	// Log level - "debug" | "info" | "warn" | "error"
	LogLevel string `json:"logLevel,omitempty"`
	// Number of parallel V3IO worker routines
	Workers int `json:"workers"`
	// Number of parallel V3IO worker routines for queries;
	// default = the minimum value between 8 and Workers
	QryWorkers int `json:"qryWorkers"`
	// Override last chunk; by default, an append from the last point is attempted upon restart
	OverrideOld bool `json:"overrideOld"`
	// Default timeout duration, in seconds; default = 3,600 seconds (1 hour)
	DefaultTimeoutInSeconds int `json:"timeout,omitempty"`
	// Size of the samples batch to use during ingestion
	BatchSize int `json:"batchSize,omitempty"`
	// Maximum sample size, in bytes (for the worst compression scenario)
	MaximumSampleSize int `json:"maximumSampleSize,omitempty"`
	// Maximum size of a partition object
	MaximumPartitionSize int `json:"maximumPartitionSize,omitempty"`
	// Minimum chunk size, in bytes (for the best compression scenario)
	MinimumChunkSize int `json:"minimumChunkSize,omitempty"`
	// Maximum chunk size, in bytes (for the worst compression scenario)
	MaximumChunkSize int `json:"maximumChunkSize,omitempty"`
	// Number of sharding buckets
	ShardingBucketsCount int `json:"shardingBucketsCount,omitempty"`
	// Metrics-reporter configuration
	MetricsReporter MetricsReporterConfig `json:"performance,omitempty"`
	// Don't aggregate from raw chunks, for use when working as a Prometheus
	// TSDB library
	DisableClientAggr bool `json:"disableClientAggr,omitempty"`
	// Build Info
	BuildInfo *BuildInfo `json:"buildInfo,omitempty"`
	// Override nginx bug
	DisableNginxMitigation *bool `json:"disableNginxMitigation,omitempty"`
	// explicitly always use client aggregation
	UsePreciseAggregations bool `json:"usePreciseAggregations,omitempty"`
	// Coefficient to decide whether or not to use server aggregates optimization
	// use server aggregations if ` <requested step> / <rollup interval>  >  UseServerAggregateCoefficient`
	UseServerAggregateCoefficient int `json:"useServerAggregateCoefficient,omitempty"`
	RequestChanLength             int `json:"RequestChanLength,omitempty"`
	MetricCacheSize               int `json:"MetricCacheSize,omitempty"`
}

func GetOrDefaultConfig added in v0.0.12

func GetOrDefaultConfig() (*V3ioConfig, error)

func GetOrLoadFromData added in v0.0.12

func GetOrLoadFromData(data []byte) (*V3ioConfig, error)

func GetOrLoadFromFile added in v0.0.12

func GetOrLoadFromFile(path string) (*V3ioConfig, error)

func GetOrLoadFromStruct added in v0.0.12

func GetOrLoadFromStruct(cfg *V3ioConfig) (*V3ioConfig, error)

Update the defaults when using a configuration structure

func WithDefaults added in v0.8.2

func WithDefaults(cfg *V3ioConfig) *V3ioConfig

Update the defaults when using an existing configuration structure (custom configuration)

func (*V3ioConfig) Merge added in v0.8.2

func (config *V3ioConfig) Merge(newCfg *V3ioConfig) (*V3ioConfig, error)

Create new configuration structure instance based on given instance. All matching attributes within result structure will be overwritten with values of newCfg

func (V3ioConfig) String added in v0.8.9

func (config V3ioConfig) String() string

Jump to

Keyboard shortcuts

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