Skip to content

Commit

Permalink
Output stderr to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
RDruon committed Aug 12, 2024
1 parent b14c64e commit 756c375
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lustrefs-exporter/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use serde::Deserialize;
use std::{
borrow::Cow,
convert::Infallible,
io::{self, BufReader},
io::{self, BufRead, BufReader},
net::SocketAddr,
};
use tokio::process::Command;
Expand Down Expand Up @@ -96,6 +96,7 @@ async fn scrape(Query(params): Query<Params>) -> Result<Response<Body>, Error> {
.arg("get_param")
.args(["obdfilter.*OST*.job_stats", "mdt.*.job_stats"])
.stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::piped())
.spawn()?;

Ok::<_, Error>(child)
Expand All @@ -112,6 +113,17 @@ async fn scrape(Query(params): Query<Params>) -> Result<Response<Body>, Error> {
))?,
);

let reader_stderr = BufReader::new(child.stderr.take().ok_or(io::Error::new(
io::ErrorKind::NotFound,
"stderr missing for lctl jobstats call.",
))?);

tokio::task::spawn(async move {
for line in reader_stderr.lines().map_while(Result::ok) {
tracing::debug!("stderr: {}", line);
}
});

let (_, rx) = lustrefs_exporter::jobstats::jobstats_stream(reader);

let stream = ReceiverStream::new(rx)
Expand Down

0 comments on commit 756c375

Please sign in to comment.