#include <cstdlib>
#include <iostream>
#include <string>
{
std::cout << "=== Network Metrics Example ===" << std::endl;
std::cout << "\n1. Histogram (latency tracking):" << std::endl;
double latencies[] = {1.2, 2.5, 1.8, 3.1, 2.0, 1.5, 4.2, 2.8, 1.9, 2.3};
for (double lat : latencies)
{
}
auto snapshot = latency_hist.get_snapshot();
std::cout << " Recorded 10 latency measurements" << std::endl;
std::cout << " Snapshot retrieved" << std::endl;
std::cout << "\n2. Metric reporter:" << std::endl;
metrics::metric_reporter::report_connection_accepted();
std::cout << " Reported: connection accepted" << std::endl;
metrics::metric_reporter::report_bytes_sent(1024);
std::cout << " Reported: 1024 bytes sent" << std::endl;
metrics::metric_reporter::report_latency(2.5);
std::cout << " Reported: 2.5ms latency" << std::endl;
metrics::metric_reporter::report_connection_failed("timeout");
std::cout << " Reported: connection failed (timeout)" << std::endl;
std::cout << "\n3. Standard metric names:" << std::endl;
std::cout << " Active connections: " << metrics::metric_names::CONNECTIONS_ACTIVE << std::endl;
std::cout << " Bytes sent: " << metrics::metric_names::BYTES_SENT << std::endl;
std::cout << " Latency: " << metrics::metric_names::LATENCY_MS << std::endl;
std::cout << "\nDone." << std::endl;
return 0;
}
Thread-safe histogram for capturing value distributions.
void record(double value)
Record a value observation.
Unified metrics header for network_system.
Main namespace for all Network System components.