20#ifndef ORES_TELEMETRY_EXPORTING_HYBRID_LOG_EXPORTER_HPP
21#define ORES_TELEMETRY_EXPORTING_HYBRID_LOG_EXPORTER_HPP
25#include <condition_variable>
34#include "ores.telemetry/exporting/log_exporter.hpp"
35#include "ores.telemetry/exporting/telemetry_options.hpp"
36#include "ores.telemetry/exporting/upload_position_tracker.hpp"
51 std::function<bool(std::vector<domain::log_record>)>;
104 void flush()
override;
149 void flush_thread_func();
152 std::mutex file_mutex_;
154 std::filesystem::path file_path_;
155 std::uint64_t file_position_ = 0;
162 std::mutex batch_mutex_;
163 std::vector<domain::log_record> pending_batch_;
165 std::atomic<bool> connected_{
false};
168 std::thread flush_thread_;
169 std::condition_variable flush_cv_;
170 std::atomic<bool> shutdown_requested_{
false};
171 std::chrono::steady_clock::time_point last_flush_time_;
Log export functionality for telemetry.
Definition file_log_exporter.hpp:28
std::function< bool(std::vector< domain::log_record >)> send_records_callback
Callback type for sending batched records to the server.
Definition hybrid_log_exporter.hpp:51
A log record with trace correlation.
Definition log_record.hpp:46
Hybrid exporter that writes to file and optionally streams to server.
Definition hybrid_log_exporter.hpp:68
void flush() override
Flushes pending records.
Definition hybrid_log_exporter.cpp:126
void export_record(domain::log_record record) override
Exports a log record.
Definition hybrid_log_exporter.cpp:116
void shutdown() override
Shuts down the exporter.
Definition hybrid_log_exporter.cpp:139
void set_connected(bool connected)
Updates the connection status.
Definition hybrid_log_exporter.cpp:161
std::uint64_t upload_position() const
Returns the current upload position.
Definition hybrid_log_exporter.cpp:170
Interface for exporting telemetry log records.
Definition log_exporter.hpp:36
Options related to telemetry export.
Definition telemetry_options.hpp:38
Tracks the upload position for telemetry log files.
Definition upload_position_tracker.hpp:43