Documentation ¶
Overview ¶
Package metricdb handles the storage for metrics.
Design ¶
The db file name is metric and its key-value design in leveldb is:
Key: <Name>:<Stamp> Value: <Value>:<Score>:<Average>
For less disk usage:
1. Metric stamps will be converted to 36-hex strings before they are put to db.
2. Metric stamps will minus a "stamp horizon" before they are converted to string.
Index ¶
Constants ¶
View Source
const ( // LevelDBBloomFilterBitsPerKey is the leveldb builtin bloom filter // bitsPerKey. // // Filter name will be persisted to disk on a per sstable basis, during // reads leveldb will try to find matching filter. And the filter can be // replaced after a DB has been created, or say that the filter can be // changed between db opens. But if this is done, note that old sstables // will continue using the old filter and every new created sstable will // use the new filter. For this reason, I make the parameter `bitsPerKey` // a constant, there is no need to replace it. // // Also, this means that no big performance penalty will be experienced // when changing the parameter, and the goleveldb docs points this as well. // // About the probability of false positives, the following link may help: // http://pages.cs.wisc.edu/~cao/papers/summary-cache/node8.html // LevelDBBloomFilterBitsPerKey = 10 )
Variables ¶
View Source
var ( // ErrNotFound is returned when requested data not found. ErrNotFound = errors.New("metricdb: not found") // ErrCorrupted is returned when corrupted data found. ErrCorrupted = errors.New("metricdb: corrupted data found") // ErrStampTooSmall is returned when stamp is smaller than horizon. ErrStampTooSmall = errors.New("metricdb: stamp is too small") )
Functions ¶
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB handles metrics storage.
Click to show internal directories.
Click to hide internal directories.