ORE Studio 0.0.4
Loading...
Searching...
No Matches
telemetry_entity.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_TELEMETRY_REPOSITORY_TELEMETRY_ENTITY_HPP
21#define ORES_TELEMETRY_REPOSITORY_TELEMETRY_ENTITY_HPP
22
23#include <string>
24#include <cstdint>
25#include <iosfwd>
26#include "sqlgen/Timestamp.hpp"
27#include "sqlgen/PrimaryKey.hpp"
28
30
38 constexpr static const char* schema = "production";
39 constexpr static const char* tablename = "telemetry_logs_tbl";
40
44 sqlgen::PrimaryKey<std::string> id;
45
51 sqlgen::PrimaryKey<sqlgen::Timestamp<"%Y-%m-%d %H:%M:%S">> timestamp;
52
56 std::string source;
57
61 std::string source_name;
62
69 std::string session_id;
70
74 std::string account_id;
75
79 std::string level;
80
84 std::string component;
85
89 std::string message;
90
94 std::string tag;
95
99 sqlgen::Timestamp<"%Y-%m-%d %H:%M:%S"> recorded_at;
100};
101
102std::ostream& operator<<(std::ostream& s, const telemetry_entity& v);
103
108 constexpr static const char* schema = "production";
109 constexpr static const char* tablename = "telemetry_stats_hourly_vw";
110
111 std::string hour;
112 std::string source;
113 std::string source_name;
114 std::string level;
115 std::int64_t log_count = 0;
116 std::int64_t unique_sessions = 0;
117 std::int64_t unique_accounts = 0;
118};
119
120std::ostream& operator<<(std::ostream& s, const telemetry_stats_hourly_entity& v);
121
126 constexpr static const char* schema = "production";
127 constexpr static const char* tablename = "telemetry_stats_daily_vw";
128
129 std::string day;
130 std::string source;
131 std::string source_name;
132 std::string component;
133 std::string level;
134 std::int64_t log_count = 0;
135 std::int64_t unique_sessions = 0;
136 std::int64_t unique_accounts = 0;
137};
138
139std::ostream& operator<<(std::ostream& s, const telemetry_stats_daily_entity& v);
140
141}
142
143#endif
std::basic_ostream< CharT, TraitsT > & operator<<(std::basic_ostream< CharT, TraitsT > &stream, boost_severity level)
Inserter for boost_severity enum.
Definition boost_severity.hpp:80
Database persistence layer for telemetry data.
Definition ores.telemetry.repository.hpp:36
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:56
std::string level
Log severity level.
Definition telemetry_entity.hpp:79
std::string session_id
Session ID (empty string for no session).
Definition telemetry_entity.hpp:69
std::string message
Log message body.
Definition telemetry_entity.hpp:89
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:99
sqlgen::PrimaryKey< sqlgen::Timestamp<"%Y-%m-%d %H:%M:%S"> > timestamp
Log timestamp - part of composite primary key.
Definition telemetry_entity.hpp:51
std::string account_id
Account ID (empty string for no account).
Definition telemetry_entity.hpp:74
std::string component
Logger/component name.
Definition telemetry_entity.hpp:84
std::string source_name
Source application name.
Definition telemetry_entity.hpp:61
std::string tag
Optional tag for filtering.
Definition telemetry_entity.hpp:94
Entity for hourly telemetry statistics from continuous aggregates.
Definition telemetry_entity.hpp:107
Entity for daily telemetry statistics from continuous aggregates.
Definition telemetry_entity.hpp:125