ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
compute_telemetry_repository Class Reference

Persistence for compute grid telemetry time-series samples. More...

#include <compute_telemetry_repository.hpp>

Collaboration diagram for compute_telemetry_repository:
Collaboration graph

Public Types

using context = ores::database::context
 

Public Member Functions

void insert_grid_sample (context ctx, const domain::grid_sample &sample)
 Insert one grid-level sample row.
 
void insert_node_sample (context ctx, const domain::node_sample &sample)
 Insert one node-level sample row.
 
std::optional< domain::grid_samplelatest_grid_sample (context ctx)
 Return the most recent grid sample for the context's tenant.
 
std::vector< domain::node_samplelatest_node_samples (context ctx)
 Return the most recent sample per node for the context's tenant.
 
domain::grid_sample compute_grid_stats (context ctx)
 Compute current grid statistics using SQL aggregations.
 

Detailed Description

Persistence for compute grid telemetry time-series samples.

Writes to ores_compute_grid_samples_tbl and ores_compute_node_samples_tbl (TimescaleDB hypertables).

Member Function Documentation

◆ latest_grid_sample()

std::optional< domain::grid_sample > latest_grid_sample ( context  ctx)

Return the most recent grid sample for the context's tenant.

Returns nullopt if no samples exist yet.

◆ latest_node_samples()

std::vector< domain::node_sample > latest_node_samples ( context  ctx)

Return the most recent sample per node for the context's tenant.

Uses DISTINCT ON (host_id) to return exactly one row per host, the one with the most recent sampled_at, in a single database query.

◆ compute_grid_stats()

domain::grid_sample compute_grid_stats ( context  ctx)

Compute current grid statistics using SQL aggregations.

Runs a single parameterized CTE query against the compute domain tables (hosts, results, workunits, batches) to return counts and breakdowns without loading full tables into memory. Sets sampled_at to now().