Arachne 1.0
Arachne - the perpetual stitcher of Wikidata entities.
Loading...
Searching...
No Matches
corespace::network_metrics Struct Referencefinal

Thread-safe counters describing client-side networking activity. More...

#include <include/utils.hpp>

Public Member Functions

 network_metrics ()
 Zero-initialize per-status counters.

Public Attributes

std::atomic< unsigned > requests
 Finished attempts (success or failure).
std::atomic< unsigned > retries { 0 }
 Number of retry cycles triggered.
std::atomic< long long > sleep_ms
 Total backoff duration slept (ms).
std::atomic< long long > network_ms
 Total time spent in libcurl (ms).
std::atomic< size_t > bytes_received
 Sum of response body sizes (bytes).
std::array< std::atomic< unsigned >, 600 > statuses
 Per-code histogram for HTTP 0..599.

Detailed Description

Thread-safe counters describing client-side networking activity.

Semantics:

  • requests counts finished transfer attempts (successful or not).
  • retries counts retry cycles triggered by retryable outcomes.
  • sleep_ms is the total backoff time slept between attempts.
  • network_ms is the accumulated wall-clock duration spent inside libcurl for performed requests (sum over attempts).
  • bytes_received sums body sizes appended via the write callback.
  • statuses[i] counts responses with HTTP status i (0..599). Values outside the array bounds are ignored.

All counters are atomics and rely on the default sequentially consistent operations provided by std::atomic. Readers observe eventually consistent snapshots without additional synchronization.

Definition at line 107 of file utils.hpp.

Constructor & Destructor Documentation

◆ network_metrics()

corespace::network_metrics::network_metrics ( )

Zero-initialize per-status counters.

The constructor explicitly clears the statuses histogram.

Definition at line 28 of file utils.cpp.

28 {
29 for (auto& status : statuses) {
30 status.store(0, std::memory_order_relaxed);
31 }
32}
std::array< std::atomic< unsigned >, 600 > statuses
Per-code histogram for HTTP 0..599.
Definition utils.hpp:122

Member Data Documentation

◆ bytes_received

std::atomic<size_t> corespace::network_metrics::bytes_received
Initial value:
{
0
}

Sum of response body sizes (bytes).

Definition at line 118 of file utils.hpp.

118 {
119 0
120 };

◆ network_ms

std::atomic<long long> corespace::network_metrics::network_ms
Initial value:
{
0
}

Total time spent in libcurl (ms).

Definition at line 115 of file utils.hpp.

115 {
116 0
117 };

◆ requests

std::atomic<unsigned> corespace::network_metrics::requests
Initial value:
{
0
}

Finished attempts (success or failure).

Definition at line 108 of file utils.hpp.

108 {
109 0
110 };

◆ retries

std::atomic<unsigned> corespace::network_metrics::retries { 0 }

Number of retry cycles triggered.

Definition at line 111 of file utils.hpp.

111{ 0 };

◆ sleep_ms

std::atomic<long long> corespace::network_metrics::sleep_ms
Initial value:
{
0
}

Total backoff duration slept (ms).

Definition at line 112 of file utils.hpp.

112 {
113 0
114 };

◆ statuses

std::array<std::atomic<unsigned>, 600> corespace::network_metrics::statuses

Per-code histogram for HTTP 0..599.

Definition at line 122 of file utils.hpp.


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