You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/run/instruments/mongo_tracer.rs
+35-2Lines changed: 35 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
1
use std::{
2
+
env::temp_dir,
2
3
io::Read,
3
4
path::{Path,PathBuf},
4
5
process::{Child,Command,Stdio},
@@ -13,7 +14,7 @@ use url::Url;
13
14
usecrate::prelude::*;
14
15
usecrate::run::helpers::get_env_variable;
15
16
16
-
usesuper::MongoDBConfig;
17
+
usesuper::{Instrument,MongoDBConfig};
17
18
18
19
#[derive(Debug,PartialEq,Eq)]
19
20
pubstructUserInput{
@@ -30,6 +31,39 @@ pub struct MongoTracer {
30
31
user_input:Option<UserInput>,
31
32
}
32
33
34
+
implInstrumentforMongoTracer{
35
+
asyncfnsetup(&self) -> Result<()>{
36
+
install_mongodb_tracer().await
37
+
}
38
+
}
39
+
40
+
asyncfninstall_mongodb_tracer() -> Result<()>{
41
+
debug!("Installing mongodb-tracer");
42
+
// TODO: release the tracer and update this url
43
+
let installer_url = format!("https://codspeed-public-assets.s3.eu-west-1.amazonaws.com/mongo-tracer/{MONGODB_TRACER_VERSION}/cs-mongo-tracer-installer.sh");
44
+
let installer_path = temp_dir().join("cs-mongo-tracer-installer.sh");
45
+
download_file(
46
+
&Url::parse(installer_url.as_str()).unwrap(),
47
+
&installer_path,
48
+
)
49
+
.await?;
50
+
51
+
let output = Command::new("bash")
52
+
.arg(installer_path.to_str().unwrap())
53
+
.stdout(Stdio::piped())
54
+
.stderr(Stdio::piped())
55
+
.output()
56
+
.map_err(|_| anyhow!("Failed to install mongo-tracer"))?;
let installer_url = format!("https://codspeed-public-assets.s3.eu-west-1.amazonaws.com/mongo-tracer/{MONGODB_TRACER_VERSION}/cs-mongo-tracer-installer.sh");
116
-
let installer_path = env::temp_dir().join("cs-mongo-tracer-installer.sh");
117
-
download_file(
118
-
&Url::parse(installer_url.as_str()).unwrap(),
119
-
&installer_path,
120
-
)
121
-
.await?;
122
-
123
-
let output = Command::new("bash")
124
-
.arg(installer_path.to_str().unwrap())
125
-
.stdout(Stdio::piped())
126
-
.output()
127
-
.map_err(|_| anyhow!("Failed to install mongo-tracer"))?;
0 commit comments