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 119 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 81 of file utils.cpp.

81 {
82 for (auto& status : statuses) {
83 status.store(0, std::memory_order_relaxed);
84 }
85}
std::array< std::atomic< unsigned >, 600 > statuses
Per-code histogram for HTTP 0..599.
Definition utils.hpp:134

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 130 of file utils.hpp.

130 {
131 0
132 };

◆ network_ms

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

Total time spent in libcurl (ms).

Definition at line 127 of file utils.hpp.

127 {
128 0
129 };

◆ requests

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

Finished attempts (success or failure).

Definition at line 120 of file utils.hpp.

120 {
121 0
122 };

◆ retries

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

Number of retry cycles triggered.

Definition at line 123 of file utils.hpp.

123{ 0 };

◆ sleep_ms

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

Total backoff duration slept (ms).

Definition at line 124 of file utils.hpp.

124 {
125 0
126 };

◆ statuses

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

Per-code histogram for HTTP 0..599.

Definition at line 134 of file utils.hpp.


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