26 #include <string_view> 40 static constexpr std::string_view filePath =
"/proc/1/net/dev"sv;
42 static constexpr std::string_view sourcePrefix =
"network"sv;
43 static constexpr std::string_view fieldNameInterfaceDescription =
"interface"sv;
44 static constexpr std::string_view fieldRecieve =
"rx"sv;
45 static constexpr std::string_view fieldTransmit =
"tx"sv;
46 static constexpr std::string_view fieldNameAll =
"*"sv;
47 static constexpr std::array fieldUnitsAssociation = {
KeyUnit{
"bytes"sv,
"bytes"sv},
KeyUnit{
"packets"sv,
"packets"sv},
KeyUnit{
"compressed"sv,
"packets"sv},
KeyUnit{
"multicast"sv,
"packets"sv} };
48 static constexpr std::string_view defaultUnit =
"errors"sv;
68 size_t fieldCount() const noexcept override final;
69 const
std::vector<
size_t> indexesOfFieldName(const
FieldName& fieldName,
Interests* interests =
nullptr) const noexcept override final;
70 const
std::
string fieldNameSourcePrefix() const noexcept override final;
71 const
FieldInfo fieldInfoAtIndex(
size_t index) const noexcept override final;
72 const
std::vector<
FieldInfo> allFieldsInfo() const noexcept override final;
74 void fetchData(const
Interests& interests, DataArray::
Iterator current) override final;
Object used to describe a field (or metric)
std::vector< std::string > rxFieldNames_
Reception metric names.
Sources of network metrics extracted from the file /proc/net/dev.
Stuct to associate a field name containing a certain key with a unit.
std::vector< std::string > txFieldNames_
Transmission metric names.
std::vector< std::string > FieldName
Type used for field names (an array of strings)
Namespace for sources of metrics objects and operations.
std::ifstream file_
File descriptor.
std::vector< DataValueType >::const_iterator ConstIterator
Const iterator type of MetricsDataArray.
std::vector< char > buffer_
Buffer to put file contents into.
Boolean array to keep track of which fields a source has to fetch metrics for.
Singleton abstract class, base class of all metric sources classes.
std::vector< DataValueType >::iterator Iterator
Iterator type of MetricsDataArray.
std::vector< std::string > interfaces_
Network interfaces names.