|
ORE Studio 0.0.4
|
Repository for telemetry log persistence and querying. More...
#include <telemetry_repository.hpp>

Public Types | |
| using | context = ores::database::context |
Public Member Functions | |
| telemetry_repository (context ctx) | |
| std::string | sql () |
| Returns the SQL created by sqlgen to construct the table. | |
| void | create (const domain::telemetry_log_entry &entry) |
| Creates a single log entry. | |
| std::size_t | create_batch (const domain::telemetry_batch &batch) |
| Creates multiple log entries in a batch. | |
| std::vector< domain::telemetry_log_entry > | query (const domain::telemetry_query &q) |
| Queries log entries with filters. | |
| std::uint64_t | count (const domain::telemetry_query &q) |
| Counts log entries matching a query. | |
| std::vector< domain::telemetry_log_entry > | read_by_session (const boost::uuids::uuid &session_id, std::uint32_t limit=1000) |
| Reads logs for a specific session. | |
| std::vector< domain::telemetry_log_entry > | read_by_account (const boost::uuids::uuid &account_id, const std::chrono::system_clock::time_point &start, const std::chrono::system_clock::time_point &end, std::uint32_t limit=1000) |
| Reads logs for a specific account. | |
| std::vector< domain::telemetry_stats > | read_hourly_stats (const domain::telemetry_stats_query &q) |
| Reads hourly statistics. | |
| std::vector< domain::telemetry_stats > | read_daily_stats (const domain::telemetry_stats_query &q) |
| Reads daily statistics. | |
| domain::telemetry_summary | get_summary (std::uint32_t hours=24) |
| Gets a summary of telemetry activity. | |
| std::uint64_t | count_errors (const std::string &source_name, std::uint32_t hours=1) |
| Counts error logs in the last N hours for a source. | |
| std::uint64_t | delete_old_logs (const std::chrono::system_clock::time_point &older_than) |
| Deletes logs older than the specified retention period. | |
Repository for telemetry log persistence and querying.
Handles CRUD operations for telemetry log records stored in a TimescaleDB hypertable. Supports time-range queries and statistics aggregation.
| std::size_t create_batch | ( | const domain::telemetry_batch & | batch | ) |
Creates multiple log entries in a batch.
More efficient than individual inserts for bulk operations.
| std::uint64_t count | ( | const domain::telemetry_query & | q | ) |
Counts log entries matching a query.
Useful for pagination.
| std::vector< domain::telemetry_log_entry > read_by_session | ( | const boost::uuids::uuid & | session_id, |
| std::uint32_t | limit = 1000 |
||
| ) |
Reads logs for a specific session.
| session_id | The session UUID |
| limit | Maximum number of logs to return |
| std::vector< domain::telemetry_log_entry > read_by_account | ( | const boost::uuids::uuid & | account_id, |
| const std::chrono::system_clock::time_point & | start, | ||
| const std::chrono::system_clock::time_point & | end, | ||
| std::uint32_t | limit = 1000 |
||
| ) |
Reads logs for a specific account.
| account_id | The account UUID |
| start | Start of time range |
| end | End of time range |
| limit | Maximum number of logs to return |
| domain::telemetry_summary get_summary | ( | std::uint32_t | hours = 24 | ) |
Gets a summary of telemetry activity.
| hours | Number of hours to include (default: 24) |
| std::uint64_t count_errors | ( | const std::string & | source_name, |
| std::uint32_t | hours = 1 |
||
| ) |
Counts error logs in the last N hours for a source.
Useful for monitoring and alerting.
| std::uint64_t delete_old_logs | ( | const std::chrono::system_clock::time_point & | older_than | ) |
Deletes logs older than the specified retention period.
Note: With TimescaleDB, this is typically handled by retention policies. This method is for manual cleanup or non-TimescaleDB deployments.
| older_than | Delete logs older than this timestamp |