roo_monitoring
API Documentation for roo_monitoring
Loading...
Searching...
No Matches
roo_monitoring Namespace Reference

Umbrella header for the roo_monitoring module. More...

Data Structures

class  Aggregator
 Aggregates samples for a vault file time bucket. More...
 
class  CachedLogDir
 In-memory cache of log directory entries. More...
 
class  Collection
 Collection of timeseries sharing transform and source resolution. More...
 
class  Filename
 Helper class for generating filenames corresponding to timestamps. More...
 
class  LogCompactionCursor
 
class  LogCursor
 Cursor used when seeking through multiple log files. More...
 
class  LogFileReader
 Reader for a single log file. More...
 
class  LogReader
 Reader that walks across a sequence of log files. More...
 
class  LogSample
 Sample stored in log files before compaction. More...
 
class  LogWriter
 Writer for log files at a fixed resolution. More...
 
class  Sample
 Represents a single data sample stored in a vault file. More...
 
class  Transform
 Maps application-domain floats to 16-bit stored values. More...
 
class  VaultFileReader
 Sequential reader for a single vault file. More...
 
class  VaultFileRef
 Identifies a specific file in the monitoring vault. More...
 
class  VaultIterator
 Iterator that scans monitoring data at a given resolution. More...
 
class  VaultWriter
 Writes vault files for a collection at a specific resolution. More...
 
class  Writer
 Write interface for a monitoring collection. More...
 
class  WriteTransaction
 Represents a single write operation to a monitoring collection. More...
 

Enumerations

enum  Code { CODE_ERROR = 0 , CODE_TIMESTAMP = 1 , CODE_DATUM = 2 }
 
enum  Resolution {
  kResolution_1_ms = 0 , kResolution_4_ms = 1 , kResolution_16_ms = 2 , kResolution_64_ms = 3 ,
  kResolution_256_ms = 4 , kResolution_1024_ms = 5 , kResolution_4096_ms = 6 , kResolution_16384_ms = 7 ,
  kResolution_65536_ms = 8 , kResolution_262144_ms = 9 , kResolution_1048576_ms = 10 , kResolution_4194304_ms = 11 ,
  kResolution_16777216_ms = 12 , kResolution_67108864_ms = 13 , kResolution_268435456_ms = 14 , kResolution_1073741824_ms = 15 ,
  kResolution_4294967296_ms = 16 , kResolution_17179869184_ms = 17 , kResolution_68719476736_ms = 18
}
 Time resolution used for log and vault files. More...
 

Functions

String subdir (String base, const String &sub)
 Returns a path formed by joining the base directory and subdirectory.
 
String filepath (String dir, int64_t file)
 Returns a file path for the given directory and timestamp-like value.
 
std::vector< int64_t > listFiles (roo_io::Mount &fs, const char *dirname)
 Lists timestamp-named files in the directory and returns their timestamps.
 
constexpr char toHexDigit (int d)
 Converts a 0-15 value to an uppercase hex digit.
 
void writeTimestamp (roo_io::OutputStreamWriter &writer, int64_t timestamp)
 
void writeDatum (roo_io::OutputStreamWriter &writer, uint64_t stream_id, uint16_t transformed_datum)
 
bool operator< (const LogSample &a, const LogSample &b)
 
static constexpr int64_t timestamp_ms_floor (int64_t timestamp_ms, Resolution resolution)
 Rounds the timestamp down to the specified resolution bucket.
 
static constexpr int64_t timestamp_ms_ceil (int64_t timestamp_ms, Resolution resolution)
 Rounds the timestamp up to the specified resolution bucket.
 
static constexpr int64_t timestamp_increment (int64_t steps, Resolution resolution)
 Returns the timestamp delta for the given number of resolution steps.
 
roo_logging::Stream & operator<< (roo_logging::Stream &os, const VaultFileRef &file_ref)
 Writes a human-readable representation of the vault file reference.
 

Variables

const char * kMonitoringBasePath = "/monitoring"
 Base directory for monitoring storage on the filesystem.
 
const char * kLogSubPath = "log"
 Subdirectory name used for raw log files.
 
static const int kRangeLength = 4
 Number of base-4 digits used per range.
 
static const int kRangeElementCount = 1 << (kRangeLength << 1)
 Number of items in a range (4^(kRangeLength)).
 
static const Resolution kMaxResolution = kResolution_68719476736_ms
 Maximum supported resolution.
 

Detailed Description

Umbrella header for the roo_monitoring module.

Provides data collection, transformation, and vault APIs.

Enumeration Type Documentation

◆ Code

Enumerator
CODE_ERROR 
CODE_TIMESTAMP 
CODE_DATUM 

Definition at line 21 of file log.cpp.

◆ Resolution

Time resolution used for log and vault files.

Enumerator
kResolution_1_ms 
kResolution_4_ms 
kResolution_16_ms 
kResolution_64_ms 
kResolution_256_ms 
kResolution_1024_ms 
kResolution_4096_ms 
kResolution_16384_ms 
kResolution_65536_ms 
kResolution_262144_ms 
kResolution_1048576_ms 
kResolution_4194304_ms 
kResolution_16777216_ms 
kResolution_67108864_ms 
kResolution_268435456_ms 
kResolution_1073741824_ms 
kResolution_4294967296_ms 
kResolution_17179869184_ms 
kResolution_68719476736_ms 

