# StatCollector.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/network/monitor/StatCollector.hpp"

# ConnectionStats

ConnectionStats.

namespace oatpp { namespace network { namespace monitor { 
  struct ConnectionStats {}
}}}

# Fields

Type Name Summary
v_int64 timestampCreated Timestamp created microseconds. When connection was created.
v_io_size totalRead Total bytes read from the connection. Logs all bytes when the read method is called.
v_io_size totalWrite Total bytes written to the connection. Logs all bytes when the write method is called.
v_int64 timestampLastRead Timestamp microseconds when the last successful read was performed on the connection.
v_int64 timestampLastWrite Timestamp microseconds when the last successful write was performed on the connection.
v_io_size lastReadSize Amount of bytes read during the last successful read.
v_io_size lastWriteSize Amount of bytes written during the last successful write.
std::unordered_map<oatpp::String, void*> metricsData Data collected by stat-collectors - StatCollector

# ConnectionStats::timestampCreated

Timestamp created microseconds. When connection was created.

v_int64 timestampCreated = 0

# ConnectionStats::totalRead

Total bytes read from the connection. Logs all bytes when the read method is called.

v_io_size totalRead = 0

# ConnectionStats::totalWrite

Total bytes written to the connection. Logs all bytes when the write method is called.

v_io_size totalWrite = 0

# ConnectionStats::timestampLastRead

Timestamp microseconds when the last successful read was performed on the connection.

v_int64 timestampLastRead = 0

# ConnectionStats::timestampLastWrite

Timestamp microseconds when the last successful write was performed on the connection.

v_int64 timestampLastWrite = 0

# ConnectionStats::lastReadSize

Amount of bytes read during the last successful read.

v_io_size lastReadSize = 0

# ConnectionStats::lastWriteSize

Amount of bytes written during the last successful write.

v_io_size lastWriteSize = 0

# ConnectionStats::metricsData

Data collected by stat-collectors - StatCollector

std::unordered_map<oatpp::String, void*> metricsData

# StatCollector

StatCollector collects metrics data of the connection.

namespace oatpp { namespace network { namespace monitor { 
  class StatCollector : public oatpp::base::Countable {}
}}}

# Methods

Return Type Name Summary
[none] ~StatCollector Default virtual destructor.
oatpp::String metricName Unique metric name that is collected by this StatCollector.
void* createMetricData Metric data constructor.
void deleteMetricData Metric data destructor.
void onRead On connection read event.
void onWrite On connection write event.

# StatCollector::~StatCollector

Default virtual destructor.

virtual ~StatCollector() = default

# StatCollector::metricName

Unique metric name that is collected by this StatCollector.

virtual oatpp::String metricName() = 0

# StatCollector::createMetricData

Metric data constructor.

  • @return

virtual void* createMetricData() = 0

# StatCollector::deleteMetricData

Metric data destructor.

  • @param metricData

virtual void deleteMetricData(void* metricData) = 0

# StatCollector::onRead

On connection read event.

  • @param metricData - metric data of the given connection.- the one created in the createMetricData method.
  • @param readResult - result of the connection read method.
  • @param timestamp - timestamp microseconds when the connection read method was called.

virtual void onRead(void* metricData, v_io_size readResult, v_int64 timestamp) = 0

# StatCollector::onWrite

On connection write event.

  • @param metricData - metric data of the given connection.- the one created in the createMetricData method.
  • @param writeResult - result of the connection write method.
  • @param timestamp - timestamp microseconds when the connection write method was called.

virtual void onWrite(void* metricData, v_io_size writeResult, v_int64 timestamp) = 0