Skip to content

EX-10318: add metrics for osc.*.state.current_state - #137

Merged
johnsonw merged 1 commit into
mainfrom
flei-ddn/EX-10318
Aug 20, 2026
Merged

EX-10318: add metrics for osc.*.state.current_state#137
johnsonw merged 1 commit into
mainfrom
flei-ddn/EX-10318

Conversation

@flei-ddn

@flei-ddn flei-ddn commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Add metrics for osc.*.state.current_state
For lustrefs-exporter, if current_state is FULL or IDLE, the metrics value is 1. Or the metrics value is 0

Test on an SFA system

On the first node, umount 1 OST

[root@ai400-99-100-005 ~]# mount | grep lustre
/dev/sdg on /lustre/tesfs/ost0001 type lustre (rw,svname=tesfs-OST0001,mgsnode=172.16.15.9@tcp,172.16.15.10@tcp:172.16.15.11@tcp,172.16.15.12@tcp:172.16.15.13@tcp,172.16.15.14@tcp:172.16.15.15@tcp,172.16.15.16@tcp,osd=osd-ldiskfs,errors=remount-ro)
/dev/mapper/vg_mdt0000_tesfs-mdt0000 on /lustre/tesfs/mdt0000 type lustre (rw,svname=tesfs-MDT0000,mgsnode=172.16.15.9@tcp,172.16.15.10@tcp:172.16.15.11@tcp,172.16.15.12@tcp:172.16.15.13@tcp,172.16.15.14@tcp:172.16.15.15@tcp,172.16.15.16@tcp,osd=osd-ldiskfs,user_xattr,errors=remount-ro)
/dev/sdf on /lustre/tesfs/ost0000 type lustre (rw,svname=tesfs-OST0000,mgsnode=172.16.15.9@tcp,172.16.15.10@tcp:172.16.15.11@tcp,172.16.15.12@tcp:172.16.15.13@tcp,172.16.15.14@tcp:172.16.15.15@tcp,172.16.15.16@tcp,osd=osd-ldiskfs,errors=remount-ro)
[root@ai400-99-100-005 ~]# umount /lustre/tesfs/ost0000

Check output of lctl, lustre_collector and lustrefs_exporter immediately

[root@ai400-99-100-005 ~]# lctl get_param osc.*.state > 2.state && curl -s localhost:32221/metrics | grep osc && ./lustre_collector | jq . > 2.json
# HELP lustre_osc_state Lustre OSC connection state.
# TYPE lustre_osc_state gauge
lustre_osc_state{controller="tesfs-OST0000-osc-MDT0000",current_state="DISCONN"} 0
lustre_osc_state{controller="tesfs-OST0001-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0002-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0003-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0004-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0005-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0006-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0007-osc-MDT0000",current_state="FULL"} 1

We can see:

  • For lustrefs_exporter, the value of lustre_osc_state{controller="tesfs-OST0000-osc-MDT0000",current_state="DISCONN"} is 0
  • vim 2.state:
osc.tesfs-OST0000-osc-MDT0000.state=
current_state: DISCONN
state_history:
 - [ 1781485337, DISCONN ]
 - [ 1781485342, CONNECTING ]
 - [ 1781485342, REPLAY ]
 - [ 1781485342, REPLAY_LOCKS ]
 - [ 1781485342, REPLAY_WAIT ]
 - [ 1781485342, RECOVER ]
 - [ 1781485342, FULL ]
 - [ 1781485439, DISCONN ]
 - [ 1781485439, CONNECTING ]
 - [ 1781485439, DISCONN ]
 - [ 1781485439, CONNECTING ]
 - [ 1781485439, DISCONN ]
 - [ 1781485439, CONNECTING ]
 - [ 1781485439, DISCONN ]
 - [ 1781485439, CONNECTING ]
 - [ 1781485439, DISCONN ]
osc.tesfs-OST0001-osc-MDT0000.state=
current_state: FULL
state_history:
 - [ 1781484433, CONNECTING ]
 - [ 1781484433, DISCONN ]
 - [ 1781484433, CONNECTING ]
 - [ 1781484433, REPLAY_LOCKS ]
 - [ 1781484433, REPLAY_WAIT ]
 - [ 1781484436, RECOVER ]
 - [ 1781484436, FULL ]
