persister

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

this is a parser for graphite's storage-schemas.conf it supports old and new retention format see https://graphite.readthedocs.io/en/0.9.9/config-carbon.html#storage-schemas-conf based on https://github.com/grobian/carbonwriter but with some improvements

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRetentionDefs

func ParseRetentionDefs(retentionDefs string) (whisper.Retentions, error)

ParseRetentionDefs parses retention definitions into a Retentions structure

Types

type Quota added in v0.16.0

type Quota struct {
	Pattern          string
	Namespaces       int64
	Metrics          int64
	LogicalSize      int64
	PhysicalSize     int64
	DataPoints       int64
	Throughput       int64
	DroppingPolicy   string
	StatMetricPrefix string
}

Quota represents one quota setting.

type Schema added in v0.7.2

type Schema struct {
	Name         string
	Pattern      *regexp.Regexp
	RetentionStr string
	Retentions   whisper.Retentions
	Priority     int64
	Compressed   *bool

	// If not specified, migration flag is controlled by the global
	// migration flag set in persister.Whisper
	Migration *bool
}

Schema represents one schema setting

type StoreFunc added in v0.8.0

type StoreFunc func(metric string)

type Whisper

type Whisper struct {
	helper.Stoppable
	// contains filtered or unexported fields
}

Whisper write data to *.wsp files

func NewWhisper

func NewWhisper(
	rootPath string,
	schemas WhisperSchemas,
	aggregation *WhisperAggregation,
	recv func(chan bool) string,
	pop func(string) (*points.Points, bool),
	confirm func(*points.Points),
	popConfirm func(string) (*points.Points, bool)) *Whisper

func (*Whisper) CheckPolicyConsistencies added in v0.17.0

func (p *Whisper) CheckPolicyConsistencies(rate int, printInconsistentMetrics bool) error

skipcq: RVV-A0005

func (*Whisper) EnableOnlineMigration added in v0.17.0

func (p *Whisper) EnableOnlineMigration(rate int, scope []string)

SetOnlineMigration enable online migration

func (*Whisper) GetAggrConf added in v0.15.0

func (p *Whisper) GetAggrConf(metric string) (string, float64, bool)

func (*Whisper) GetRetentionPeriod added in v0.15.0

func (p *Whisper) GetRetentionPeriod(metric string) (int, bool)

func (*Whisper) InitPrometheus added in v0.17.0

func (p *Whisper) InitPrometheus(reg prometheus.Registerer)

func (*Whisper) SetCompressed added in v0.15.0

func (p *Whisper) SetCompressed(compressed bool)

func (*Whisper) SetFLock added in v0.12.0

func (p *Whisper) SetFLock(flock bool)

SetFLock on create and open

func (*Whisper) SetHashFilenames added in v0.12.0

func (p *Whisper) SetHashFilenames(v bool)

func (*Whisper) SetMaxUpdatesPerSecond added in v0.4.3

func (p *Whisper) SetMaxUpdatesPerSecond(maxUpdatesPerSecond int)

SetMaxUpdatesPerSecond

func (*Whisper) SetMockStore added in v0.8.0

func (p *Whisper) SetMockStore(fn func() (StoreFunc, func()))

func (*Whisper) SetRemoveEmptyFile added in v0.15.0

func (p *Whisper) SetRemoveEmptyFile(remove bool)

func (*Whisper) SetSparse added in v0.7.2

func (p *Whisper) SetSparse(sparse bool)

SetSparse creation

func (*Whisper) SetTaggedFn added in v0.14.0

func (p *Whisper) SetTaggedFn(fn func(string, bool))

func (*Whisper) SetTagsEnabled added in v0.12.0

func (p *Whisper) SetTagsEnabled(v bool)

func (*Whisper) SetWorkers

func (p *Whisper) SetWorkers(count int)

SetWorkers count

func (*Whisper) Start

func (p *Whisper) Start() error

Start worker

func (*Whisper) Stat

func (p *Whisper) Stat(send helper.StatCallback)

Stat callback

func (*Whisper) Stop

func (p *Whisper) Stop()

type WhisperAggregation

type WhisperAggregation struct {
	Data    []*WhisperAggregationItem
	Default *WhisperAggregationItem
}

WhisperAggregation ...

func NewWhisperAggregation

func NewWhisperAggregation() *WhisperAggregation

NewWhisperAggregation create instance of WhisperAggregation

func ReadWhisperAggregation

func ReadWhisperAggregation(filename string) (*WhisperAggregation, error)

ReadWhisperAggregation ...

func (*WhisperAggregation) Match added in v0.15.0

Match find schema for metric

type WhisperAggregationItem added in v0.15.0

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

WhisperAggregationItem ...

func (*WhisperAggregationItem) AggregationMethod added in v0.15.0

func (wai *WhisperAggregationItem) AggregationMethod() whisper.AggregationMethod

AggregationMethod get aggregation method

func (*WhisperAggregationItem) Name added in v0.15.0

func (wai *WhisperAggregationItem) Name() string

Name get name of aggregation method

func (*WhisperAggregationItem) Pattern added in v0.15.0

func (wai *WhisperAggregationItem) Pattern() *regexp.Regexp

Pattern get aggregation pattern

func (*WhisperAggregationItem) XFilesFactor added in v0.15.0

func (wai *WhisperAggregationItem) XFilesFactor() float64

XFilesFactor get aggregation xFilesFactor

type WhisperQuotas added in v0.16.0

type WhisperQuotas []Quota

func ReadWhisperQuotas added in v0.16.0

func ReadWhisperQuotas(filename string) (WhisperQuotas, error)

ReadWhisperQuotas reads and parses a storage-quotas.conf file and returns the defined quotas.

type WhisperSchemas

type WhisperSchemas []Schema

WhisperSchemas contains schema settings

func ReadWhisperSchemas

func ReadWhisperSchemas(filename string) (WhisperSchemas, error)

ReadWhisperSchemas reads and parses a storage-schemas.conf file and returns a sorted schemas structure see https://graphite.readthedocs.io/en/0.9.9/config-carbon.html#storage-schemas-conf

func (WhisperSchemas) Len added in v0.7.2

func (s WhisperSchemas) Len() int

func (WhisperSchemas) Less added in v0.7.2

func (s WhisperSchemas) Less(i, j int) bool

func (WhisperSchemas) Match added in v0.7.2

func (s WhisperSchemas) Match(metric string) (Schema, bool)

Match finds the schema for metric or returns false if none found

func (WhisperSchemas) Swap added in v0.7.2

func (s WhisperSchemas) Swap(i, j int)

Jump to

Keyboard shortcuts

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