storage

package
v0.37.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationMetadataSaver added in v0.34.0

type ApplicationMetadataSaver interface {
	CreateOrUpdate(ctx context.Context, application appmetadata.ApplicationMetadata) error
}

ApplicationMetadataSaver saves application metadata

type BadgerDB added in v0.17.0

type BadgerDB interface {
	Update(func(txn *badger.Txn) error) error
	View(func(txn *badger.Txn) error) error
	NewWriteBatch() *badger.WriteBatch
	MaxBatchCount() int64
}

type BadgerDBWithCache added in v0.17.0

type BadgerDBWithCache interface {
	BadgerDB
	CacheLayer

	Size() bytesize.ByteSize
	CacheSize() uint64

	DBInstance() *badger.DB
	CacheInstance() *cache.Cache
	Name() string
}

type CacheLayer added in v0.17.0

type CacheLayer interface {
	Put(key string, val interface{})
	Evict(percent float64)
	WriteBack()
	Delete(key string) error
	Discard(key string)
	DiscardPrefix(prefix string) error
	GetOrCreate(key string) (interface{}, error)
	Lookup(key string) (interface{}, bool)
}

type Config added in v0.2.5

type Config struct {
	NewBadger func(name string, p Prefix, codec cache.Codec) (BadgerDBWithCache, error)
	// contains filtered or unexported fields
}

func NewConfig added in v0.2.5

func NewConfig(server *config.Server) *Config

NewConfig returns a new storage config from a server config

func (*Config) WithInMemory added in v0.3.0

func (c *Config) WithInMemory() *Config

WithInMemory makes the storage in-memory.

func (*Config) WithPath added in v0.2.5

func (c *Config) WithPath(path string) *Config

WithPath sets the storage base path

type DeleteInput added in v0.0.33

type DeleteInput struct {
	// Key must match exactly one segment.
	Key *segment.Key
}

type ExemplarsGetter added in v0.22.1

type ExemplarsGetter interface {
	GetExemplar(context.Context, GetExemplarInput) (GetExemplarOutput, error)
}

type ExemplarsMerger added in v0.22.1

type ExemplarsMerger interface {
	MergeExemplars(context.Context, MergeExemplarsInput) (MergeExemplarsOutput, error)
}

type ExemplarsQuerier added in v0.28.0

type ExemplarsQuerier interface {
	QueryExemplars(context.Context, QueryExemplarsInput) (QueryExemplarsOutput, error)
}

type ExemplarsSelection added in v0.29.0

type ExemplarsSelection struct {
	StartTime time.Time
	EndTime   time.Time
	MinValue  uint64
	MaxValue  uint64
}

type GetExemplarInput added in v0.22.1

type GetExemplarInput struct {
	StartTime time.Time
	EndTime   time.Time
	AppName   string
	ProfileID string
}

type GetExemplarOutput added in v0.22.1

type GetExemplarOutput struct {
	Tree      *tree.Tree
	Labels    map[string]string
	StartTime time.Time
	EndTime   time.Time
	Metadata  metadata.Metadata

	Telemetry map[string]interface{}
}

type GetInput added in v0.0.30

type GetInput struct {
	StartTime time.Time
	EndTime   time.Time
	Key       *segment.Key
	Query     *flameql.Query
	// TODO: make this a part of the query
	GroupBy string
}

type GetLabelKeysByQueryInput added in v0.17.0

type GetLabelKeysByQueryInput struct {
	StartTime time.Time
	EndTime   time.Time
	Query     string
}

type GetLabelKeysByQueryOutput added in v0.17.0

type GetLabelKeysByQueryOutput struct {
	Keys []string
}

type GetLabelValuesByQueryInput added in v0.17.0

type GetLabelValuesByQueryInput struct {
	StartTime time.Time
	EndTime   time.Time
	Label     string
	Query     string
}

type GetLabelValuesByQueryOutput added in v0.17.0

type GetLabelValuesByQueryOutput struct {
	Values []string
}

type GetOutput added in v0.0.30