Definition at line 8 of file resolution.h.

Function Documentation

◆ filepath()

String roo_monitoring::filepath ( String  dir,
int64_t  file 
)

Returns a file path for the given directory and timestamp-like value.

Definition at line 19 of file common.cpp.

References roo_monitoring::Filename::filename(), and roo_monitoring::Filename::forTimestamp().

Referenced by roo_monitoring::LogReader::deleteRange(), and roo_monitoring::LogReader::seek().

◆ listFiles()

std::vector< int64_t > roo_monitoring::listFiles ( roo_io::Mount &  fs,
const char *  dirname 
)

Lists timestamp-named files in the directory and returns their timestamps.

The timestamps are in milliseconds since Epoch and sorted ascending.

Definition at line 45 of file common.cpp.

◆ operator<()

bool roo_monitoring::operator< ( const LogSample a,
const LogSample b 
)
inline

Definition at line 30 of file log.h.

References roo_monitoring::LogSample::stream_id().

◆ operator<<()

roo_logging::Stream & roo_monitoring::operator<< ( roo_logging::Stream &  os,
const VaultFileRef file_ref 
)

Writes a human-readable representation of the vault file reference.

Definition at line 203 of file vault.cpp.

References roo_monitoring::VaultFileRef::resolution(), roo_monitoring::VaultFileRef::time_span(), roo_monitoring::VaultFileRef::time_step(), and roo_monitoring::VaultFileRef::timestamp().

◆ subdir()

String roo_monitoring::subdir ( String  base,
const String &  sub 
)

Returns a path formed by joining the base directory and subdirectory.

Definition at line 13 of file common.cpp.

◆ timestamp_increment()

static constexpr int64_t roo_monitoring::timestamp_increment ( int64_t  steps,
Resolution  resolution 
)
inlinestaticconstexpr

Returns the timestamp delta for the given number of resolution steps.

Definition at line 51 of file resolution.h.

◆ timestamp_ms_ceil()

static constexpr int64_t roo_monitoring::timestamp_ms_ceil ( int64_t  timestamp_ms,
Resolution  resolution 
)
inlinestaticconstexpr

Rounds the timestamp up to the specified resolution bucket.

Definition at line 43 of file resolution.h.

Referenced by roo_monitoring::LogReader::nextRange(), and roo_monitoring::LogWriter::write().

◆ timestamp_ms_floor()

static constexpr int64_t roo_monitoring::timestamp_ms_floor ( int64_t  timestamp_ms,
Resolution  resolution 
)
inlinestaticconstexpr

Rounds the timestamp down to the specified resolution bucket.

Definition at line 34 of file resolution.h.

Referenced by roo_monitoring::Collection::getVaultFilePath(), roo_monitoring::VaultFileRef::Lookup(), roo_monitoring::LogReader::nextRange(), and roo_monitoring::WriteTransaction::write().

◆ toHexDigit()

constexpr char roo_monitoring::toHexDigit ( int  d)
inlineconstexpr

Converts a 0-15 value to an uppercase hex digit.

Definition at line 30 of file common.h.

Referenced by roo_monitoring::Filename::forTimestamp(), and roo_monitoring::Collection::getVaultFilePath().

◆ writeDatum()

void roo_monitoring::writeDatum ( roo_io::OutputStreamWriter &  writer,
uint64_t  stream_id,
uint16_t  transformed_datum 
)

Definition at line 239 of file log.cpp.

References CODE_DATUM.

Referenced by roo_monitoring::LogWriter::write().

◆ writeTimestamp()

void roo_monitoring::writeTimestamp ( roo_io::OutputStreamWriter &  writer,
int64_t  timestamp 
)

Definition at line 234 of file log.cpp.

References CODE_TIMESTAMP.

Referenced by roo_monitoring::LogWriter::write().

Variable Documentation

◆ kLogSubPath

const char * roo_monitoring::kLogSubPath = "log"

Subdirectory name used for raw log files.

Definition at line 11 of file common.cpp.

◆ kMaxResolution

const Resolution roo_monitoring::kMaxResolution = kResolution_68719476736_ms
static

Maximum supported resolution.

Definition at line 31 of file resolution.h.

◆ kMonitoringBasePath

const char * roo_monitoring::kMonitoringBasePath = "/monitoring"

Base directory for monitoring storage on the filesystem.

Definition at line 10 of file common.cpp.

Referenced by roo_monitoring::Collection::Collection().

◆ kRangeElementCount

◆ kRangeLength

const int roo_monitoring::kRangeLength = 4
static

Number of base-4 digits used per range.

Default is 4 (4^4 = 256 items per range). When ROO_MONITORING_TESTING is defined, use 2 (16 items per range) to keep unit tests small but meaningful.

Definition at line 19 of file common.h.

Referenced by roo_monitoring::Collection::getVaultFilePath(), roo_monitoring::VaultFileRef::Lookup(), roo_monitoring::LogReader::nextRange(), roo_monitoring::VaultFileRef::sibling_index(), roo_monitoring::VaultFileRef::time_span(), and roo_monitoring::LogWriter::write().