Documentation ¶
Index ¶
- Constants
- func Delete(ctx context.Context, logger log.Logger, bkt objstore.Bucket, id ulid.ULID) error
- func InRange(min, max, start, end model.Time) bool
- func IsBlockDir(path string) (id ulid.ULID, ok bool)
- func Upload(ctx context.Context, logger log.Logger, bkt objstore.Bucket, bdir string) error
- type BlockStats
- type File
- type Meta
- func (m *Meta) FileByRelPath(name string) *File
- func (m *Meta) InRange(start, end model.Time) bool
- func (m *Meta) String() string
- func (meta *Meta) TSDBBlockMeta() tsdb.BlockMeta
- func (meta *Meta) WriteTo(w io.Writer) (int64, error)
- func (meta *Meta) WriteToFile(logger log.Logger, dir string) (int64, error)
- type MetaVersion
- type ParquetFile
- type SourceType
- type TSDBFile
Constants ¶
View Source
const ( IndexFilename = "index.tsdb" ParquetSuffix = ".parquet" DeletionMarkFilename = "deletion-mark.json" HostnameLabel = "__hostname__" )
View Source
const (
MetaFilename = "meta.json"
)
View Source
const ( // Version1 is a enumeration of Phlare section of TSDB meta supported by Phlare. MetaVersion1 = MetaVersion(1) )
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
Delete removes directory that is meant to be block directory. NOTE: Always prefer this method for deleting blocks.
- We have to delete block's files in the certain order (meta.json first and deletion-mark.json last) to ensure we don't end up with malformed partial blocks. Thanos system handles well partial blocks only if they don't have meta.json. If meta.json is present Thanos assumes valid block.
- This avoids deleting empty dir (whole bucket) by mistake.
Types ¶
type BlockStats ¶
type File ¶
type File struct { RelPath string `json:"relPath"` // SizeBytes is optional (e.g meta.json does not show size). SizeBytes uint64 `json:"sizeBytes,omitempty"` // Parquet can contain some optional Parquet file info Parquet *ParquetFile `json:"parquet,omitempty"` // TSDB can contain some optional TSDB file info TSDB *TSDBFile `json:"tsdb,omitempty"` }
type Meta ¶
type Meta struct { // Unique identifier for the block and its contents. Changes on compaction. ULID ulid.ULID `json:"ulid"` // MinTime and MaxTime specify the time range all samples // in the block are in. MinTime model.Time `json:"minTime"` MaxTime model.Time `json:"maxTime"` // Stats about the contents of the block. Stats BlockStats `json:"stats,omitempty"` // File is a sorted (by rel path) list of all files in block directory of this block known to PhlareDB. // Sorted by relative path. Files []File `json:"files,omitempty"` // Information on compactions the block was created from. Compaction tsdb.BlockMetaCompaction `json:"compaction"` // Version of the index format. Version MetaVersion `json:"version"` // Labels are the external labels identifying the producer as well as tenant. Labels map[string]string `json:"labels,omitempty"` // Source is a real upload source of the block. Source SourceType `json:"source,omitempty"` }
func DownloadMeta ¶
func DownloadMeta(ctx context.Context, logger log.Logger, bkt objstore.Bucket, id ulid.ULID) (Meta, error)
DownloadMeta downloads only meta file from bucket by block ID. TODO(bwplotka): Differentiate between network error & partial upload.
func Read ¶
func Read(rc io.ReadCloser) (_ *Meta, err error)
Read the block meta from the given reader.
func ReadFromDir ¶
ReadFromDir reads the given meta from <dir>/meta.json.
func (*Meta) FileByRelPath ¶
func (*Meta) TSDBBlockMeta ¶
type MetaVersion ¶
type MetaVersion int
type ParquetFile ¶
type SourceType ¶
type SourceType string
const ( UnknownSource SourceType = "" IngesterSource SourceType = "ingester" CompactorSource SourceType = "compactor" )
Click to show internal directories.
Click to hide internal directories.