pub(super) fn new(registry: Registry) -> Result<Self, prometheus::Error> {
        let mem_total = IntGauge::new("mem_total", "total memory usage in bytes")?;
        let mem_metrics = IntGauge::new("mem_metrics", "metrics memory usage in bytes")?;
        let mem_net = IntGauge::new("mem_net", "network memory usage in bytes")?;
        let mem_address_gossiper = IntGauge::new(
            "mem_address_gossiper",
            "address_gossiper memory usage in bytes",
        )?;
        let mem_storage = IntGauge::new("mem_storage", "storage memory usage in bytes")?;
        let mem_contract_runtime = IntGauge::new(
            "mem_contract_runtime",
            "contract runtime memory usage in bytes",
        )?;
        let mem_rpc_server = IntGauge::new("mem_rpc_server", "rpc server memory usage in bytes")?;
        let mem_rest_server =
            IntGauge::new("mem_rest_server", "rest server memory usage in bytes")?;
        let mem_event_stream_server = IntGauge::new(
            "mem_event_stream_server",
            "event stream server memory usage in bytes",
        )?;
        let mem_chainspec_loader = IntGauge::new(
            "mem_chainspec_loader",
            "chainspec loader memory usage in bytes",
        )?;
        let mem_consensus = IntGauge::new("mem_consensus", "consensus memory usage in bytes")?;
        let mem_deploy_fetcher =
            IntGauge::new("mem_deploy_fetcher", "deploy fetcher memory usage in bytes")?;
        let mem_deploy_gossiper = IntGauge::new(
            "mem_deploy_gossiper",
            "deploy gossiper memory usage in bytes",
        )?;
        let mem_block_proposer =
            IntGauge::new("mem_block_proposer", "block proposer memory usage in bytes")?;
        let mem_block_validator = IntGauge::new(
            "mem_block_validator",
            "block validator memory usage in bytes",
        )?;
        let mem_linear_chain =
            IntGauge::new("mem_linear_chain", "linear chain memory usage in bytes")?;

        let mem_estimator_runtime_s = Histogram::with_opts(
            HistogramOpts::new(
                "mem_estimator_runtime_s",
                "time in seconds to estimate memory usage",
            )
            //  Create buckets from one nanosecond to eight seconds.
            .buckets(prometheus::exponential_buckets(0.000_000_004, 2.0, 32)?),
        )?;

        registry.register(Box::new(mem_total.clone()))?;
        registry.register(Box::new(mem_metrics.clone()))?;
        registry.register(Box::new(mem_net.clone()))?;
        registry.register(Box::new(mem_address_gossiper.clone()))?;
        registry.register(Box::new(mem_storage.clone()))?;
        registry.register(Box::new(mem_contract_runtime.clone()))?;
        registry.register(Box::new(mem_rpc_server.clone()))?;
        registry.register(Box::new(mem_rest_server.clone()))?;
        registry.register(Box::new(mem_event_stream_server.clone()))?;
        registry.register(Box::new(mem_chainspec_loader.clone()))?;
        registry.register(Box::new(mem_consensus.clone()))?;
        registry.register(Box::new(mem_deploy_fetcher.clone()))?;
        registry.register(Box::new(mem_deploy_gossiper.clone()))?;
        registry.register(Box::new(mem_block_proposer.clone()))?;
        registry.register(Box::new(mem_block_validator.clone()))?;
        registry.register(Box::new(mem_linear_chain.clone()))?;
        registry.register(Box::new(mem_estimator_runtime_s.clone()))?;

        Ok(MemoryMetrics {
            mem_total,
            mem_metrics,
            mem_net,
            mem_address_gossiper,
            mem_storage,
            mem_contract_runtime,
            mem_rpc_server,
            mem_rest_server,
            mem_event_stream_server,
            mem_chainspec_loader,
            mem_consensus,
            mem_deploy_fetcher,
            mem_deploy_gossiper,
            mem_block_proposer,
            mem_block_validator,
            mem_linear_chain,
            mem_estimator_runtime_s,
            registry,
        })
    }
/// Initializes a new set of memory metrics.
Initializes a new set of memory metrics.
Initializes a new set of memory metrics .
pub(super) fn new(registry: Registry) -> Result<Self, prometheus::Error> {
        let mem_total = IntGauge::new("mem_total", "total memory usage in bytes")?;
        let mem_metrics = IntGauge::new("mem_metrics", "metrics memory usage in bytes")?;
        let mem_net = IntGauge::new("mem_net", "network memory usage in bytes")?;
        let mem_address_gossiper = IntGauge::new(
            "mem_address_gossiper",
            "address_gossiper memory usage in bytes",
        )?;
        let mem_storage = IntGauge::new("mem_storage", "storage memory usage in bytes")?;
        let mem_contract_runtime = IntGauge::new(
            "mem_contract_runtime",
            "contract runtime memory usage in bytes",
        )?;
        let mem_rpc_server = IntGauge::new("mem_rpc_server", "rpc server memory usage in bytes")?;
        let mem_rest_server =
            IntGauge::new("mem_rest_server", "rest server memory usage in bytes")?;
        let mem_event_stream_server = IntGauge::new(
            "mem_event_stream_server",
            "event stream server memory usage in bytes",
        )?;
        let mem_chainspec_loader = IntGauge::new(
            "mem_chainspec_loader",
            "chainspec loader memory usage in bytes",
        )?;
        let mem_consensus = IntGauge::new("mem_consensus", "consensus memory usage in bytes")?;
        let mem_deploy_fetcher =
            IntGauge::new("mem_deploy_fetcher", "deploy fetcher memory usage in bytes")?;
        let mem_deploy_gossiper = IntGauge::new(
            "mem_deploy_gossiper",
            "deploy gossiper memory usage in bytes",
        )?;
        let mem_block_proposer =
            IntGauge::new("mem_block_proposer", "block proposer memory usage in bytes")?;
        let mem_block_validator = IntGauge::new(
            "mem_block_validator",
            "block validator memory usage in bytes",
        )?;
        let mem_linear_chain =
            IntGauge::new("mem_linear_chain", "linear chain memory usage in bytes")?;
        let mem_estimator_runtime_s = Histogram::with_opts(
            HistogramOpts::new(
                "mem_estimator_runtime_s",
                "time in seconds to estimate memory usage",
            )
            //  Create buckets from one nanosecond to eight seconds.
            .buckets(prometheus::exponential_buckets(0.000_000_004, 2.0, 32)?),
        )?;
        registry.register(Box::new(mem_total.clone()))?;
        registry.register(Box::new(mem_metrics.clone()))?;
        registry.register(Box::new(mem_net.clone()))?;
        registry.register(Box::new(mem_address_gossiper.clone()))?;
        registry.register(Box::new(mem_storage.clone()))?;
        registry.register(Box::new(mem_contract_runtime.clone()))?;
        registry.register(Box::new(mem_rpc_server.clone()))?;
        registry.register(Box::new(mem_rest_server.clone()))?;
        registry.register(Box::new(mem_event_stream_server.clone()))?;
        registry.register(Box::new(mem_chainspec_loader.clone()))?;
        registry.register(Box::new(mem_consensus.clone()))?;
        registry.register(Box::new(mem_deploy_fetcher.clone()))?;
        registry.register(Box::new(mem_deploy_gossiper.clone()))?;
        registry.register(Box::new(mem_block_proposer.clone()))?;
        registry.register(Box::new(mem_block_validator.clone()))?;
        registry.register(Box::new(mem_linear_chain.clone()))?;
        registry.register(Box::new(mem_estimator_runtime_s.clone()))?;
        Ok(MemoryMetrics {
            mem_total,
            mem_metrics,
            mem_net,
            mem_address_gossiper,
            mem_storage,
            mem_contract_runtime,
            mem_rpc_server,
            mem_rest_server,
            mem_event_stream_server,
            mem_chainspec_loader,
            mem_consensus,
            mem_deploy_fetcher,
            mem_deploy_gossiper,
            mem_block_proposer,
            mem_block_validator,
            mem_linear_chain,
            mem_estimator_runtime_s,
            registry,
        })
    }
pub ( super ) fn new ( registry : Registry ) -> Result < Self , prometheus :: Error > { let mem_total = IntGauge :: new ( " " , " " ) ? ; let mem_metrics = IntGauge :: new ( " " , " " ) ? ; let mem_net = IntGauge :: new ( " " , " " ) ? ; let mem_address_gossiper = IntGauge :: new ( " " , " " , ) ? ; let mem_storage = IntGauge :: new ( " " , " " ) ? ; let mem_contract_runtime = IntGauge :: new ( " " , " " , ) ? ; let mem_rpc_server = IntGauge :: new ( " " , " " ) ? ; let mem_rest_server = IntGauge :: new ( " " , " " ) ? ; let mem_event_stream_server = IntGauge :: new ( " " , " " , ) ? ; let mem_chainspec_loader = IntGauge :: new ( " " , " " , ) ? ; let mem_consensus = IntGauge :: new ( " " , " " ) ? ; let mem_deploy_fetcher = IntGauge :: new ( " " , " " ) ? ; let mem_deploy_gossiper = IntGauge :: new ( " " , " " , ) ? ; let mem_block_proposer = IntGauge :: new ( " " , " " ) ? ; let mem_block_validator = IntGauge :: new ( " " , " " , ) ? ; let mem_linear_chain = IntGauge :: new ( " " , " " ) ? ; let mem_estimator_runtime_s = Histogram :: with_opts ( HistogramOpts :: new ( " " , " " , ) //  Create buckets from one nanosecond to eight seconds. . buckets ( prometheus :: exponential_buckets ( 0.000_000_004 , 2.0 , 32 ) ? ) , ) ? ; registry . register ( Box :: new ( mem_total . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_metrics . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_net . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_address_gossiper . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_storage . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_contract_runtime . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_rpc_server . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_rest_server . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_event_stream_server . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_chainspec_loader . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_consensus . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_deploy_fetcher . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_deploy_gossiper . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_block_proposer . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_block_validator . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_linear_chain . clone ( ) ) ) ? ; registry . register ( Box :: new ( mem_estimator_runtime_s . clone ( ) ) ) ? ; Ok ( MemoryMetrics { mem_total , mem_metrics , mem_net , mem_address_gossiper , mem_storage , mem_contract_runtime , mem_rpc_server , mem_rest_server , mem_event_stream_server , mem_chainspec_loader , mem_consensus , mem_deploy_fetcher , mem_deploy_gossiper , mem_block_proposer , mem_block_validator , mem_linear_chain , mem_estimator_runtime_s , registry , } ) }
Initializes a new set of memory metrics.
Initializes a new set of memory metrics .
registry
Registry
registry
Registry