type GetOutput struct {
	Tree     *tree.Tree
	Timeline *segment.Timeline
	Groups   map[string]*segment.Timeline
	Count    uint64

	// TODO: Replace with metadata.Metadata
	SpyName         string
	SampleRate      uint32
	Units           metadata.Units
	AggregationType metadata.AggregationType

	Telemetry map[string]interface{}
}

type Getter added in v0.14.0

type Getter interface {
	Get(context.Context, *GetInput) (*GetOutput, error)
}

type IngestionQueue added in v0.17.0

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

func NewIngestionQueue added in v0.17.0

func NewIngestionQueue(logger logrus.FieldLogger, putter Putter, r prometheus.Registerer, c *Config) *IngestionQueue

func (*IngestionQueue) Put added in v0.17.0

func (s *IngestionQueue) Put(ctx context.Context, input *PutInput) error

func (*IngestionQueue) Stop added in v0.17.0

func (s *IngestionQueue) Stop()

type LabelValuesGetter added in v0.14.0

type LabelValuesGetter interface {
	GetValues(ctx context.Context, key string, cb func(v string) bool)
	GetValuesByQuery(ctx context.Context, in GetLabelValuesByQueryInput) (GetLabelValuesByQueryOutput, error)
}

type LabelsGetter added in v0.14.0

type LabelsGetter interface {
	GetKeys(ctx context.Context, cb func(string) bool)
	GetKeysByQuery(ctx context.Context, in GetLabelKeysByQueryInput) (GetLabelKeysByQueryOutput, error)
}

type MergeExemplarsInput added in v0.22.1

type MergeExemplarsInput struct {
	AppName    string
	ProfileIDs []string
	StartTime  time.Time
	EndTime    time.Time

	// FIXME: Not implemented: parameters are ignored.
	ExemplarsSelection ExemplarsSelection
	HeatmapParams      heatmap.HeatmapParams
}

type MergeExemplarsOutput added in v0.22.1

type MergeExemplarsOutput struct {
	Tree          *tree.Tree
	Count         uint64
	Metadata      metadata.Metadata
	HeatmapSketch heatmap.HeatmapSketch // FIXME: Not implemented: the field is never populated.
	Telemetry     map[string]interface{}
}

type MetricsExporter added in v0.2.1

type MetricsExporter interface {
	// Evaluate evaluates metrics export rules against the input key and creates
	// prometheus counters for new time series, if required. Returned observer can
	// be used to evaluate and observe particular samples.
	//
	// If there are no matching rules, the function returns false.
	Evaluate(*PutInput) (SampleObserver, bool)
}

MetricsExporter exports values of particular stack traces sample from profiling data as a Prometheus metrics.

type NoopApplicationMetadataService added in v0.34.0

type NoopApplicationMetadataService struct{}

NoopApplicationMetadataService implements same methods as ApplicationMetadataService But it doesn't do anything when called

func (NoopApplicationMetadataService) CreateOrUpdate added in v0.34.0

func (NoopApplicationMetadataService) Delete added in v0.34.0

func (NoopApplicationMetadataService) Get added in v0.34.0

func (NoopApplicationMetadataService) List added in v0.34.0

type Prefix added in v0.17.0

type Prefix string

func (Prefix) String added in v0.17.0

func (p Prefix) String() string

type PutInput added in v0.0.30

type PutInput struct {
	StartTime       time.Time
	EndTime         time.Time
	Key             *segment.Key
	Val             *tree.Tree
	SpyName         string
	SampleRate      uint32
	Units           metadata.Units
	AggregationType metadata.AggregationType
}

type Putter added in v0.14.0

type Putter interface {
	Put(context.Context, *PutInput) error
}

type QueryExemplarsInput added in v0.28.0

type QueryExemplarsInput struct {
	Query     *flameql.Query
	StartTime time.Time
	EndTime   time.Time

	ExemplarsSelection ExemplarsSelection
	HeatmapParams      heatmap.HeatmapParams
}

type QueryExemplarsOutput added in v0.28.0

type QueryExemplarsOutput struct {
	Tree          *tree.Tree
	Count         uint64
	Metadata      metadata.Metadata
	HeatmapSketch heatmap.HeatmapSketch
	Telemetry     map[string]interface{}
}

type SampleObserver added in v0.2.1

type SampleObserver interface {
	// Observe adds v to the matched counters if k satisfies node selector.
	// k is a sample stack trace where frames are delimited by semicolon.
	// v is the sample value.
	Observe(k []byte, v int)
}

type Storage

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

func (*Storage) CacheStats added in v0.0.33

func (s *Storage) CacheStats() map[string]uint64

func (*Storage) Cleanup added in v0.12.0

func (s *Storage) Cleanup(ctx context.Context) error

Cleanup removes malformed data from the storage.

func (*Storage) Close

func (s *Storage) Close() error

func (*Storage) DebugExport added in v0.8.0

func (s *Storage) DebugExport(w http.ResponseWriter, r *http.Request)

func (*Storage) Delete added in v0.0.33

func (s *Storage) Delete(_ context.Context, di *DeleteInput) error

func (*Storage) DeleteApp added in v0.3.1

func (s *Storage) DeleteApp(_ context.Context, appname string) error

DeleteApp fully deletes an app It does so by deleting Segments, Dictionaries, Trees, Dimensions and Labels It's an idempotent call, ie. if the app already does not exist, no error is triggered. TODO cancelation?

func (*Storage) DictsInternals added in v0.16.0

func (s *Storage) DictsInternals() (*badger.DB, *cache.Cache)

func (*Storage) DimensionsInternals added in v0.16.0

func (s *Storage) DimensionsInternals() (*badger.DB, *cache.Cache)

func (*Storage) DiskUsage

func (s *Storage) DiskUsage() map[string]bytesize.ByteSize

func (*Storage) ExemplarsInternals added in v0.20.0

func (s *Storage) ExemplarsInternals() (*badger.DB, func())

func (*Storage) Get

func (s *Storage) Get(ctx context.Context, gi *GetInput) (*GetOutput, error)

func (*Storage) GetAppNames added in v0.3.0

func (s *Storage) GetAppNames(ctx context.Context) []string

GetAppNames returns the list of all app's names It works by querying the __name__ label

func (*Storage) GetExemplar added in v0.22.1

func (s *Storage) GetExemplar(ctx context.Context, gi GetExemplarInput) (out GetExemplarOutput, err error)

func (*Storage) GetKeys

func (s *Storage) GetKeys(_ context.Context, cb func(string) bool)

func (*Storage) GetKeysByQuery added in v0.0.38

func (*Storage) GetValues

func (s *Storage) GetValues(_ context.Context, key string, cb func(v string) bool)

func (*Storage) GetValuesByQuery added in v0.0.38

func (*Storage) InstallID

func (s *Storage) InstallID() string

func (*Storage) JWT added in v0.0.38

func (s *Storage) JWT() (string, error)

func (*Storage) LoadAnalytics added in v0.8.0

func (s *Storage) LoadAnalytics(a interface{}) error

func (*Storage) MainInternals added in v0.16.0

func (s *Storage) MainInternals() (*badger.DB, *cache.Cache)

func (*Storage) MergeExemplars added in v0.22.1

func (s *Storage) MergeExemplars(ctx context.Context, mi MergeExemplarsInput) (out MergeExemplarsOutput, err error)

func (*Storage) Put

func (s *Storage) Put(ctx context.Context, pi *PutInput) error

func (*Storage) QueryExemplars added in v0.28.0

func (*Storage) SaveAnalytics added in v0.8.0

func (s *Storage) SaveAnalytics(a interface{}) error

func (*Storage) SegmentsInternals added in v0.16.0

func (s *Storage) SegmentsInternals() (*badger.DB, *cache.Cache)

func (*Storage) TreesInternals added in v0.16.0

func (s *Storage) TreesInternals() (*badger.DB, *cache.Cache)

Directories

Path Synopsis
lfu

Jump to

Keyboard shortcuts

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