blob: 2fc6764b5bb76c7173e85c92c515e2f4119c96bb [file] [log] [blame]
#ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_COLLECTOR_COLLECTOR_H_
#define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_COLLECTOR_COLLECTOR_H_
#include <climits>
#include <cstdint>
#include <string>
#include "absl/status/status.h"
#include "nlohmann/json.hpp"
namespace milotic_tlbmc {
// Interface for collecting telemetry data.
// Each concrete collector shall be responsible for collecting telemetry data
// for a specific resource type.
// Example: FruCollector collects FRU data, SensorCollector collects sensor
// data etc.
// Collected data shall be written to the data store or stored locally
class Collector {
public:
enum class Type : uint8_t {
kFru = 0,
kSensor,
};
// Config parameters for the collector.
struct Config {
// The sampling interval of the collector.
int sampling_interval_ms = INT_MIN;
// The key of the resource to be collected.
std::string key;
bool reset_to_default = false; // Reset to default.
};
virtual ~Collector() = default;
virtual nlohmann::json ToJson() const = 0;
// Returns the scheduler stats for the collector.
virtual nlohmann::json GetSchedulerStats() const = 0;
// Configures the collector.
virtual absl::Status ConfigureCollection(
[[maybe_unused]] const Config& config) const {
return absl::UnimplementedError(
"ConfigureCollection is not implemented for "
"this collector.");
}
};
} // namespace milotic_tlbmc
#endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_COLLECTOR_COLLECTOR_H_