fn select_implementation(features: &FeatureFlags) -> TracersResult<TracingImplementation> {
    if !features.enable_tracing() {
        return Ok(TracingImplementation::Disabled);
    }

    //If any implementation is forced, then see if it's available and if so then accept it
    if features.enable_dynamic() {
        // Pick some dynamic tracing impl
        if features.force_dyn_stap() {
            if env::var("DEP_TRACERS_DYN_STAP_SUCCEEDED").is_err() {
                return Err(TracersError::code_generation_error(
                    "force-dyn-stap is enabled but the dyn_stap library is not available",
                ));
            } else {
                return Ok(TracingImplementation::DynamicStap);
            }
        } else if features.force_dyn_noop() {
            //no-op is always available on all platforms
            return Ok(TracingImplementation::DynamicNoOp);
        }

        //Else no tracing impl has been forced so we get to decide
        if env::var("DEP_TRACERS_DYN_STAP_SUCCEEDED").is_ok() {
            //use dyn_stap when it savailable
            Ok(TracingImplementation::DynamicStap)
        } else {
            //else, fall back to noop
            Ok(TracingImplementation::DynamicNoOp)
        }
    } else {
        // Pick some static tracing impl
        assert!(features.enable_static());

        //TODO: Be a bit smarter about this
        if features.force_static_stap() {
            Ok(TracingImplementation::StaticStap)
        } else if features.force_static_lttng() {
            Ok(TracingImplementation::StaticLttng)
        } else {
            Ok(TracingImplementation::StaticNoOp)
        }
    }
}
/// Selects a `tracers` implementation given a set of feature flags specified by the user
Selects a `tracers` implementation given a set of feature flags specified by the user
Selects a ` tracers ` implementation given a set of feature flags specified by the user
fn select_implementation(features: &FeatureFlags) -> TracersResult<TracingImplementation> {
    if !features.enable_tracing() {
        return Ok(TracingImplementation::Disabled);
    }
    //If any implementation is forced, then see if it's available and if so then accept it
    if features.enable_dynamic() {
        // Pick some dynamic tracing impl
        if features.force_dyn_stap() {
            if env::var("DEP_TRACERS_DYN_STAP_SUCCEEDED").is_err() {
                return Err(TracersError::code_generation_error(
                    "force-dyn-stap is enabled but the dyn_stap library is not available",
                ));
            } else {
                return Ok(TracingImplementation::DynamicStap);
            }
        } else if features.force_dyn_noop() {
            //no-op is always available on all platforms
            return Ok(TracingImplementation::DynamicNoOp);
        }
        //Else no tracing impl has been forced so we get to decide
        if env::var("DEP_TRACERS_DYN_STAP_SUCCEEDED").is_ok() {
            //use dyn_stap when it savailable
            Ok(TracingImplementation::DynamicStap)
        } else {
            //else, fall back to noop
            Ok(TracingImplementation::DynamicNoOp)
        }
    } else {
        // Pick some static tracing impl
        assert!(features.enable_static());
        //TODO: Be a bit smarter about this
        if features.force_static_stap() {
            Ok(TracingImplementation::StaticStap)
        } else if features.force_static_lttng() {
            Ok(TracingImplementation::StaticLttng)
        } else {
            Ok(TracingImplementation::StaticNoOp)
        }
    }
}
fn select_implementation ( features : & FeatureFlags ) -> TracersResult < TracingImplementation > { if ! features . enable_tracing ( ) { return Ok ( TracingImplementation :: Disabled ) ; } //If any implementation is forced, then see if it's available and if so then accept it if features . enable_dynamic ( ) { // Pick some dynamic tracing impl if features . force_dyn_stap ( ) { if env :: var ( " " ) . is_err ( ) { return Err ( TracersError :: code_generation_error ( " " , ) ) ; } else { return Ok ( TracingImplementation :: DynamicStap ) ; } } else if features . force_dyn_noop ( ) { //no-op is always available on all platforms return Ok ( TracingImplementation :: DynamicNoOp ) ; } //Else no tracing impl has been forced so we get to decide if env :: var ( " " ) . is_ok ( ) { //use dyn_stap when it savailable Ok ( TracingImplementation :: DynamicStap ) } else { //else, fall back to noop Ok ( TracingImplementation :: DynamicNoOp ) } } else { // Pick some static tracing impl assert ! ( features enable_static ( ) ) ; //TODO: Be a bit smarter about this if features . force_static_stap ( ) { Ok ( TracingImplementation :: StaticStap ) } else if features . force_static_lttng ( ) { Ok ( TracingImplementation :: StaticLttng ) } else { Ok ( TracingImplementation :: StaticNoOp ) } } }
Selects a `tracers` implementation given a set of feature flags specified by the user
Selects a ` tracers ` implementation given a set of feature flags specified by the user
features
&FeatureFlags
features
&FeatureFlags