4 #include <north_plugin.h> 5 #include <reading_set.h> 9 #include <condition_variable> 10 #include <perfmonitors.h> 13 #define FLUSH_STATS_INTERVAL 5 15 #define STATS_UPDATE_FAIL_THRESHOLD 3 18 #define FAILURE_BACKOFF_THRESHOLD 10 // Number of consequetive failures to trigger backoff 19 #define MIN_SEND_BACKOFF 50 // Min backoff in milliseconds 20 #define MAX_SEND_BACKOFF 500 // Max backoff in milliseconds 30 void updatePlugin(
NorthPlugin *plugin) { m_plugin = plugin; };
34 bool isRunning() {
return !m_shutdown; };
38 void updateStatistics(uint32_t increment);
39 bool createStats(
const std::string &key,
unsigned int value);
47 volatile bool m_shutdown;
48 std::thread *m_thread;
52 std::mutex m_pauseMutex;
53 std::condition_variable m_pauseCV;
56 std::thread *m_statsThread;
57 std::mutex m_flushStatsMtx;
59 std::condition_variable m_statsCv;
60 std::mutex m_statsMtx;
61 std::map<std::string, unsigned int>
62 m_statsPendingEntries;
63 int m_statsUpdateFails;
65 std::unordered_set<std::string>
66 m_statsDbEntriesCache;
67 unsigned int m_repeatedFailure;
68 unsigned int m_sendBackoffTime;
Fledge Logger class used to log to syslog.
Definition: logger.h:26
The NorthService class.
Definition: north_service.h:34
bool isDryRun()
Check status of dryrun flag.
Definition: data_send.cpp:514
A class used in the North service to load data from the buffer.
Definition: data_load.h:24
Definition: data_sender.h:25
Reading set class.
Definition: reading_set.h:26
void pause()
Cause the data sender process to pause sending data until a corresponding release call is made...
Definition: data_send.cpp:279
DataSender(NorthPlugin *plugin, DataLoad *loader, NorthService *north)
Constructor for the data sending class.
Definition: data_send.cpp:42
void release()
Release the paused data sender thread.
Definition: data_send.cpp:293
~DataSender()
Destructor for the data sender class.
Definition: data_send.cpp:72
Class that represents a north plugin.
Definition: north_plugin.h:33
void sendThread()
The sending thread entry point.
Definition: data_send.cpp:91
void flushStatistics()
Flush statistics to storage service.
Definition: data_send.cpp:349