MetroCollect  2.3.4
MetroCollect::MetricsSource::SourceEthtool Class Reference

Sources of network metrics extracted from Ethtool interface. More...

#include <SourceEthtool.h>

Inheritance diagram for MetroCollect::MetricsSource::SourceEthtool:
Collaboration diagram for MetroCollect::MetricsSource::SourceEthtool:

Classes

class  EthtoolPointer
 Class managing a pointer to a dynamically sized type. More...
 
struct  InterfaceInfo
 Class to store the details and metrics names of a network interface. More...
 
struct  Socketfd
 Struct managing an Ethtool socket. More...
 

Public Member Functions

size_t fieldCount () const noexcept override final
 Get the number of field the source has. More...
 
const std::vector< size_t > indexesOfFieldName (const FieldName &fieldName, Interests *interests=nullptr) const noexcept override final
 Search for fields associated to a specific name. More...
 
const std::string fieldNameSourcePrefix () const noexcept override final
 Get the prefix by which all field names should begin with. More...
 
const FieldInfo fieldInfoAtIndex (size_t index) const noexcept override final
 Get details about a specific field. More...
 
const std::vector< FieldInfoallFieldsInfo () const noexcept override final
 Get all fields details, field which share a common name should appear only once. More...
 
void fetchData (const Interests &interests, DataArray::Iterator current) override final
 Fetch the latest metrics. More...
 
void computeDiff (const Interests &interests, DiffArray::Iterator diff, DataArray::ConstIterator current, DataArray::ConstIterator previous, double factor=1) noexcept override final
 Compute the variation (in appropriate unit) of metrics. More...
 
- Public Member Functions inherited from MetroCollect::MetricsSource::SourceBase
 SourceBase (const SourceBase &)=delete
 Deleted copy constructor. More...
 
void operator= (const SourceBase &)=delete
 Deleted copy operator. More...
 

Static Public Member Functions

static SourceEthtoolget ()
 Get the Instance object. More...
 

Protected Member Functions

 SourceEthtool ()
 Private default constructor. More...
 
void gatherIfData ()
 Gather details on interfaces. More...
 
InterfaceInfo::NameAndIndex parseEthtoolString (std::string ethtoolString)
 Parse raw Ethtool metric name. More...
 
void ixgbeIfFilter (InterfaceInfo &ifInfo)
 Filter out relevant metrics for ixgbe driver. More...
 
- Protected Member Functions inherited from MetroCollect::MetricsSource::SourceBase
 SourceBase ()
 Protected default constructor. More...
 
 ~SourceBase ()
 Protected default destructor. More...
 

Protected Attributes

std::vector< InterfaceInfoifInfo_
 Array holding details of each network interface. More...
 
Socketfd socketfd_
 Ethtool socket manager. More...
 

Static Protected Attributes

static constexpr std::string_view sourcePrefix = "ethtool"sv
 Metrics name source prefix. More...
 
static constexpr std::string_view fieldNameAll = "*"sv
 Metrics name wildcard. More...
 
static constexpr std::string_view fieldNameInterfaceDescription = "interface"sv
 Metrics name category description. More...
 
static constexpr std::string_view fieldNameIndexDescription = "index"sv
 Metrics name category description. More...
 
static constexpr std::array fieldUnitsAssociation = { KeyUnit{"bytes"sv, "bytes"sv}, KeyUnit{"packets"sv, "packets"sv}, KeyUnit{"pkts"sv, "packets"sv} }
 Metric units associations. More...
 
static constexpr std::string_view defaultUnit = ""sv
 Metric unit. More...
 

Detailed Description

Sources of network metrics extracted from Ethtool interface.

Definition at line 40 of file SourceEthtool.h.

Constructor & Destructor Documentation

◆ SourceEthtool()

MetroCollect::MetricsSource::SourceEthtool::SourceEthtool ( )
protected

Private default constructor.

Definition at line 65 of file SourceEthtool.cc.

Here is the call graph for this function:

Member Function Documentation

◆ allFieldsInfo()

const std::vector< FieldInfo > MetroCollect::MetricsSource::SourceEthtool::allFieldsInfo ( ) const
finaloverridevirtualnoexcept

Get all fields details, field which share a common name should appear only once.

Returns
all fields details

Implements MetroCollect::MetricsSource::SourceBase.

Definition at line 253 of file SourceEthtool.cc.

Here is the call graph for this function:

◆ computeDiff()

void MetroCollect::MetricsSource::SourceEthtool::computeDiff ( const Interests interests,
DiffArray::Iterator  diff,
DataArray::ConstIterator  current,
DataArray::ConstIterator  previous,
double  factor = 1 
)
finaloverridevirtualnoexcept

Compute the variation (in appropriate unit) of metrics.

Parameters
interestsinterests boolean array to know for which fields metrics variation should be computed
diffiterator to write metrics variation to
currentiterator to read latest metrics from
previousiterator to read previous metrics from
factorfactor to convert to unit per second, if relevant

Implements MetroCollect::MetricsSource::SourceBase.

Definition at line 315 of file SourceEthtool.cc.

◆ fetchData()

void MetroCollect::MetricsSource::SourceEthtool::fetchData ( const Interests interests,
DataArray::Iterator  current 
)
finaloverridevirtual

