Skip to content

Conversation

inetfuture
Copy link
Contributor

@inetfuture inetfuture commented Jun 22, 2025

Description

This change adds --log-level option for manager and scheduler, with empty string as default value, so it won't affect existing depoyments. When specify --log-level and --verbose at the same time, --log-level will take precedence.

Note that since cmd and log functionality use shared code, so dfcahe and dfget are also affected.

Config files containing verbose: true have been updated, but not those under testdata/.

Related Issue

#2670

Motivation and Context

We see a lot of logs in our environment, it would be nice to be able to control log level of manager and scheduler so we can ignore not important logs and reduce log storage cost.

Also, the peer fsm event failed: event Leave inappropriate because previous transition did not complete log is too frequent, better to change its level to INFO so it can be ignored.

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

@inetfuture inetfuture requested a review from a team as a code owner June 22, 2025 10:31
@inetfuture
Copy link
Contributor Author

@gaius-qi Please help to review.

@inetfuture inetfuture force-pushed the add-log-level branch 2 times, most recently from e7bbf58 to 00df44c Compare June 22, 2025 12:29
Signed-off-by: Aaron Wang <aaron.wang@maiscrm.com>
@inetfuture
Copy link
Contributor Author

I noticed the docs says Dfcache, Dfdaemon, Dfget already support --log-level, but with latest code, it's not true, I wonder why.

image image

Copy link
Member

@gaius-qi gaius-qi left a comment

Choose a reason for hiding this comment

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

LGTM

@gaius-qi gaius-qi added the enhancement New feature or request label Jun 24, 2025
Copy link
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

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

lgtm

@chlins chlins enabled auto-merge (squash) June 24, 2025 02:33
Copy link

codecov bot commented Jun 24, 2025

Codecov Report

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

Project coverage is 32.94%. Comparing base (a5895bb) to head (54e04bb).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
internal/dflog/loginit.go 0.00% 31 Missing ⚠️
internal/dflog/logcore.go 0.00% 16 Missing ⚠️
pkg/log/log.go 0.00% 2 Missing ⚠️
cmd/dependency/dependency.go 0.00% 1 Missing ⚠️
cmd/dfcache/cmd/root.go 0.00% 1 Missing ⚠️
cmd/dfget/cmd/daemon.go 0.00% 1 Missing ⚠️
cmd/dfget/cmd/root.go 0.00% 1 Missing ⚠️
cmd/manager/cmd/root.go 0.00% 1 Missing ⚠️
cmd/scheduler/cmd/root.go 0.00% 1 Missing ⚠️
scheduler/resource/standard/peer_manager.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4146      +/-   ##
==========================================
- Coverage   32.96%   32.94%   -0.03%     
==========================================
  Files         346      346              
  Lines       40922    40949      +27     
==========================================
- Hits        13490    13489       -1     
- Misses      26538    26566      +28     
  Partials      894      894              
Flag Coverage Δ
unittests 32.94% <0.00%> (-0.03%) ⬇️

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

Files with missing lines Coverage Δ
cmd/dependency/dependency.go 0.00% <0.00%> (ø)
cmd/dfcache/cmd/root.go 0.00% <0.00%> (ø)
cmd/dfget/cmd/daemon.go 0.00% <0.00%> (ø)
cmd/dfget/cmd/root.go 0.00% <0.00%> (ø)
cmd/manager/cmd/root.go 0.00% <0.00%> (ø)
cmd/scheduler/cmd/root.go 0.00% <0.00%> (ø)
scheduler/resource/standard/peer_manager.go 73.10% <0.00%> (ø)
pkg/log/log.go 0.00% <0.00%> (ø)
internal/dflog/logcore.go 0.00% <0.00%> (ø)
internal/dflog/loginit.go 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

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

@gaius-qi
Copy link
Member

I noticed the docs says Dfcache, Dfdaemon, Dfget already support --log-level, but with latest code, it's not true, I wonder why.

Now client is maintained in https://github.com/dragonflyoss/client.

@chlins chlins merged commit 1ba7014 into dragonflyoss:main Jun 24, 2025
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants