Documentation ¶
Index ¶
- Constants
- Variables
- func MarshalBlock(dst []byte, b *Block) []byte
- func MarshalMetricNameRaw(dst []byte, labels []Label) []byte
- func MarshalMetricRow(dst []byte, metricNameRaw []byte, timestamp int64, value []byte) []byte
- func PutSpanName(mn *SpanName)
- func RegexpCacheMisses() uint64
- func RegexpCacheRequests() uint64
- func RegexpCacheSize() int
- func SetBigMergeWorkersCount(n int)
- func SetFinalMergeDelay(delay time.Duration)
- func SetMaxLabelsPerTimeseries(maxLabels int)
- func SetSmallMergeWorkersCount(n int)
- func UnmarshalBlock(dst *Block, src []byte) ([]byte, error)
- type Block
- func (b *Block) AppendRowsWithTimeRangeFilter(dstTimestamps []int64, dstValues [][]byte, tr ScanRange) ([]int64, [][]byte)
- func (b *Block) CopyFrom(src *Block)
- func (b *Block) Init(traceID TraceID, timestamps []int64, values [][]byte)
- func (b *Block) MarshalData(timestampsBlockOffset, valuesBlockOffset uint64) ([]byte, []byte, []byte)
- func (b *Block) MarshalPortable(dst []byte) []byte
- func (b *Block) Reset()
- func (b *Block) RowsCount() int
- func (b *Block) TraceID() *TraceID
- func (b *Block) UnmarshalData() error
- func (b *Block) UnmarshalPortable(src []byte) ([]byte, error)
- type BlockRef
- type FetchDataOption
- type IndexDBMetrics
- type Label
- type Metrics
- type ScanRange
- type Search
- type SearchQuery
- type SpanName
- func (mn *SpanName) AddTag(key, value []byte)
- func (mn *SpanName) CopyFrom(src *SpanName)
- func (mn *SpanName) GetTagValue(tagKey string) []byte
- func (mn *SpanName) Marshal(dst []byte) []byte
- func (mn *SpanName) RemoveTag(tagKey string)
- func (mn *SpanName) RemoveTagsIgnoring(ignoringTags []string)
- func (mn *SpanName) RemoveTagsOn(onTags []string)
- func (mn *SpanName) Reset()
- func (mn *SpanName) ResetMetricGroup()
- func (mn *SpanName) SetTags(addTags []string, src *SpanName)
- func (mn *SpanName) String() string
- func (mn *SpanName) Unmarshal(src []byte) error
- type SpanRow
- type Storage
- func (s *Storage) AddRows(mrs []SpanRow) error
- func (s *Storage) ForceMergePartitions(partitionNamePrefix string) error
- func (s *Storage) MustClose()
- func (s *Storage) RetentionMonths() int
- func (s *Storage) SearchTagEntries(maxTagKeys, maxTagValues int, deadline uint64) ([]TagEntry, error)
- func (s *Storage) SearchTagKeys(maxTagKeys int, deadline uint64) ([]string, error)
- func (s *Storage) SearchTagValues(tagKey []byte, maxTagValues int, deadline uint64) ([]string, error)
- func (s *Storage) SearchTraceIDs(tfss []*TagFilters, tr ScanRange, deadline uint64) ([]TraceID, error)
- func (s *Storage) UpdateMetrics(m *Metrics)
- type TableMetrics
- type Tag
- type TagEntry
- type TagFilter
- type TagFilters
- type TraceID
Constants ¶
const ( NotFetch FetchDataOption = 1 OnlyFetchTime = iota FetchAll )
Variables ¶
var ( // MetricsWithDroppedLabels is the number of metrics with at least a single dropped label MetricsWithDroppedLabels uint64 // TooLongLabelNames is the number of too long label names TooLongLabelNames uint64 // TooLongLabelValues is the number of too long label values TooLongLabelValues uint64 )
var ErrDeadlineExceeded = fmt.Errorf("deadline exceeded")
ErrDeadlineExceeded is returned when the request times out.
Functions ¶
func MarshalBlock ¶
MarshalBlock marshals b to dst.
b.MarshalData must be called on b before calling MarshalBlock.
func MarshalMetricNameRaw ¶
MarshalMetricNameRaw marshals labels to dst and returns the result.
The result must be unmarshaled with SpanName.unmarshalRaw
func MarshalMetricRow ¶
MarshalMetricRow marshals SpanRow data to dst and returns the result.
func RegexpCacheMisses ¶
func RegexpCacheMisses() uint64
RegexpCacheMisses returns the number of cache misses for regexp cache.
func RegexpCacheRequests ¶
func RegexpCacheRequests() uint64
RegexpCacheRequests returns the number of requests to regexp cache.
func RegexpCacheSize ¶
func RegexpCacheSize() int
RegexpCacheSize returns the number of cached regexps for tag filters.
func SetBigMergeWorkersCount ¶
func SetBigMergeWorkersCount(n int)
SetBigMergeWorkersCount sets the maximum number of concurrent mergers for big blocks.
The function must be called before opening or creating any storage.
func SetFinalMergeDelay ¶
SetFinalMergeDelay sets the delay before doing final merge for partitions without newly ingested data.
This function may be called only before Storage initialization.
func SetMaxLabelsPerTimeseries ¶
func SetMaxLabelsPerTimeseries(maxLabels int)
SetMaxLabelsPerTimeseries sets the limit on the number of labels per each time series.
Superfouos labels are dropped.
func SetSmallMergeWorkersCount ¶
func SetSmallMergeWorkersCount(n int)
SetSmallMergeWorkersCount sets the maximum number of concurrent mergers for small blocks.
The function must be called before opening or creating any storage.
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block represents a block of time series values for a single TraceID.
func (*Block) AppendRowsWithTimeRangeFilter ¶
func (b *Block) AppendRowsWithTimeRangeFilter(dstTimestamps []int64, dstValues [][]byte, tr ScanRange) ([]int64, [][]byte)
AppendRowsWithTimeRangeFilter filters samples from b according to tr and appends them to dst*.
It is expected that UnmarshalData has been already called on b.
func (*Block) MarshalData ¶
func (b *Block) MarshalData(timestampsBlockOffset, valuesBlockOffset uint64) ([]byte, []byte, []byte)
MarshalData marshals the block into binary representation.
func (*Block) MarshalPortable ¶
MarshalPortable marshals b to dst, so it could be portably migrated to other VictoriaMetrics instance.
The marshaled value must be unmarshaled with UnmarshalPortable function.
func (*Block) UnmarshalData ¶
UnmarshalData unmarshals block data.
type BlockRef ¶
type BlockRef struct {
// contains filtered or unexported fields
}
BlockRef references a Block.
BlockRef is valid only until the corresponding Search is valid, i.e. it becomes invalid after Search.MustClose is called.
func (*BlockRef) MustReadBlock ¶
MustReadBlock reads block from br to dst.
if fetchData is false, then only block header is read, otherwise all the data is read.
type FetchDataOption ¶
type FetchDataOption = uint8
type IndexDBMetrics ¶
type IndexDBMetrics struct { TagCacheSize uint64 TagCacheSizeBytes uint64 TagCacheRequests uint64 TagCacheMisses uint64 UselessTagFiltersCacheSize uint64 UselessTagFiltersCacheSizeBytes uint64 UselessTagFiltersCacheRequests uint64 UselessTagFiltersCacheMisses uint64 IndexDBRefCount uint64 NewTimeseriesCreated uint64 MissingTSIDsForMetricID uint64 RecentHourMetricIDsSearchCalls uint64 RecentHourMetricIDsSearchHits uint64 DateMetricIDsSearchCalls uint64 DateMetricIDsSearchHits uint64 DateRangeSearchCalls uint64 DateRangeSearchHits uint64 MissingMetricNamesForMetricID uint64 IndexBlocksWithMetricIDsProcessed uint64 IndexBlocksWithMetricIDsIncorrectOrder uint64 mergeset.TableMetrics }
IndexDBMetrics contains essential metrics for indexDB.
type Metrics ¶
type Metrics struct { RowsAddedTotal uint64 TooSmallTimestampRows uint64 TooBigTimestampRows uint64 AddRowsConcurrencyLimitReached uint64 AddRowsConcurrencyLimitTimeout uint64 AddRowsConcurrencyDroppedRows uint64 AddRowsConcurrencyCapacity uint64 AddRowsConcurrencyCurrent uint64 SearchTraceIDsConcurrencyLimitReached uint64 SearchTraceIDsConcurrencyLimitTimeout uint64 SearchTraceIDsConcurrencyCapacity uint64 SearchTraceIDsConcurrencyCurrent uint64 SearchDelays uint64 SlowRowInserts uint64 SlowPerDayIndexInserts uint64 SlowMetricNameLoads uint64 TimestampsBlocksMerged uint64 TimestampsBytesSaved uint64 MetricNameCacheSize uint64 MetricNameCacheSizeBytes uint64 MetricNameCacheRequests uint64 MetricNameCacheMisses uint64 MetricNameCacheCollisions uint64 MinuteMetricIDCacheSize uint64 MinuteMetricIDCacheSizeBytes uint64 IndexDBMetrics IndexDBMetrics TableMetrics TableMetrics }
Metrics contains essential metrics for the Storage.
type Search ¶
type Search struct { // BlockRef is updated with each Search.NextMetricBlock call. BlockRef *BlockRef // contains filtered or unexported fields }
Search is a search for time series.
func (*Search) Init ¶
Init initializes s from the given storage, tfss and tr.
MustClose must be called when the search is done.
Init returns the upper bound on the number of found time series.
func (*Search) NextMetricBlock ¶
NextMetricBlock proceeds to the next MetricBlockRef.
type SearchQuery ¶
type SearchQuery struct { MinTimestamp int64 MaxTimestamp int64 TagFilterss [][]TagFilter Limit int Forward bool FetchData FetchDataOption }
SearchQuery is used for sending search queries from vmselect to vmstorage.
func (*SearchQuery) Marshal ¶
func (sq *SearchQuery) Marshal(dst []byte) []byte
Marshal appends marshaled sq to dst and returns the result.
func (*SearchQuery) String ¶
func (sq *SearchQuery) String() string
String returns string representation of the search query.
type SpanName ¶
type SpanName struct { TraceID []byte // Tags are optional. They must be sorted by tag Key for canonical view. // Use sortTags method. Tags []Tag }
SpanName reperesents a metric name.
func (*SpanName) GetTagValue ¶
GetTagValue returns tag value for the given tagKey.
func (*SpanName) Marshal ¶
Marshal appends marshaled mn to dst and returns the result.
Tags must be sorted before calling this function.
func (*SpanName) RemoveTagsIgnoring ¶
RemoveTagsIgnoring removes all the tags included in ignoringTags.
func (*SpanName) RemoveTagsOn ¶
RemoveTagsOn removes all the tags not included to onTags.
func (*SpanName) ResetMetricGroup ¶
func (mn *SpanName) ResetMetricGroup()
ResetMetricGroup resets mn.TraceID
type SpanRow ¶
type SpanRow struct { // SpanNameRaw contains raw metric name, which must be decoded // with SpanName.unmarshalRaw. SpanNameRaw []byte Timestamp int64 Value []byte }
SpanRow is a metric to insert into storage.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage represents TSDB storage.
func OpenStorage ¶
OpenStorage opens storage on the given path with the given retentionMsecs.
func (*Storage) ForceMergePartitions ¶
ForceMergePartitions force-merges partitions in s with names starting from the given partitionNamePrefix.
Partitions are merged sequentially in order to reduce load on the system.
func (*Storage) RetentionMonths ¶
RetentionMonths returns retention months for s.
func (*Storage) SearchTagEntries ¶
func (s *Storage) SearchTagEntries(maxTagKeys, maxTagValues int, deadline uint64) ([]TagEntry, error)
SearchTagEntries returns a list of (tagName -> tagValues).
func (*Storage) SearchTagKeys ¶
SearchTagKeys searches for tag keys.
func (*Storage) SearchTagValues ¶
func (s *Storage) SearchTagValues(tagKey []byte, maxTagValues int, deadline uint64) ([]string, error)
SearchTagValues searches for tag values.
func (*Storage) SearchTraceIDs ¶
func (s *Storage) SearchTraceIDs(tfss []*TagFilters, tr ScanRange, deadline uint64) ([]TraceID, error)
SearchTraceIDs returns sorted TraceIDs for the given tfss and the given tr.
func (*Storage) UpdateMetrics ¶
UpdateMetrics updates m with metrics from s.
type TableMetrics ¶
type TableMetrics struct { PartitionsRefCount uint64 // contains filtered or unexported fields }
TableMetrics contains essential metrics for the table.
type Tag ¶
Tag represents a (key, value) tag for metric.
type TagEntry ¶
type TagEntry struct { // Key is tagName Key string // Values contains all the values for Key. Values []string }
TagEntry contains (tagName -> tagValues) mapping
type TagFilter ¶
TagFilter represents a single tag filter from SearchQuery.
type TagFilters ¶
type TagFilters struct {
// contains filtered or unexported fields
}
TagFilters represents filters used for filtering tags.
func NewTagFilters ¶
func NewTagFilters() *TagFilters
NewTagFilters returns new TagFilters for the given.
func (*TagFilters) Add ¶
func (tfs *TagFilters) Add(key, value []byte, isNegative, isRegexp bool) error
Add adds the given tag filter to tfs.
TraceID must be encoded with nil key.
Finalize must be called after tfs is constructed.
func (*TagFilters) Finalize ¶
func (tfs *TagFilters) Finalize() []*TagFilters
Finalize finalizes tfs and may return complementary TagFilters, which must be added to the resulting set of tag filters.
func (*TagFilters) String ¶
func (tfs *TagFilters) String() string
String returns human-readable value for tfs.
Source Files ¶
- block.go
- block_header.go
- block_stream_merger.go
- block_stream_reader.go
- block_stream_writer.go
- index_db.go
- index_search.go
- inmemory_part.go
- merge.go
- metaindex_row.go
- metric_name.go
- part.go
- part_header.go
- part_search.go
- partition.go
- partition_search.go
- raw_block.go
- raw_row.go
- search.go
- storage.go
- table.go
- table_search.go
- tag_filters.go
- time.go