/// The constructor returns a `DownloadManagementMetrics` instance.
The constructor returns a `DownloadManagementMetrics` instance.
The constructor returns a ` DownloadManagementMetrics ` instance .
pub fn new(metrics_registry: &MetricsRegistry) -> Self {
        Self {
            op_duration: metrics_registry.histogram_vec(
                "p2p_peermgmt_op_duration",
                "The time it took to execute the given op, in milliseconds",
                // 0.1ms, 0.2ms, 0.5ms, 1ms, 2ms, 5ms, 10ms, 20ms, 50ms, 100ms, 200ms, 500ms
                decimal_buckets(-4, -1),
                &["op"],
            ),
            // Artifact fields.
            artifacts_received: metrics_registry
                .int_counter("gossip_artifacts_received", "number of artifact received"),
            artifact_timeouts: metrics_registry
                .int_counter("artifact_timeouts", "number of artifact timeouts"),
            received_artifact_size: metrics_registry
                .int_gauge("gossip_received_artifact_size", "size of received artifact"),
            integrity_hash_check_failed: metrics_registry.int_counter(
                "integrity_hash_check_failed",
                "Number of times the integrity check failed for artifacts",
            ),
            // Chunking fields.
            chunks_requested: metrics_registry.int_counter(
                "gossip_chunks_requested",
                "Number of chunks that were requested",
            ),
            chunk_request_send_failed: metrics_registry.int_counter(
                "chunk_request_send_failed",
                "Number of chunk request send failures",
            ),
            chunks_received: metrics_registry
                .int_counter("gossip_chunks_received", "Number of chunks received"),
            chunk_delivery_time: metrics_registry.histogram_vec(
                "gossip_chunk_delivery_time",
                "Time it took to deliver a chunk after it has been requested (in milliseconds)",
                vec![
                    1.0, 2.0, 5.0, 10.0, 20.0, 50.0, 100.0, 200.0, 300.0, 400.0, 500.0, 600.0,
                    700.0, 800.0, 900.0, 1000.0, 1200.0, 1400.0, 1600.0, 1800.0, 2000.0, 2500.0,
                    3000.0, 4000.0, 5000.0, 7000.0, 10000.0, 20000.0,
                ],
                &["artifact_type"],
            ),
            chunks_sent: metrics_registry
                .int_counter("gossip_chunks_sent", "Number of chunks sent"),
            chunk_send_failed: metrics_registry
                .int_counter("chunkd_send_failed", "Number of chunk send failures"),
            chunks_timed_out: metrics_registry
                .int_counter("gossip_chunks_timedout", "Timed-out chunks"),
            connection_up_events: metrics_registry.int_counter(
                "gossip_connection_up_event",
                "Number of connection up events received",
            ),
            connection_down_events: metrics_registry.int_counter(
                "gossip_connection_down_event",
                "Number of connection down events received",
            ),
            chunks_download_failed: metrics_registry.int_counter(
                "gossip_chunks_download_failed",
                "Number for failed chunk downloads (for various reasons)",
            ),
            chunks_not_served_from_peer: metrics_registry.int_counter(
                "gossip_chunks_not_served_from_peer",
                "Number for time peers failed to serve a chunk",
            ),
            chunks_download_retry_attempts: metrics_registry.int_counter(
                "gossip_chunks_download_retried",
                "Number for times chunk downloads were retried",
            ),
            chunks_unsolicited_or_timed_out: metrics_registry.int_counter(
                "gossip_chunks_num_unsolicited",
                "Number for unsolicited chunks received",
            ),
            chunks_redundant_residue: metrics_registry.int_counter(
                "gossip_chunks_redundant_residue",
                "Number of chunks that were downloaded after the artifact was marked complete",
            ),
            chunks_verification_failed: metrics_registry.int_counter(
                "gossip_chunk_verification_failed",
                "Number of chunks that failed verification",
            ),
            // Adverts fields.
            adverts_sent: metrics_registry.int_counter(
                "gossip_adverts_sent",
                "Total number of artifact advertisements sent",
            ),
            adverts_by_action: metrics_registry.int_counter_vec(
                "gossip_adverts_by_action",
                "Total number of artifact advertisements sent, by action type",
                &["type"],
            ),
            adverts_send_failed: metrics_registry
                .int_counter("adverts_send_failed", "Number of advert send failures"),
            adverts_received: metrics_registry.int_counter(
                "gossip_adverts_received",
                "Number of adverts received from all peers",
            ),
            adverts_dropped: metrics_registry.int_counter(
                "gossip_adverts_ignored",
                "Number of adverts that were dropped",
            ),
            // Retransmission fields.
            retransmission_requests_sent: metrics_registry.int_counter(
                "retransmission_requests_sent",
                "Number of retransmission requests successfully sent",
            ),
            retransmission_request_send_failed: metrics_registry.int_counter(
                "retransmission_request_send_failed",
                "Critical error a lagging replica isn't able to send a retransmission request",
            ),
            retransmission_request_time: metrics_registry.histogram(
                "retransmission_request_time",
                "The time it took to send retransmission request, in milliseconds",
                vec![
                    1.0, 2.0, 5.0, 10.0, 20.0, 50.0, 100.0, 200.0, 300.0, 400.0, 500.0, 600.0,
                    700.0, 800.0, 900.0, 1000.0, 1200.0, 1400.0, 1600.0, 1800.0, 2000.0, 2500.0,
                    3000.0, 4000.0, 5000.0, 7000.0, 10000.0, 20000.0,
                ],
            ),
            // Registry version.
            registry_version_used: metrics_registry.int_gauge(
                "registry_version_used",
                "The registry version currently in use by P2P",
            ),
            // Nodes removed in P2P.
            nodes_removed: metrics_registry.int_counter(
                "p2p_nodes_removed",
                "Nodes removed by p2p based on registry node membership changes",
            ),
            // Download next stats.
            download_next_time: metrics_registry
                .int_gauge("download_next_time", "Time spent in download_next()"),
            download_next_total_entries: metrics_registry.int_gauge(
                "download_next_total_entries",
                "Total entries returned by get_peer_priority_queues()",
            ),
            download_next_visited: metrics_registry.int_gauge(
                "download_next_visited",
                "Entries checked by download_next()",
            ),
            download_next_selected: metrics_registry.int_gauge(
                "download_next_selected",
                "Entries selected for download by download_next()",
            ),
            download_next_calls: metrics_registry
                .int_counter("download_next_calls", "Num calls to download_next()"),
            download_next_retrans_requests_sent: metrics_registry.int_counter(
                "download_next_retrans_requests_sent",
                "Number of retransmission requests sent",
            ),
        }
    }
