observability

package
v5.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIncompatibleSegmentStorage = errors.New("supplied segment storage doesn't report errors")

ErrIncompatibleSegmentStorage is returned when the supplied storage that not have the required methods

View Source
var ErrIncompatibleSplitStorage = errors.New("supplied split storage doesn't report errors")

ErrIncompatibleSplitStorage is returned when the supplied storage that not have the required methods

Functions

This section is empty.

Types

type ActiveSegmentTracker

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

ActiveSegmentTracker accepts updates and keeps track of segment names & cardinality

func NewActiveSegmentTracker

func NewActiveSegmentTracker(initialSize int) *ActiveSegmentTracker

NewActiveSegmentTracker constructs a new segment tracker

func (*ActiveSegmentTracker) NamesAndCount

func (t *ActiveSegmentTracker) NamesAndCount() map[string]int

NamesAndCount returns a map of segment names to key count

func (*ActiveSegmentTracker) Update

func (t *ActiveSegmentTracker) Update(name string, added int, removed int)

Update the segment name/key-count cache

type ObservableSegmentStorage

type ObservableSegmentStorage interface {
	storage.SegmentStorage
	NamesAndCount() map[string]int
}

ObservableSegmentStorage builds on top of the SegmentStorage interface adding some observability methods

type ObservableSegmentStorageImpl

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

ObservableSegmentStorageImpl is an implementation of the ObservableSegmentStorage interface

func NewObservableSegmentStorage

func NewObservableSegmentStorage(
	logger logging.LoggerInterface,
	splitStorage storage.SplitStorage,
	toWrap storage.SegmentStorage,
) (*ObservableSegmentStorageImpl, error)

NewObservableSegmentStorage constructs and observable segment storage

func (*ObservableSegmentStorageImpl) NamesAndCount

func (s *ObservableSegmentStorageImpl) NamesAndCount() map[string]int

NamesAndCount returns a map of segment names with the number of keys

func (*ObservableSegmentStorageImpl) Update

func (s *ObservableSegmentStorageImpl) Update(name string, toAdd *set.ThreadUnsafeSet, toRemove *set.ThreadUnsafeSet, changeNumber int64) error

Update updates the local segment cache and forwards the call to he underlying storage

type ObservableSplitStorage

type ObservableSplitStorage interface {
	storage.SplitStorage
	Count() int
}

ObservableSplitStorage is an interface extender that adds the method `Count` to the split storage

type ObservableSplitStorageImpl

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

ObservableSplitStorageImpl is an implementaion of the ObservableSplitStorage inteface that wraps an existing storage caches and caches splitnames in-memory (in case the underlying one is non-local, ie: redis)

func NewObservableSplitStorage

func NewObservableSplitStorage(toWrap storage.SplitStorage, logger logging.LoggerInterface) (*ObservableSplitStorageImpl, error)

NewObservableSplitStorage constructs a NewObservableSplitStorage

func (*ObservableSplitStorageImpl) Count

func (s *ObservableSplitStorageImpl) Count() int

Count returns the number of active splits

func (*ObservableSplitStorageImpl) SplitNames

func (s *ObservableSplitStorageImpl) SplitNames() []string

SplitNames returns a list of cached splits

func (*ObservableSplitStorageImpl) Update

func (s *ObservableSplitStorageImpl) Update(toAdd []dtos.SplitDTO, toRemove []dtos.SplitDTO, changeNumber int64)

Update is an override that wraps the original Update method and calls update on the local cache as well

Jump to

Keyboard shortcuts

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