20#ifndef ORES_TELEMETRY_REPOSITORY_TELEMETRY_ENTITY_HPP
21#define ORES_TELEMETRY_REPOSITORY_TELEMETRY_ENTITY_HPP
26#include "sqlgen/Timestamp.hpp"
27#include "sqlgen/PrimaryKey.hpp"
29namespace ores::telemetry::database::repository {
38 constexpr static const char* schema =
"public";
39 constexpr static const char* tablename =
"ores_telemetry_logs_tbl";
44 sqlgen::PrimaryKey<std::string>
id;
56 sqlgen::PrimaryKey<sqlgen::Timestamp<
"%Y-%m-%d %H:%M:%S">>
timestamp;
110 constexpr static const char* schema =
"public";
111 constexpr static const char* tablename =
"ores_telemetry_stats_hourly_vw";
115 std::string source_name;
117 std::int64_t log_count = 0;
118 std::int64_t unique_sessions = 0;
119 std::int64_t unique_accounts = 0;
128 constexpr static const char* schema =
"public";
129 constexpr static const char* tablename =
"ores_telemetry_stats_daily_vw";
133 std::string source_name;
134 std::string component;
136 std::int64_t log_count = 0;
137 std::int64_t unique_sessions = 0;
138 std::int64_t unique_accounts = 0;
149 constexpr static const char* schema =
"public";
150 constexpr static const char* tablename =
"ores_telemetry_nats_server_samples_tbl";
152 sqlgen::PrimaryKey<sqlgen::Timestamp<
"%Y-%m-%d %H:%M:%S">> sampled_at;
153 sqlgen::PrimaryKey<std::string> tenant_id;
154 std::int64_t in_msgs{0};
155 std::int64_t out_msgs{0};
156 std::int64_t in_bytes{0};
157 std::int64_t out_bytes{0};
159 std::int64_t mem_bytes{0};
160 int slow_consumers{0};
169 constexpr static const char* schema =
"public";
170 constexpr static const char* tablename =
"ores_telemetry_service_samples_tbl";
172 sqlgen::PrimaryKey<sqlgen::Timestamp<
"%Y-%m-%d %H:%M:%S">> sampled_at;
173 sqlgen::PrimaryKey<std::string> service_name;
174 sqlgen::PrimaryKey<std::string> instance_id;
184 constexpr static const char* schema =
"public";
185 constexpr static const char* tablename =
"ores_telemetry_nats_stream_samples_tbl";
187 sqlgen::PrimaryKey<sqlgen::Timestamp<
"%Y-%m-%d %H:%M:%S">> sampled_at;
188 sqlgen::PrimaryKey<std::string> tenant_id;
189 sqlgen::PrimaryKey<std::string> stream_name;
190 std::int64_t messages{0};
191 std::int64_t bytes{0};
192 int consumer_count{0};
Represents a telemetry log record in the database.
Definition telemetry_entity.hpp:37
std::string source
Source type ('client' or 'server').
Definition telemetry_entity.hpp:61
std::string level
Log severity level.
Definition telemetry_entity.hpp:81
std::optional< std::string > account_id
Account ID (nullopt for no account).
Definition telemetry_entity.hpp:76
std::optional< std::string > session_id
Session ID (nullopt for no session).
Definition telemetry_entity.hpp:71
std::string message
Log message body.
Definition telemetry_entity.hpp:91
sqlgen::PrimaryKey< std::string > id
Log entry UUID - part of composite primary key.
Definition telemetry_entity.hpp:44
sqlgen::Timestamp<"%Y-%m-%d %H:%M:%S"> recorded_at
Server receipt timestamp.
Definition telemetry_entity.hpp:101
sqlgen::PrimaryKey< sqlgen::Timestamp<"%Y-%m-%d %H:%M:%S"> > timestamp
Log timestamp - part of composite primary key.
Definition telemetry_entity.hpp:56
std::string component
Logger/component name.
Definition telemetry_entity.hpp:86
std::string source_name
Source application name.
Definition telemetry_entity.hpp:66
std::string tag
Optional tag for filtering.
Definition telemetry_entity.hpp:96
std::string tenant_id
Tenant ID for multi-tenancy isolation.
Definition telemetry_entity.hpp:49
Entity for hourly telemetry statistics from continuous aggregates.
Definition telemetry_entity.hpp:109
Entity for daily telemetry statistics from continuous aggregates.
Definition telemetry_entity.hpp:127
Entity for a NATS server-level metrics sample.
Definition telemetry_entity.hpp:148
Entity for a single service heartbeat sample.
Definition telemetry_entity.hpp:168
Entity for a single JetStream stream metrics sample.
Definition telemetry_entity.hpp:183