pub fn new ( metrics_registry : & MetricsRegistry ) -> Self { Self { op_duration : metrics_registry . histogram_vec ( " " , " " , // 0.1ms, 0.2ms, 0.5ms, 1ms, 2ms, 5ms, 10ms, 20ms, 50ms, 100ms, 200ms, 500ms decimal_buckets ( - 4 , - 1 ) , & [ " " ] , ) , // Artifact fields. artifacts_received : metrics_registry . int_counter ( " " , " " ) , artifact_timeouts : metrics_registry . int_counter ( " " , " " ) , received_artifact_size : metrics_registry . int_gauge ( " " , " " ) , integrity_hash_check_failed : metrics_registry . int_counter ( " " , " " , ) , // Chunking fields. chunks_requested : metrics_registry . int_counter ( " " , " " , ) , chunk_request_send_failed : metrics_registry . int_counter ( " " , " " , ) , chunks_received : metrics_registry . int_counter ( " " , " " ) , chunk_delivery_time : metrics_registry . histogram_vec ( " " , " " , vec ! [ 1.0 2.0 5.0 10.0 20.0 50.0 100.0 200.0 300.0 400.0 500.0 600.0 700.0 800.0 900.0 1000.0 1200.0 1400.0 1600.0 1800.0 2000.0 2500.0 3000.0 4000.0 5000.0 7000.0 10000.0 20000.0 ] , & [ " " ] , ) , chunks_sent : metrics_registry . int_counter ( " " , " " ) , chunk_send_failed : metrics_registry . int_counter ( " " , " " ) , chunks_timed_out : metrics_registry . int_counter ( " " , " " ) , connection_up_events : metrics_registry . int_counter ( " " , " " , ) , connection_down_events : metrics_registry . int_counter ( " " , " " , ) , chunks_download_failed : metrics_registry . int_counter ( " " , " " , ) , chunks_not_served_from_peer : metrics_registry . int_counter ( " " , " " , ) , chunks_download_retry_attempts : metrics_registry . int_counter ( " " , " " , ) , chunks_unsolicited_or_timed_out : metrics_registry . int_counter ( " " , " " , ) , chunks_redundant_residue : metrics_registry . int_counter ( " " , " " , ) , chunks_verification_failed : metrics_registry . int_counter ( " " , " " , ) , // Adverts fields. adverts_sent : metrics_registry . int_counter ( " " , " " , ) , adverts_by_action : metrics_registry . int_counter_vec ( " " , " " , & [ " " ] , ) , adverts_send_failed : metrics_registry . int_counter ( " " , " " ) , adverts_received : metrics_registry . int_counter ( " " , " " , ) , adverts_dropped : metrics_registry . int_counter ( " " , " " , ) , // Retransmission fields. retransmission_requests_sent : metrics_registry . int_counter ( " " , " " , ) , retransmission_request_send_failed : metrics_registry . int_counter ( " " , " " , ) , retransmission_request_time : metrics_registry . histogram ( " " , " " , vec ! [ 1.0 2.0 5.0 10.0 20.0 50.0 100.0 200.0 300.0 400.0 500.0 600.0 700.0 800.0 900.0 1000.0 1200.0 1400.0 1600.0 1800.0 2000.0 2500.0 3000.0 4000.0 5000.0 7000.0 10000.0 20000.0 ] , ) , // Registry version. registry_version_used : metrics_registry . int_gauge ( " " , " " , ) , // Nodes removed in P2P. nodes_removed : metrics_registry . int_counter ( " " , " " , ) , // Download next stats. download_next_time : metrics_registry . int_gauge ( " " , " " ) , download_next_total_entries : metrics_registry . int_gauge ( " " , " " , ) , download_next_visited : metrics_registry . int_gauge ( " " , " " , ) , download_next_selected : metrics_registry . int_gauge ( " " , " " , ) , download_next_calls : metrics_registry . int_counter ( " " , " " ) , download_next_retrans_requests_sent : metrics_registry . int_counter ( " " , " " , ) , } }
The constructor returns a `DownloadManagementMetrics` instance.
The constructor returns a ` DownloadManagementMetrics ` instance .
metrics_registry
&MetricsRegistry