osc.tesfs-OST0002-osc-MDT0000.state=
current_state: FULL
state_history:
 - [ 1781484433, CONNECTING ]
 - [ 1781484433, FULL ]
...
  • vim 2.json
[
  ...
  {
    "Controller": {
      "OscState": {
        "kind": "Osc",
        "param": "state",
        "controller": "tesfs-OST0003-osc-MDT0000",
        "value": {
          "current_state": "FULL"
        }
      }
    }
  },
  {
    "Controller": {
      "OscState": {
        "kind": "Osc",
        "param": "state",
        "controller": "tesfs-OST0000-osc-MDT0000",
        "value": {
          "current_state": "DISCONN"
        }
      }
    }
  },
  ...
]

The unmounted OST will be recovered soon automatically

The HA system will recover the OST automatically

[root@ai400-99-100-005 ~]# mount | grep lustre
/dev/sdg on /lustre/tesfs/ost0001 type lustre (rw,svname=tesfs-OST0001,mgsnode=172.16.15.9@tcp,172.16.15.10@tcp:172.16.15.11@tcp,172.16.15.12@tcp:172.16.15.13@tcp,172.16.15.14@tcp:172.16.15.15@tcp,172.16.15.16@tcp,osd=osd-ldiskfs,errors=remount-ro)
/dev/mapper/vg_mdt0000_tesfs-mdt0000 on /lustre/tesfs/mdt0000 type lustre (rw,svname=tesfs-MDT0000,mgsnode=172.16.15.9@tcp,172.16.15.10@tcp:172.16.15.11@tcp,172.16.15.12@tcp:172.16.15.13@tcp,172.16.15.14@tcp:172.16.15.15@tcp,172.16.15.16@tcp,osd=osd-ldiskfs,user_xattr,errors=remount-ro)
/dev/sdf on /lustre/tesfs/ost0000 type lustre (rw,svname=tesfs-OST0000,mgsnode=172.16.15.9@tcp,172.16.15.10@tcp:172.16.15.11@tcp,172.16.15.12@tcp:172.16.15.13@tcp,172.16.15.14@tcp:172.16.15.15@tcp,172.16.15.16@tcp,osd=osd-ldiskfs,errors=remount-ro)

@codecov

codecov Bot commented Apr 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.17834% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.71%. Comparing base (6c9e32e) to head (a33d10b).

Files with missing lines Patch % Lines
lustre-collector/src/lib.rs 85.18% 4 Missing ⚠️
lustre-collector/src/osc_parser.rs 97.40% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #137      +/-   ##
==========================================
+ Coverage   94.68%   94.71%   +0.03%     
==========================================
  Files          46       48       +2     
  Lines        6774     6931     +157     
  Branches     6774     6931     +157     
==========================================
+ Hits         6414     6565     +151     
- Misses        271      276       +5     
- Partials       89       90       +1     
Flag Coverage Δ
2_14_0_ddn133 32.41% <28.90%> (-0.10%) ⬇️
2_14_0_ddn145 34.02% <28.90%> (-0.15%) ⬇️
all-tests 94.71% <96.17%> (+0.03%) ⬆️

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

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Apr 30, 2026

Copy link
Copy Markdown

🐰 Bencher Report

