InfluxDeviceData
struct InfluxDeviceData : public karabo::devices::DeviceData
Types
| Name | Description |
|---|---|
| LoggingRecord | @brief The size, in characters, and the epoch seconds of a device log entry saved to Influx. |
Functions
| Name | Description |
|---|---|
| login | Helper to store logging start event configuration : full device configuration received when logging starts sortedPaths : full paths of configuration, sorted by increasing timestamp |
| newPropLogRate | @brief Calculates what the value of the property logging rate of the device will be when the logging of a value with a given size and a given timestamp is taken into account. |
| newSchemaLogRate | @brief Calculates what the value of the schema logging rate of the device will be when the logging of a schema with a given size is taken into account. |
| logNewSchema | @brief Logs a new schema into the corresponding device's __SCHEMA measurement. |
| logRejectedData | @brief Logs the given set of rejected data in the BAD__DATA measurement and to the Karabo log. |
| logRejectedDatum | @brief Logs the given rejected data record in the BAD__DATA measurement and to the Karabo log. |
Function Details
logNewSchema
bool logNewSchema(const std::string& schemaDigest, const std::vector<char>& schemaArchive)
@brief Logs a new schema into the corresponding device's __SCHEMA measurement. It is assumed that the verification of the uniquiness of the device schema has already been verified based on its digest.
schemaDigest
: The digest (assumed unique) of the new schema to be saved.
schemaArchive
: The serialised schema to be saved
Return : true If the new schema has been successfuly submitted for logging.
Return : false If the logging of the new schema has not been submitted for logging. Currently, this happens if logging the new schema would be above the allowed schema logging rate threshold for a device.
logRejectedData
void logRejectedData(const std::vector<RejectedData>& rejects, unsigned long long ts)
@brief Logs the given set of rejected data in the BAD__DATA measurement and to the Karabo log. To avoid spanning of the Karabo log, log is emmitted for each device only once in a period of 30 secs.
rejects
: The rejected data to be logged.
ts
: An epoch with the precision expected in the InfluxDb.
logRejectedDatum
void logRejectedDatum(const RejectedData& rejects)
@brief Logs the given rejected data record in the BAD__DATA measurement and to the Karabo log. To avoid spanning of the Karabo log, log is emmitted for each device only once in a period of 30 secs.
rejects
: The rejected data to be logged.
login
void login(const karabo::data::Hash& configuration, const std::vector<std::string>& sortedPaths)
Helper to store logging start event
configuration
: full device configuration received when logging starts
sortedPaths
: full paths of configuration, sorted by increasing timestamp
newPropLogRate
unsigned int newPropLogRate(const std::string& propPath, karabo::data::Epochstamp currentStamp, std::size_t currentSize)
@brief Calculates what the value of the property logging rate of the device will be when the logging of a value with a given size and a given timestamp is taken into account.
prop
: The path of the property whose current logging rate will be evaluated.
currentStamp
: The current property update timestamp.
currentSize
: The size for the new data to be logged - this is used along with the other
records in the current log rating window to calculate the new value for the property logging rate.
Return : The updated value of the property logging rate, in bytes/sec, taking the logging of the value into account.
newSchemaLogRate
unsigned int newSchemaLogRate(std::size_t schemaSize)
@brief Calculates what the value of the schema logging rate of the device will be when the logging of a schema with a given size is taken into account. As schemas currently don't have associated time information, the current system time is used for all the timing references.
schemaSize
: The size for the new schema to be logged - this is used along with the other
records in the current log rating window to calculate the new value for the schema logging rate.
Return : The updated value of the schema logging rate, in bytes/sec, taking the logging of the schema into account.