Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not print error on jobstats issue #73

Merged
merged 2 commits into from
Aug 12, 2024
Merged

Conversation

jgrund
Copy link
Member

@jgrund jgrund commented Aug 9, 2024

Log message at debug level when there is a jobstats collection issue, do not raise to console.

Log message at debug level when there is a jobstats collection issue, do not raise to console.

Signed-off-by: Joe Grund <[email protected]>
@jgrund jgrund added the bug Something isn't working label Aug 9, 2024
@jgrund jgrund self-assigned this Aug 9, 2024
@jgrund jgrund requested a review from RDruon August 9, 2024 18:41
Copy link

codecov bot commented Aug 9, 2024

Codecov Report

Attention: Patch coverage is 0% with 46 lines in your changes missing coverage. Please review.

Project coverage is 91.77%. Comparing base (3dea341) to head (756c375).

Files Patch % Lines
lustrefs-exporter/src/main.rs 0.00% 46 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #73      +/-   ##
==========================================
- Coverage   92.12%   91.77%   -0.36%     
==========================================
  Files          41       41              
  Lines        5182     5201      +19     
  Branches     5182     5201      +19     
==========================================
- Hits         4774     4773       -1     
- Misses        372      391      +19     
- Partials       36       37       +1     
Flag Coverage Δ
2_14_0_ddn133 35.26% <ø> (ø)
2_14_0_ddn145 36.01% <ø> (ø)
all-tests 91.77% <0.00%> (-0.36%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Aug 9, 2024

Benchmark for 5e1db10

Click to view benchmark
Test Base PR %
jobstats 100 4.1±0.82ms 4.3±0.87ms +4.88%
jobstats 1000 40.2±7.79ms 39.7±6.75ms -1.24%

Copy link
Contributor

@RDruon RDruon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not working on my side.

Tried with

diff --git a/lustrefs-exporter/src/main.rs b/lustrefs-exporter/src/main.rs
index 8ef81e6..6749c35 100644
--- a/lustrefs-exporter/src/main.rs
+++ b/lustrefs-exporter/src/main.rs
@@ -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;
@@ -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)
@@ -112,6 +113,20 @@ async fn scrape(Query(params): Query<Params>) -> Result<Response<Body>, Error> {
                     ))?,
                 );

+                let reader_stderr = BufReader::with_capacity(
+                    128 * 1_024,
+                    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)

But I am not getting any output. I guess because we are never awaiting it?

@jgrund
Copy link
Member Author

jgrund commented Aug 12, 2024

But I am not getting any output.

What output are you expecting that you are not getting?

Copy link

Benchmark for 485e366

Click to view benchmark
Test Base PR %
jobstats 100 4.1±0.75ms 4.2±0.84ms +2.44%
jobstats 1000 41.8±7.65ms 40.2±6.89ms -3.83%

@RDruon
Copy link
Contributor

RDruon commented Aug 12, 2024

With latest commit

[root@es18kxe-co-vm08 ~]# RUST_LOG=debug ./lustrefs-exporter --port 32229 | grep stderr
2024-08-12T13:01:49.992264Z DEBUG lustrefs_exporter: stderr: error: get_param: param_path 'mdt/*/job_stats': No such file or directory
2024-08-12T13:01:52.866260Z DEBUG lustrefs_exporter: stderr: error: get_param: param_path 'mdt/*/job_stats': No such file or directory
2024-08-12T13:01:55.191757Z DEBUG lustrefs_exporter: stderr: error: get_param: param_path 'mdt/*/job_stats': No such file or directory

@jgrund jgrund merged commit 9e19c1b into main Aug 12, 2024
12 of 14 checks passed
@jgrund jgrund deleted the jgrund/ES6.3.1/jobstats-no-error branch August 12, 2024 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants