Documentation ¶
Index ¶
- Variables
- func MetricsSetEqual(a, b types.MetricsSet) bool
- func NewMutableLabelStore(lbls MutableLabels) mutable.Store
- type DiscardTSDB
- type Index
- func (idx *Index) AllIDs(ctx context.Context, _ time.Time, _ time.Time) ([]types.MetricID, error)
- func (idx *Index) LabelNames(ctx context.Context, _, _ time.Time, matchers []*labels.Matcher) ([]string, error)
- func (idx *Index) LabelValues(ctx context.Context, _, _ time.Time, name string, matchers []*labels.Matcher) ([]string, error)
- func (idx *Index) LookupIDs(ctx context.Context, requests []types.LookupRequest) ([]types.MetricID, []int64, error)
- func (idx *Index) Search(ctx context.Context, _ time.Time, _ time.Time, matchers []*labels.Matcher) (types.MetricsSet, error)
- type LocalCluster
- type Locks
- type MemoryTSDB
- type MetricsLabel
- type MutableLabels
- type States
Constants ¶
This section is empty.
Variables ¶
var DefaultMutableLabels = MutableLabels{ AssociatedNames: map[string]map[string]string{ "1234": { "group": "instance", "environment": "instance", }, "5678": { "group": "instance", }, }, AssociatedValues: map[mutable.LabelKey]map[string][]string{ { Tenant: "1234", Name: "group", }: { "group1": []string{"server1", "server2", "server3"}, "group2": []string{"server2", "server3"}, "group3": []string{"server4"}, }, { Tenant: "1234", Name: "environment", }: { "prod": []string{"server4"}, }, { Tenant: "5678", Name: "group", }: { "group10": []string{"server10", "server11"}, }, }, }
DefaultMutableLabels contains some mutable labels that can be used in tests.
Functions ¶
func MetricsSetEqual ¶
func MetricsSetEqual(a, b types.MetricsSet) bool
MetricsSetEqual tests if two MetricsSet contains the same list in the same order.
func NewMutableLabelStore ¶
func NewMutableLabelStore(lbls MutableLabels) mutable.Store
NewMutableLabelStore returns a mock label store pre filled with labels.
Types ¶
type DiscardTSDB ¶
type DiscardTSDB struct{}
DiscardTSDB will write metrics to /dev/null.
func (DiscardTSDB) Flush ¶
func (d DiscardTSDB) Flush()
func (DiscardTSDB) ReadIter ¶
func (d DiscardTSDB) ReadIter(_ context.Context, _ types.MetricRequest) (types.MetricDataSet, error)
ReadIter return an empty result.
func (DiscardTSDB) Write ¶
func (d DiscardTSDB) Write(_ context.Context, _ []types.MetricData) error
Write discard metrics.
type Index ¶
type Index struct { StoreMetricIDInMemory bool FixedValue types.MetricID // contains filtered or unexported fields }
Index implement a non-working index. It only useful for testing/benchmark. See each function for their limitation.
func NewIndex ¶
func NewIndex(metrics []types.MetricLabel) *Index
NewIndex create a new index pre-filled with metrics.
func (*Index) AllIDs ¶
AllIDs does not store IDs in any persistent store. So this is lost after every restart. It may even not store them at all!
func (*Index) LabelNames ¶
func (idx *Index) LabelNames(ctx context.Context, _, _ time.Time, matchers []*labels.Matcher) ([]string, error)
LabelNames only works when StoreMetricIDInMemory is enabled.
func (*Index) LabelValues ¶
func (idx *Index) LabelValues( ctx context.Context, _, _ time.Time, name string, matchers []*labels.Matcher, ) ([]string, error)
LabelValues only works when StoreMetricIDInMemory is enabled.
type LocalCluster ¶
type LocalCluster struct {
// contains filtered or unexported fields
}
LocalCluster implement types.Cluster but only for clients sharing the same LocalCluster object.
func (*LocalCluster) Close ¶
func (c *LocalCluster) Close() error
func (*LocalCluster) Size ¶
func (c *LocalCluster) Size() int
func (*LocalCluster) Subscribe ¶
func (c *LocalCluster) Subscribe(topic string, callback func([]byte))
type Locks ¶
type Locks struct {
// contains filtered or unexported fields
}
Locks is a non-distributed lock factory. It should only be used for single-node.
func (*Locks) CreateLock ¶
CreateLock return a TryLocker for given name. This locker is NOT common across all SquirrelDB and not even this process. It's only common to this factory. timeToLive is ignored, as it normally only used in case of crash to release the lock.
type MemoryTSDB ¶
type MemoryTSDB struct { Data map[types.MetricID]types.MetricData LogRequest bool Reads []types.MetricRequest Writes [][]types.MetricData // contains filtered or unexported fields }
MemoryTSDB store all value in memory. Only useful in unittest.
func (*MemoryTSDB) DumpData ¶
func (db *MemoryTSDB) DumpData() []types.MetricData
DumpData dump to content of the TSDB. Result is ordered by MetricID.
func (*MemoryTSDB) ReadIter ¶
func (db *MemoryTSDB) ReadIter(_ context.Context, request types.MetricRequest) (types.MetricDataSet, error)
ReadIter return an empty result.
func (*MemoryTSDB) Write ¶
func (db *MemoryTSDB) Write(_ context.Context, metrics []types.MetricData) error
Write store in memory.
type MetricsLabel ¶
type MetricsLabel struct { List []types.MetricLabel // contains filtered or unexported fields }
func (*MetricsLabel) At ¶
func (l *MetricsLabel) At() types.MetricLabel
func (*MetricsLabel) Count ¶
func (l *MetricsLabel) Count() int
func (*MetricsLabel) Err ¶
func (l *MetricsLabel) Err() error
func (*MetricsLabel) Next ¶
func (l *MetricsLabel) Next() bool
type MutableLabels ¶
type MutableLabels struct { // map[tenant][mutable label name] -> associated non mutable label name. AssociatedNames map[string]map[string]string // map[tenant, mutable label name][mutable label value] -> associated non mutable label values. AssociatedValues map[mutable.LabelKey]map[string][]string }
MutableLabels stores all mutable labels in the dummy label provider.