Skip to content

Conversation

gaius-qi
Copy link
Member

Description

This pull request refactors the monitoring initialization logic to improve clarity and maintainability. The key changes include replacing the use of freeport with a simplified configuration for statsview, renaming variables for better readability, and updating the shutdown handling mechanism.

Refactoring of monitoring initialization:

  • Removed the freeport dependency and replaced the dynamic port assignment with a direct configuration using net.IPv4zero for statsview. This simplifies the initialization process for monitoring. (cmd/dependency/dependency.go, [1] [2]
  • Renamed the fc channel to shutdowns for better semantic clarity, and updated the logging messages to reflect this change. (cmd/dependency/dependency.go, cmd/dependency/dependency.goL96-R124)
  • Simplified the statsview initialization by removing redundant logging and directly handling errors during its startup. (cmd/dependency/dependency.go, cmd/dependency/dependency.goL96-R124)

Updates to shutdown handling:

  • Updated the InitMonitor function to return a shutdown function instead of a channel, improving the readability and usage of the function. (cmd/dependency/dependency.go, cmd/dependency/dependency.goL96-R124)
  • Replaced calls to InitMonitor in runManager and runScheduler functions with the updated shutdown mechanism to align with the refactored implementation. (cmd/manager/cmd/root.go, [1]; cmd/scheduler/cmd/root.go, [2]

Related Issue

Motivation and Context

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

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

…shutdown logic

Signed-off-by: Gaius <gaius.qi@gmail.com>
@gaius-qi gaius-qi added the enhancement New feature or request label Apr 23, 2025
@gaius-qi gaius-qi added this to the v2.3.0 milestone Apr 23, 2025
@gaius-qi gaius-qi self-assigned this Apr 23, 2025
@gaius-qi gaius-qi requested a review from a team as a code owner April 23, 2025 08:54
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) April 23, 2025 08:55
Copy link
Member

@fcgxz2003 fcgxz2003 left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

codecov bot commented Apr 23, 2025

Codecov Report

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

Project coverage is 34.42%. Comparing base (8c23c8b) to head (28cbb8b).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
cmd/dependency/dependency.go 0.00% 15 Missing ⚠️
cmd/manager/cmd/root.go 0.00% 2 Missing ⚠️
cmd/scheduler/cmd/root.go 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3986      +/-   ##
==========================================
+ Coverage   34.40%   34.42%   +0.02%     
==========================================
  Files         341      341              
  Lines       40072    40063       -9     
==========================================
+ Hits        13786    13792       +6     
+ Misses      25380    25365      -15     
  Partials      906      906              
Flag Coverage Δ
unittests 34.42% <0.00%> (+0.02%) ⬆️

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

Files with missing lines Coverage Δ
cmd/manager/cmd/root.go 0.00% <0.00%> (ø)
cmd/scheduler/cmd/root.go 0.00% <0.00%> (ø)
cmd/dependency/dependency.go 0.00% <0.00%> (ø)

... and 4 files with indirect coverage changes

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

Copy link

@Liam-Zhao Liam-Zhao 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 merged commit 83375a5 into main Apr 23, 2025
27 checks passed
@chlins chlins deleted the feature/statsview branch April 23, 2025 09:38
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.

5 participants