Fetch the latest metrics.

Parameters
interestsboolean array to know for which fields metrics should be fetched
currentiterator to write metrics to

Implements MetroCollect::MetricsSource::SourceBase.

Definition at line 289 of file SourceEthtool.cc.

Here is the call graph for this function:

◆ fieldCount()

size_t MetroCollect::MetricsSource::SourceEthtool::fieldCount ( ) const
finaloverridevirtualnoexcept

Get the number of field the source has.

Returns
Number of fields of the source

Implements MetroCollect::MetricsSource::SourceBase.

Definition at line 197 of file SourceEthtool.cc.

Here is the caller graph for this function:

◆ fieldInfoAtIndex()

const FieldInfo MetroCollect::MetricsSource::SourceEthtool::fieldInfoAtIndex ( size_t  index) const
finaloverridevirtualnoexcept

Get details about a specific field.

Parameters
indexindex of the field to get details of
Returns
details of the field

Implements MetroCollect::MetricsSource::SourceBase.

Definition at line 235 of file SourceEthtool.cc.

Here is the call graph for this function:

◆ fieldNameSourcePrefix()

const std::string MetroCollect::MetricsSource::SourceEthtool::fieldNameSourcePrefix ( ) const
finaloverridevirtualnoexcept

Get the prefix by which all field names should begin with.

Returns
the source's names prefix

Implements MetroCollect::MetricsSource::SourceBase.

Definition at line 231 of file SourceEthtool.cc.

◆ gatherIfData()

void MetroCollect::MetricsSource::SourceEthtool::gatherIfData ( )
protected

Gather details on interfaces.

Definition at line 70 of file SourceEthtool.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get()

static SourceEthtool& MetroCollect::MetricsSource::SourceEthtool::get ( )
inlinestatic

Get the Instance object.

Definition at line 247 of file SourceEthtool.h.

◆ indexesOfFieldName()

const std::vector< size_t > MetroCollect::MetricsSource::SourceEthtool::indexesOfFieldName ( const FieldName fieldName,
Interests interests = nullptr 
) const
finaloverridevirtualnoexcept

Search for fields associated to a specific name.

Parameters
fieldNamethe name of the fields to search
interestsif the pointer is not nullptr, the interest bit corresponding to the fields will be set
Returns
the indexes associated with the field name

Implements MetroCollect::MetricsSource::SourceBase.

Definition at line 204 of file SourceEthtool.cc.

◆ ixgbeIfFilter()

void MetroCollect::MetricsSource::SourceEthtool::ixgbeIfFilter ( InterfaceInfo ifInfo)
protected

Filter out relevant metrics for ixgbe driver.

Definition at line 176 of file SourceEthtool.cc.

Here is the caller graph for this function:

◆ parseEthtoolString()

SourceEthtool::InterfaceInfo::NameAndIndex MetroCollect::MetricsSource::SourceEthtool::parseEthtoolString ( std::string  ethtoolString)
protected

Parse raw Ethtool metric name.

Definition at line 129 of file SourceEthtool.cc.

Here is the caller graph for this function:

Member Data Documentation

◆ defaultUnit

constexpr std::string_view MetroCollect::MetricsSource::SourceEthtool::defaultUnit = ""sv
staticprotected

Metric unit.

Definition at line 47 of file SourceEthtool.h.

◆ fieldNameAll

constexpr std::string_view MetroCollect::MetricsSource::SourceEthtool::fieldNameAll = "*"sv
staticprotected

Metrics name wildcard.

Definition at line 43 of file SourceEthtool.h.

◆ fieldNameIndexDescription

constexpr std::string_view MetroCollect::MetricsSource::SourceEthtool::fieldNameIndexDescription = "index"sv
staticprotected

Metrics name category description.

Definition at line 45 of file SourceEthtool.h.

◆ fieldNameInterfaceDescription

constexpr std::string_view MetroCollect::MetricsSource::SourceEthtool::fieldNameInterfaceDescription = "interface"sv
staticprotected

Metrics name category description.

Definition at line 44 of file SourceEthtool.h.

◆ fieldUnitsAssociation

constexpr std::array MetroCollect::MetricsSource::SourceEthtool::fieldUnitsAssociation = { KeyUnit{"bytes"sv, "bytes"sv}, KeyUnit{"packets"sv, "packets"sv}, KeyUnit{"pkts"sv, "packets"sv} }
staticprotected

Metric units associations.

Definition at line 46 of file SourceEthtool.h.

◆ ifInfo_

std::vector<InterfaceInfo> MetroCollect::MetricsSource::SourceEthtool::ifInfo_
protected

Array holding details of each network interface.

Definition at line 235 of file SourceEthtool.h.

◆ socketfd_

Socketfd MetroCollect::MetricsSource::SourceEthtool::socketfd_
protected

Ethtool socket manager.

Definition at line 236 of file SourceEthtool.h.

◆ sourcePrefix

constexpr std::string_view MetroCollect::MetricsSource::SourceEthtool::sourcePrefix = "ethtool"sv
staticprotected

Metrics name source prefix.

Definition at line 42 of file SourceEthtool.h.


The documentation for this class was generated from the following files: