fn new(
        topology: Topology,
        hostname: String,
        qemu: bool,
        watch_containers: bool,
    ) -> MetricGenerator {
        let data = Vec::new();
        let containers = vec![];
        let pods = vec![];
        let docker_version = String::from("");
        let mut docker_client = None;
        //let kubernetes_version = String::from("");
        let mut kubernetes_client = None;
        if watch_containers {
            let mut container_runtime = false;
            match get_docker_client() {
                Ok(docker) => {
                    docker_client = Some(docker);
                    container_runtime = true;
                }
                Err(err) => {
                    info!("Couldn't connect to docker socket. Error: {}", err);
                }
            }
            if let Ok(kubernetes) = get_kubernetes_client() {
                kubernetes_client = Some(kubernetes);
                container_runtime = true;
            } else {
                info!("Couldn't connect to kubernetes API.");
            }
            if !container_runtime {
                warn!("--containers was used but scaphandre couldn't connect to any container runtime.");
            }
        }
        MetricGenerator {
            data,
            topology,
            hostname,
            containers,
            qemu,
            containers_last_check: String::from(""),
            docker_version,
            docker_client,
            watch_containers,
            watch_docker: true,
            kubernetes_client,
            watch_kubernetes: true,
            pods,
            pods_last_check: String::from(""),
            //kubernetes_version,
        }
    }
/// Returns a MetricGenerator instance that will host metrics.
Returns a MetricGenerator instance that will host metrics.
Returns a MetricGenerator instance that will host metrics .
fn new(
        topology: Topology,
        hostname: String,
        qemu: bool,
        watch_containers: bool,
    ) -> MetricGenerator {
        let data = Vec::new();
        let containers = vec![];
        let pods = vec![];
        let docker_version = String::from("");
        let mut docker_client = None;
        //let kubernetes_version = String::from("");
        let mut kubernetes_client = None;
        if watch_containers {
            let mut container_runtime = false;
            match get_docker_client() {
                Ok(docker) => {
                    docker_client = Some(docker);
                    container_runtime = true;
                }
                Err(err) => {
                    info!("Couldn't connect to docker socket. Error: {}", err);
                }
            }
            if let Ok(kubernetes) = get_kubernetes_client() {
                kubernetes_client = Some(kubernetes);
                container_runtime = true;
            } else {
                info!("Couldn't connect to kubernetes API.");
            }
            if !container_runtime {
                warn!("--containers was used but scaphandre couldn't connect to any container runtime.");
            }
        }
        MetricGenerator {
            data,
            topology,
            hostname,
            containers,
            qemu,
            containers_last_check: String::from(""),
            docker_version,
            docker_client,
            watch_containers,
            watch_docker: true,
            kubernetes_client,
            watch_kubernetes: true,
            pods,
            pods_last_check: String::from(""),
            //kubernetes_version,
        }
    }
fn new ( topology : Topology , hostname : String , qemu : bool , watch_containers : bool , ) -> MetricGenerator { let data = Vec :: new ( ) ; let containers = vec ! [ ] ; let pods = vec ! [ ] ; let docker_version = String :: from ( " " ) ; let mut docker_client = None ; //let kubernetes_version = String::from(""); let mut kubernetes_client = None ; if watch_containers { let mut container_runtime = false ; match get_docker_client ( ) { Ok ( docker ) => { docker_client = Some ( docker ) ; container_runtime = true ; } Err ( err ) => { info ! ( " " err ) ; } } if let Ok ( kubernetes ) = get_kubernetes_client ( ) { kubernetes_client = Some ( kubernetes ) ; container_runtime = true ; } else { info ! ( " " ) ; } if ! container_runtime { warn ! ( " " ) ; } } MetricGenerator { data , topology , hostname , containers , qemu , containers_last_check : String :: from ( " " ) , docker_version , docker_client , watch_containers , watch_docker : true , kubernetes_client , watch_kubernetes : true , pods , pods_last_check : String :: from ( " " ) , //kubernetes_version, } }
Returns a MetricGenerator instance that will host metrics.
Returns a MetricGenerator instance that will host metrics .
topology
Topology
hostname
String
qemu
bool
watch_containers
bool
topology
Topology
hostname
String
qemu
bool
watch_containers
bool