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

cmd/doctor: doctor command to help bug report etc #2360

Merged
merged 15 commits into from
Sep 26, 2022

Conversation

Ziy1-Tan
Copy link
Contributor

@Ziy1-Tan Ziy1-Tan commented Jul 13, 2022

Issue number: #1803

Description

The following file will be created:

  • cmd/doctor.go
  • cmd/doctor_test.go

Features

It collects and displays info from multiple dimensions such as the running environment and system logs to report bugs, etc.

  • System info collection: support collection of os, architecture, hardware, juicefs version, etc.
  • Syslog collection: support automatic search for log location and filter logs according to the maximum number of records
  • Pprof metric collection: Goroutine stack information, CPU performance statistics, memory allocation statistics, etc.
  • Mount point config collection: support specifying mount point to obtain the config (filter sensitive info)
  • Mount command collection: Collect juicefs mount commands and corresponding parameters

Use cases

$ juicefs doctor /mnt/jfs

# Result will be output to /var/log/
$ juicefs doctor --out-dir=/var/log /mnt/jfs

# Get log file up to last 1000 entries
$ juicefs doctor --out-dir=/var/log --collect-log --limit=1000 /mnt/jfs 

# Enable pprof collection
$ juicefs doctor --out-dir=/var/log --collect-log --limit=1000 --collect-pprof /mnt/jfs

How can this PR be tested?

The test files locate at cmd/doctor_test.go.

Basing the PR against the correct JuiceFS version

  • This is a new feature and the PR is based against the latest JuiceFS development branch
  • This is a bug fix and the PR is based against the earliest branch in which the bug can be reproduce

@CLAassistant
Copy link

CLAassistant commented Jul 13, 2022

CLA assistant check
All committers have signed the CLA.

@zhijian-pro zhijian-pro self-assigned this Jul 13, 2022
@zhijian-pro zhijian-pro marked this pull request as draft July 13, 2022 11:09
@zhijian-pro zhijian-pro added this to the Release 1.1 milestone Jul 13, 2022
@zhijian-pro zhijian-pro changed the title feat: WIP doctor command collecting static info WIP cmd/doctor: doctor command collecting static info Jul 13, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jul 13, 2022

Codecov Report

Base: 59.63% // Head: 59.13% // Decreases project coverage by -0.49% ⚠️

Coverage data is based on head (c2fdb03) compared to base (d4928e5).
Patch coverage: 17.40% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2360      +/-   ##
==========================================
- Coverage   59.63%   59.13%   -0.50%     
==========================================
  Files         138      140       +2     
  Lines       23508    24185     +677     
==========================================
+ Hits        14020    14303     +283     
- Misses       7659     8030     +371     
- Partials     1829     1852      +23     
Impacted Files Coverage Δ
pkg/utils/utils_linux.go 0.00% <0.00%> (ø)
pkg/utils/utils_unix.go 26.31% <0.00%> (-12.15%) ⬇️
cmd/doctor.go 18.39% <18.39%> (ø)
cmd/main.go 46.32% <100.00%> (+1.24%) ⬆️
pkg/chunk/mem_cache.go 62.50% <0.00%> (-23.62%) ⬇️
pkg/chunk/disk_cache.go 75.24% <0.00%> (-3.96%) ⬇️
pkg/meta/base.go 65.37% <0.00%> (-3.43%) ⬇️
pkg/chunk/cached_store.go 73.71% <0.00%> (-2.30%) ⬇️
cmd/sync.go 55.27% <0.00%> (-1.20%) ⬇️
pkg/meta/sql.go 63.51% <0.00%> (-1.00%) ⬇️
... and 28 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Ziy1-Tan Ziy1-Tan force-pushed the feat-doctor-dev branch 2 times, most recently from fb970ef to 35136db Compare August 20, 2022 05:18
@Ziy1-Tan Ziy1-Tan changed the title WIP cmd/doctor: doctor command collecting static info WIP cmd/doctor: doctor command supports collecting static and dynamic info Aug 20, 2022
@Ziy1-Tan Ziy1-Tan changed the title WIP cmd/doctor: doctor command supports collecting static and dynamic info WIP cmd/doctor: doctor command supports collecting static and runtime infomation Aug 20, 2022
@Ziy1-Tan Ziy1-Tan force-pushed the feat-doctor-dev branch 9 times, most recently from 734306d to 4eb23f4 Compare August 25, 2022 12:54
@Ziy1-Tan Ziy1-Tan changed the title WIP cmd/doctor: doctor command supports collecting static and runtime infomation WIP cmd/doctor: doctor command supports collecting system, syslog and other info Aug 26, 2022
@Ziy1-Tan Ziy1-Tan force-pushed the feat-doctor-dev branch 6 times, most recently from 363745e to 8d0e5d8 Compare August 31, 2022 08:41
@Ziy1-Tan Ziy1-Tan force-pushed the feat-doctor-dev branch 2 times, most recently from 1f3fdf9 to 7754db8 Compare September 5, 2022 02:29
@Ziy1-Tan Ziy1-Tan changed the title WIP cmd/doctor: doctor command supports collecting system, syslog and other info cmd/doctor: doctor command supports collecting system, syslog and other info Sep 10, 2022
@Ziy1-Tan Ziy1-Tan marked this pull request as ready for review September 10, 2022 05:33
cmd/doctor.go Outdated Show resolved Hide resolved
cmd/doctor.go Outdated Show resolved Hide resolved
cmd/doctor.go Outdated Show resolved Hide resolved
cmd/doctor.go Outdated Show resolved Hide resolved
cmd/doctor.go Show resolved Hide resolved
cmd/doctor.go Outdated Show resolved Hide resolved
cmd/doctor.go Outdated Show resolved Hide resolved
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 5 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Ziy1-Tan Ziy1-Tan requested a review from SandyXSD September 26, 2022 06:45
@davies davies merged commit fb3f23e into juicedata:main Sep 26, 2022
@Ziy1-Tan Ziy1-Tan changed the title cmd/doctor: doctor command supports collecting system, syslog and other info cmd/doctor: doctor command to help bug report etc Sep 26, 2022
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.

6 participants