Projectlustrefs-exporter
Branchflei-ddn/EX-10318
Testbedci-runner
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
nanoseconds (ns)
(Result Δ%)
Lower Boundary
nanoseconds (ns)
(Limit %)
Upper Boundary
nanoseconds (ns)
(Limit %)
parse_benchmarks/combine_performance📈 view plot
🚷 view threshold
127,250,000.00 ns
(-35.42%)Baseline: 197,029,806.45 ns
-523,513,940.35 ns
(-411.41%)
917,573,553.25 ns
(13.87%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Apr 30, 2026

Copy link
Copy Markdown

🐰 Bencher Report

Projectlustrefs-exporter
Branchflei-ddn/EX-10318
Testbedci-runner

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkD1 Miss Ratemisses (%)D1mrmisses (reads) x 1e3D1mwmisses (writes) x 1e3DLmrmisses (reads)DLmwmisses (writes) x 1e3Drreads x 1e6Dwwrites x 1e6Estimated Cyclescycles x 1e6I1 Miss Ratemisses (%)I1mrmisses (reads) x 1e3ILmrmisses (reads)InstructionsBenchmark Result
instructions x 1e6
(Result Δ%)
Lower Boundary
instructions x 1e6
(Limit %)
Upper Boundary
instructions x 1e6
(Limit %)
L1 Hit Ratehits (%)L1 Hitshits x 1e6LL Hit Ratehits (%)LL Hitshits x 1e3LL Miss Ratemisses (%)LLd Miss Ratemisses (%)LLi Miss Ratemisses (%)RAM Hit Ratehits (%)RAM Hitshits x 1e3Total read+writereads/writes x 1e6
lustre_metrics::memory_benches::bench_encode_lustre_metrics with_setup:generate_records()📈 view plot
⚠️ NO THRESHOLD
0.93 %📈 view plot
⚠️ NO THRESHOLD
25.55 reads x 1e3📈 view plot
⚠️ NO THRESHOLD
9.14 writes x 1e3📈 view plot
⚠️ NO THRESHOLD
134.00 reads📈 view plot
⚠️ NO THRESHOLD
6.38 writes x 1e3📈 view plot
⚠️ NO THRESHOLD
2.49 x 1e6📈 view plot
⚠️ NO THRESHOLD
1.23 x 1e6📈 view plot
⚠️ NO THRESHOLD
14.85 x 1e6📈 view plot
⚠️ NO THRESHOLD
0.01 %📈 view plot
⚠️ NO THRESHOLD
1.12 reads x 1e3📈 view plot
⚠️ NO THRESHOLD
965.00 reads📈 view plot
🚷 view threshold
10.76 x 1e6
(-14.21%)Baseline: 12.54 x 1e6
3.48 x 1e6
(32.35%)
21.60 x 1e6
(49.81%)
📈 view plot
⚠️ NO THRESHOLD
99.75 %📈 view plot
⚠️ NO THRESHOLD
14.44 x 1e6📈 view plot
⚠️ NO THRESHOLD
0.20 %📈 view plot
⚠️ NO THRESHOLD
28.32 x 1e3📈 view plot
⚠️ NO THRESHOLD
0.05 %📈 view plot
⚠️ NO THRESHOLD
0.18 %📈 view plot
⚠️ NO THRESHOLD
0.01 %📈 view plot
⚠️ NO THRESHOLD
0.05 %📈 view plot
⚠️ NO THRESHOLD
7.48 x 1e3📈 view plot
⚠️ NO THRESHOLD
14.48 x 1e6
🐰 View full continuous benchmarking report in Bencher

@flei-ddn
flei-ddn force-pushed the flei-ddn/EX-10318 branch from 2bcc363 to e236e35 Compare April 30, 2026 01:02
@github-actions

github-actions Bot commented Apr 30, 2026

Copy link
Copy Markdown

🐰 Bencher Report

Projectlustrefs-exporter
Branchflei-ddn/EX-10318
Testbedci-runner

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
Benchmarkavg_runtime_rss_mibMeasure (MiB)avg_runtime_virtual_mibMeasure (MiB)end_rss_mibMeasure (MiB)end_virtual_mibMeasure (MiB)memory_growth_mibMeasure (MiB)peak_over_start_rss_ratioMeasure (units)peak_over_start_virtual_ratioMeasure (units)peak_rss_mibBenchmark Result
Measure (MiB)
(Result Δ%)
Lower Boundary
Measure (MiB)
(Limit %)
Upper Boundary
Measure (MiB)
(Limit %)
peak_virtual_mibMeasure (MiB)start_rss_mibMeasure (MiB)start_virtual_mibMeasure (MiB)virtual_growth_mibMeasure (MiB)
scrape_allocations📈 view plot
⚠️ NO THRESHOLD
42.09 MiB📈 view plot
⚠️ NO THRESHOLD
944.64 MiB📈 view plot
⚠️ NO THRESHOLD
42.15 MiB📈 view plot
⚠️ NO THRESHOLD
944.75 MiB📈 view plot
⚠️ NO THRESHOLD
0.32 MiB📈 view plot
⚠️ NO THRESHOLD
1.03 units📈 view plot
⚠️ NO THRESHOLD
1.02 units📈 view plot
🚷 view threshold
44.17 MiB
(-33.37%)Baseline: 66.30 MiB
-106.88 MiB
(-241.96%)
239.47 MiB
(18.45%)
📈 view plot
⚠️ NO THRESHOLD
944.98 MiB📈 view plot
⚠️ NO THRESHOLD
41.83 MiB📈 view plot
⚠️ NO THRESHOLD
938.80 MiB📈 view plot
⚠️ NO THRESHOLD
5.95 MiB
🐰 View full continuous benchmarking report in Bencher

@flei-ddn
flei-ddn force-pushed the flei-ddn/EX-10318 branch 2 times, most recently from 6a4cd9b to 1916615 Compare April 30, 2026 02:41
@flei-ddn
flei-ddn force-pushed the flei-ddn/EX-10318 branch from 1916615 to 8ad7a76 Compare May 6, 2026 02:02

@palash3 palash3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please update implementation using combine.

Comment thread lustre-collector/src/main.rs Outdated
@flei-ddn
flei-ddn force-pushed the flei-ddn/EX-10318 branch from 8ad7a76 to a9c77d4 Compare May 20, 2026 06:01
@flei-ddn
flei-ddn requested a review from palash3 May 20, 2026 06:06
@flei-ddn
flei-ddn force-pushed the flei-ddn/EX-10318 branch from a9c77d4 to 1d0e923 Compare June 3, 2026 00:25
@flei-ddn
flei-ddn force-pushed the flei-ddn/EX-10318 branch from 1d0e923 to f07e6d0 Compare June 3, 2026 00:58
@flei-ddn
flei-ddn force-pushed the flei-ddn/EX-10318 branch from f07e6d0 to dd15e5c Compare June 11, 2026 04:59
@chetan-shekhar

chetan-shekhar commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Tested by stopping the NICs. The exporter reported OSCs in CONNECTING/CLOSED states with a metric value of 0.

[root@ai400-99-100-005 ~]# curl -s localhost:32221/metrics | grep  "osc"
# HELP lustre_osc_state Lustre OSC connection state.
# TYPE lustre_osc_state gauge
lustre_osc_state{controller="tesfs-OST0000-osc-MDT0000",current_state="CLOSED"} 0
lustre_osc_state{controller="tesfs-OST0001-osc-MDT0000",current_state="CLOSED"} 0
lustre_osc_state{controller="tesfs-OST0002-osc-MDT0000",current_state="CONNECTING"} 0
lustre_osc_state{controller="tesfs-OST0003-osc-MDT0000",current_state="CONNECTING"} 0
lustre_osc_state{controller="tesfs-OST0004-osc-MDT0000",current_state="CONNECTING"} 0
lustre_osc_state{controller="tesfs-OST0005-osc-MDT0000",current_state="CONNECTING"} 0
lustre_osc_state{controller="tesfs-OST0006-osc-MDT0000",current_state="CONNECTING"} 0
lustre_osc_state{controller="tesfs-OST0007-osc-MDT0000",current_state="CONNECTING"} 0
[root@ai400-99-100-005 ~]#

@flei-ddn
flei-ddn force-pushed the flei-ddn/EX-10318 branch 5 times, most recently from 9c3b629 to 05c670d Compare June 15, 2026 01:17
@chetan-shekhar

Copy link
Copy Markdown
Contributor

Tested it and its working as expected.
Check OSTs are connected.

[root@ai400-99-100-005 ~]# curl -s localhost:32221/metrics | grep osc
# HELP lustre_osc_state Lustre OSC connection state.
# TYPE lustre_osc_state gauge
lustre_osc_state{controller="tesfs-OST0000-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0001-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0002-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0003-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0004-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0005-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0006-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0007-osc-MDT0000",current_state="FULL"} 1
[root@ai400-99-100-005 ~]#
[root@ai400-99-100-005 ~]# mount | grep lustre
/dev/sdg on /lustre/tesfs/ost0001 type lustre (rw,svname=tesfs-OST0001,mgsnode=172.16.15.9@tcp,172.16.15.10@tcp:172.16.15.11@tcp,172.16.15.12@tcp:172.16.15.13@tcp,172.16.15.14@tcp:172.16.15.15@tcp,172.16.15.16@tcp,osd=osd-ldiskfs,errors=remount-ro)
/dev/mapper/vg_mdt0000_tesfs-mdt0000 on /lustre/tesfs/mdt0000 type lustre (rw,svname=tesfs-MDT0000,mgsnode=172.16.15.9@tcp,172.16.15.10@tcp:172.16.15.11@tcp,172.16.15.12@tcp:172.16.15.13@tcp,172.16.15.14@tcp:172.16.15.15@tcp,172.16.15.16@tcp,osd=osd-ldiskfs,user_xattr,errors=remount-ro)
/dev/sdf on /lustre/tesfs/ost0000 type lustre (rw,svname=tesfs-OST0000,mgsnode=172.16.15.9@tcp,172.16.15.10@tcp:172.16.15.11@tcp,172.16.15.12@tcp:172.16.15.13@tcp,172.16.15.14@tcp:172.16.15.15@tcp,172.16.15.16@tcp,osd=osd-ldiskfs,errors=remount-ro)
[root@ai400-99-100-005 ~]#

Unmount one ost

[root@ai400-99-100-005 ~]# umount /lustre/tesfs/ost0001

verify that OST is disconnected and export metrics as 0.

[root@ai400-99-100-005 ~]# curl -s localhost:32221/metrics | grep osc
# HELP lustre_osc_state Lustre OSC connection state.
# TYPE lustre_osc_state gauge
lustre_osc_state{controller="tesfs-OST0000-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0001-osc-MDT0000",current_state="DISCONN"} 0
lustre_osc_state{controller="tesfs-OST0002-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0003-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0004-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0005-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0006-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="tesfs-OST0007-osc-MDT0000",current_state="FULL"} 1
[root@ai400-99-100-005 ~]# lctl get_param osc.*.state
osc.tesfs-OST0000-osc-MDT0000.state=
current_state: FULL
state_history:
 - [ 1781485455, CONNECTING ]
 - [ 1781485455, DISCONN ]
 - [ 1781485455, CONNECTING ]
 - [ 1781485455, DISCONN ]
 - [ 1781485455, CONNECTING ]
 - [ 1781485455, DISCONN ]
 - [ 1781485455, CONNECTING ]
 - [ 1781485455, DISCONN ]
 - [ 1781485458, CONNECTING ]
 - [ 1781485458, DISCONN ]
 - [ 1781485463, CONNECTING ]
 - [ 1781485463, REPLAY ]
 - [ 1781485463, REPLAY_LOCKS ]
 - [ 1781485463, REPLAY_WAIT ]
 - [ 1781485463, RECOVER ]
 - [ 1781485463, FULL ]
osc.tesfs-OST0001-osc-MDT0000.state=
current_state: DISCONN
state_history:
 - [ 1781504235, CONNECTING ]
 - [ 1781504235, DISCONN ]
 - [ 1781504235, CONNECTING ]
 - [ 1781504235, DISCONN ]
 - [ 1781504235, CONNECTING ]
 - [ 1781504235, DISCONN ]
 - [ 1781504240, CONNECTING ]
 - [ 1781504240, DISCONN ]
 - [ 1781504240, CONNECTING ]
 - [ 1781504240, DISCONN ]
 - [ 1781504240, CONNECTING ]
 - [ 1781504240, DISCONN ]
 - [ 1781504240, CONNECTING ]
 - [ 1781504240, DISCONN ]
 - [ 1781504241, CONNECTING ]
 - [ 1781504241, DISCONN ]

osc.tesfs-OST0002-osc-MDT0000.state=
current_state: FULL
state_history:
 - [ 1781484433, CONNECTING ]
 - [ 1781484433, FULL ]
osc.tesfs-OST0003-osc-MDT0000.state=
current_state: FULL
state_history:
 - [ 1781484433, CONNECTING ]
 - [ 1781484433, FULL ]
osc.tesfs-OST0004-osc-MDT0000.state=
current_state: FULL
state_history:
 - [ 1781484433, CONNECTING ]
 - [ 1781484433, FULL ]
osc.tesfs-OST0005-osc-MDT0000.state=
current_state: FULL
state_history:
 - [ 1781484433, CONNECTING ]
 - [ 1781484433, FULL ]
osc.tesfs-OST0006-osc-MDT0000.state=
current_state: FULL
state_history:
 - [ 1781484433, CONNECTING ]
 - [ 1781484433, FULL ]
osc.tesfs-OST0007-osc-MDT0000.state=
current_state: FULL
state_history:
 - [ 1781484433, CONNECTING ]
 - [ 1781484433, FULL ]
[root@ai400-99-100-005 ~]#

verify from lustre collector.

{
    "Controller": {
      "OscState": {
        "kind": "Osc",
        "param": "state",
        "controller": "tesfs-OST0001-osc-MDT0000",
        "value": {
          "current_state": "DISCONN"
        }
      }
    }

@palash3 palash3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

some comments other wise looks good

Comment thread lustre-collector/src/lib.rs Outdated
Comment thread lustre-collector/src/error.rs Outdated
@palash3

palash3 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

@spoutn1k Can you please review ?

@pgandhi14

pgandhi14 commented Jun 16, 2026

Copy link
Copy Markdown

Tested the Changes


Test 1: Basic Functionality

Verified that the new lustre_osc_state metric is exported correctly via the Prometheus endpoint.

Pre Conditions

[root@node1 scratch]# lctl get_param osc.*.state | grep "^osc\." | wc -l
16

[root@node1 scratch]# lctl get_param osc.*.state | grep "current_state:"
current_state: FULL
current_state: FULL
current_state: FULL
current_state: FULL
current_state: FULL
current_state: FULL
current_state: FULL
current_state: FULL
current_state: FULL
current_state: FULL
current_state: FULL
current_state: FULL
current_state: FULL
current_state: FULL
current_state: FULL
current_state: FULL

Deployed New Binary

[root@node1 scratch]# systemctl stop lustrefs_exporter
[root@node1 scratch]# cp /usr/bin/lustrefs-exporter /usr/bin/lustrefs-exporter.backup.$(date +%Y%m%d)
[root@node1 scratch]# cp lustrefs-exporter /usr/bin/lustrefs-exporter
cp: overwrite '/usr/bin/lustrefs-exporter'? yes
[root@node1 scratch]# systemctl start lustrefs_exporter
[root@node1 scratch]# systemctl status lustrefs_exporter

● lustrefs_exporter.service - Prometheus exporter for Lustre filesystem
   Loaded: loaded (/usr/lib/systemd/system/lustrefs_exporter.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/lustrefs_exporter.service.d
           └─90-exporter-port.conf
   Active: active (running) since Tue 2026-06-16 06:25:05 UTC; 5s ago
     Docs: https://github.com/whamcloud/lustrefs-exporter
 Main PID: 1212940 (lustrefs_export)
    Tasks: 9 (limit: 36497)
   Memory: 1.7M (high: 2.6G max: 3.0G)
   CGroup: /system.slice/lustrefs_exporter.service
           └─1212940 /usr/bin/lustrefs_exporter

Jun 16 06:25:05 node1 systemd[1]: Started Prometheus exporter for Lustre filesystem.
Jun 16 06:25:05 node1 lustrefs_exporter[1212940]: 2026-06-16T06:25:05.546869Z  INFO lustrefs_exporter: Listening on http://0.0.0.0:32221/metrics

Verified Metrics Endpoint

[root@node1 scratch]# curl -s localhost:32221/metrics | grep "lustre_osc_state"

# HELP lustre_osc_state Lustre OSC connection state.
# TYPE lustre_osc_state gauge
lustre_osc_state{controller="fs-OST0000-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="fs-OST0001-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="fs-OST0002-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="fs-OST0003-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="fs-OST0004-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="fs-OST0005-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="fs-OST0006-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="fs-OST0007-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="fs-OST0008-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="fs-OST0009-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="fs-OST000a-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="fs-OST000b-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="fs-OST000c-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="fs-OST000d-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="fs-OST000e-osc-MDT0000",current_state="FULL"} 1
lustre_osc_state{controller="fs-OST000f-osc-MDT0000",current_state="FULL"} 1

[root@node1 scratch]# curl -s localhost:32221/metrics | grep "^lustre_osc_state{" | wc -l
16

Result:
Verified that all 16 OSC controllers are exported through the lustre_osc_state metric with the expected current_state="FULL" label.


Test 2: lustre_collector Parsing

[root@node1 scratch]# ./lustre_collector | jq '.[] | select(.Controller.OscState) | .Controller.OscState' | head -20

{
  "kind": "Osc",
  "param": "state",
  "controller": "fs-OST000f-osc-MDT0000",
  "value": {
    "current_state": "FULL"
  }
}
{
  "kind": "Osc",
  "param": "state",
  "controller": "fs-OST0001-osc-MDT0000",
  "value": {
    "current_state": "FULL"
  }
}
{
  "kind": "Osc",
  "param": "state",
  "controller": "fs-OST0004-osc-MDT0000",

Result:
Verified that lustre_collector correctly parses OSC state information and produces a valid JSON structure with proper nesting.


Conclusion

The implementation is working correctly.

@flei-ddn
flei-ddn force-pushed the flei-ddn/EX-10318 branch from 23aa335 to 7a19d49 Compare July 15, 2026 03:08
@flei-ddn
flei-ddn marked this pull request as ready for review July 15, 2026 03:23
@flei-ddn
flei-ddn requested a review from spoutn1k July 16, 2026 01:39
spoutn1k
spoutn1k previously approved these changes Jul 16, 2026

@spoutn1k spoutn1k left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good !

@flei-ddn

Copy link
Copy Markdown
Contributor Author

@utopiabound Would you please review this PR again. Thanks.

@flei-ddn
flei-ddn requested a review from spoutn1k July 29, 2026 08:51
Comment thread lustre-collector/src/types.rs Outdated

@utopiabound utopiabound left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Needs rebase

@flei-ddn
flei-ddn marked this pull request as draft July 31, 2026 01:24
@flei-ddn
flei-ddn force-pushed the flei-ddn/EX-10318 branch 2 times, most recently from 3c85ea4 to 6dfc69a Compare July 31, 2026 01:33
@flei-ddn
flei-ddn marked this pull request as ready for review July 31, 2026 06:27
@flei-ddn
flei-ddn requested a review from utopiabound July 31, 2026 06:27
@flei-ddn

Copy link
Copy Markdown
Contributor Author

Needs rebase

Rebased.

@flei-ddn
flei-ddn force-pushed the flei-ddn/EX-10318 branch from 6dfc69a to 029bb54 Compare August 4, 2026 06:11
@flei-ddn

flei-ddn commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Ping reviewers.

@breuhan

breuhan commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Codecov checks are failing

@flei-ddn
flei-ddn marked this pull request as draft August 18, 2026 11:29
Add metrics for osc.*.state.current_state
For lustrefs-exporter, if current_state is FULL or IDLE, the metrics value is 1.
Or the metrics value is 0

Signed-off-by: Feng Lei <flei@ddn.com>
@flei-ddn
flei-ddn marked this pull request as ready for review August 18, 2026 11:51
@flei-ddn

Copy link
Copy Markdown
Contributor Author

Codecov checks are failing

Codecov checking is OK now.

Comment on lines +138 to +141
fn test_params() {
let params = params();
assert_eq!(params, vec!["osc.*.state"]);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Little overkill

}
}

pub fn build_controller_stats(x: &ControllerStats, metrics: &mut ControllerMetrics) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing doc block

@johnsonw
johnsonw merged commit 86d5c71 into main Aug 20, 2026
22 checks passed
@johnsonw
johnsonw deleted the flei-ddn/EX-10318 branch August 20, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants