pub fn new(
        logging_config: Option<&LoggingConfig>,
        registry: MetricsRegistry,
    ) -> Result<Scraper, anyhow::Error> {
        let (interval, retain_for) = match logging_config {
            Some(config) => {
                let interval = config.metrics_scraping_interval;
                let retain_for = u64::try_from(config.retain_readings_for.as_millis())
                    .map_err(|_| anyhow!("scraper retention duration does not fit in an i64"))?;
                (interval, retain_for)
            }
            None => (None, 0),
        };
        Ok(Scraper {
            interval,
            retain_for,
            registry,
            metadata: HashMap::new(),
        })
    }
/// Constructs a new metrics scraper for the specified registry.
///
/// The logging configuration specifies what metrics to scrape and how long
/// to retain them for. If the logging configuration is none, scraping is
/// disabled.
Constructs a new metrics scraper for the specified registry.
The logging configuration specifies what metrics to scrape and how long
to retain them for. If the logging configuration is none, scraping is
disabled.
Constructs a new metrics scraper for the specified registry . The logging configuration specifies what metrics to scrape and how long to retain them for . If the logging configuration is none scraping is disabled .
pub fn new(
        logging_config: Option<&LoggingConfig>,
        registry: MetricsRegistry,
    ) -> Result<Scraper, anyhow::Error> {
        let (interval, retain_for) = match logging_config {
            Some(config) => {
                let interval = config.metrics_scraping_interval;
                let retain_for = u64::try_from(config.retain_readings_for.as_millis())
                    .map_err(|_| anyhow!("scraper retention duration does not fit in an i64"))?;
                (interval, retain_for)
            }
            None => (None, 0),
        };
        Ok(Scraper {
            interval,
            retain_for,
            registry,
            metadata: HashMap::new(),
        })
    }
pub fn new ( logging_config : Option < & LoggingConfig > , registry : MetricsRegistry , ) -> Result < Scraper , anyhow :: Error > { let ( interval , retain_for ) = match logging_config { Some ( config ) => { let interval = config . metrics_scraping_interval ; let retain_for = u64 :: try_from ( config . retain_readings_for . as_millis ( ) ) . map_err ( | _ | anyhow ! ( " " ) ) ? ; ( interval , retain_for ) } None => ( None , 0 ) , } ; Ok ( Scraper { interval , retain_for , registry , metadata : HashMap :: new ( ) , } ) }
Constructs a new metrics scraper for the specified registry.
Constructs a new metrics scraper for the specified registry .
logging_config
Option<&LoggingConfig>
registry
MetricsRegistry
logging_config
Option<&LoggingConfig>
registry
MetricsRegistry