Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/run/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Config {
repository_override: None,
working_directory: None,
command: "".into(),
mode: RunnerMode::Instrumentation,
mode: RunnerMode::Simulation,
instruments: Instruments::test(),
perf_unwinding_mode: None,
enable_perf: false,
Expand Down Expand Up @@ -123,7 +123,7 @@ mod tests {
repository: None,
provider: None,
working_directory: None,
mode: RunnerMode::Instrumentation,
mode: RunnerMode::Simulation,
instruments: vec![],
mongo_uri_env_name: None,
message_format: None,
Expand Down Expand Up @@ -157,7 +157,7 @@ mod tests {
repository: Some("owner/repo".into()),
provider: Some(RepositoryProvider::GitLab),
working_directory: Some("/tmp".into()),
mode: RunnerMode::Instrumentation,
mode: RunnerMode::Simulation,
instruments: vec!["mongodb".into()],
mongo_uri_env_name: Some("MONGODB_URI".into()),
message_format: Some(crate::run::MessageFormat::Json),
Expand Down
12 changes: 11 additions & 1 deletion src/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ pub struct RunArgs {
#[derive(ValueEnum, Clone, Debug, Serialize, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum RunnerMode {
#[deprecated(note = "Use `RunnerMode::Simulation` instead")]
Instrumentation,
Simulation,
Walltime,
}

Expand All @@ -156,7 +158,7 @@ impl RunArgs {
repository: None,
provider: None,
working_directory: None,
mode: RunnerMode::Instrumentation,
mode: RunnerMode::Simulation,
instruments: vec![],
mongo_uri_env_name: None,
message_format: None,
Expand Down Expand Up @@ -184,6 +186,14 @@ pub async fn run(
let provider = run_environment::get_provider(&config)?;
let logger = Logger::new(&provider)?;

#[allow(deprecated)]
if config.mode == RunnerMode::Instrumentation {
warn!(
"The 'instrumentation' runner mode is deprecated and will be removed in a future version. \
Please use 'simulation' instead."
);
}

if provider.get_run_environment() != RunEnvironment::Local {
show_banner();
}
Expand Down
15 changes: 14 additions & 1 deletion src/run/runner/helpers/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ pub fn get_base_injected_env(
mode: RunnerMode,
profile_folder: &Path,
) -> HashMap<&'static str, String> {
let runner_mode_internal_env_value = match mode {
// While the runner now deprecates the usage of instrumentation with a message, we
// internally still use instrumentation temporarily to give time to users to upgrade their
// integrations to a version that accepts both instrumentation and simulation.
// TODO: Remove Instrumentation mode completely in the next major release, and set this
// value to simulation instead.
#[allow(deprecated)]
RunnerMode::Instrumentation | RunnerMode::Simulation => "instrumentation",
RunnerMode::Walltime => "walltime",
};
HashMap::from([
("PYTHONHASHSEED", "0".into()),
(
Expand All @@ -18,7 +28,10 @@ pub fn get_base_injected_env(
),
("ARCH", ARCH.into()),
("CODSPEED_ENV", "runner".into()),
("CODSPEED_RUNNER_MODE", mode.to_string()),
(
"CODSPEED_RUNNER_MODE",
runner_mode_internal_env_value.into(),
),
(
"CODSPEED_PROFILE_FOLDER",
profile_folder.to_string_lossy().to_string(),
Expand Down
5 changes: 4 additions & 1 deletion src/run/runner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ use wall_time::executor::WallTimeExecutor;
impl Display for RunnerMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
#[allow(deprecated)]
RunnerMode::Instrumentation => write!(f, "instrumentation"),
RunnerMode::Simulation => write!(f, "simulation"),
RunnerMode::Walltime => write!(f, "walltime"),
}
}
Expand All @@ -31,7 +33,8 @@ pub const EXECUTOR_TARGET: &str = "executor";

pub fn get_executor_from_mode(mode: &RunnerMode) -> Box<dyn Executor> {
match mode {
RunnerMode::Instrumentation => Box::new(ValgrindExecutor),
#[allow(deprecated)]
RunnerMode::Instrumentation | RunnerMode::Simulation => Box::new(ValgrindExecutor),
RunnerMode::Walltime => Box::new(WallTimeExecutor::new()),
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/run/runner/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ mod valgrind {
.await
}

#[cfg(test)]
fn valgrind_config(command: &str) -> Config {
Config {
mode: RunnerMode::Instrumentation,
mode: RunnerMode::Simulation,
command: command.to_string(),
..Config::test()
}
Expand Down
2 changes: 1 addition & 1 deletion src/run/runner/valgrind/measure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub async fn measure(
cmd.arg(ARCH).arg("-R");
// Configure the environment
cmd.envs(get_base_injected_env(
RunnerMode::Instrumentation,
RunnerMode::Simulation,
profile_folder,
))
.env("PYTHONMALLOC", "malloc")
Expand Down