Skip to content

Conversation

akx
Copy link
Member

@akx akx commented Sep 10, 2025

This PR:

  • upgrades bits and pieces as usual
  • refactors things so configuration is read once from env
  • adds a no-restart mode, useful for development
  • adds a mode where output is JSON(L) written to stdout, for easier plugging into other use cases!

@akx akx requested review from a team, Copilot, ruksi and tokkoro and removed request for a team September 10, 2025 06:33
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors environment variable handling into a proper configuration system and adds support for writing stats to stdout instead of files only. The refactor centralizes configuration management while maintaining backward compatibility with existing environment variables.

  • Replaces direct environment variable access with a centralized Config struct
  • Adds stdout output mode as an alternative to file-based stats storage
  • Updates all CPU usage functions to accept configurable sample intervals

Reviewed Changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/config.rs New configuration module with Config struct and centralized env var parsing
src/consts.rs New constants module extracting shared values from env module
src/store.rs Refactored to support multiple output modes (file vs stdout) via config
src/main.rs Updated to use new config system and improved restart logic
src/lib.rs Modified to accept config parameter and pass it through
src/stats/ Updated CPU usage functions to accept configurable sample intervals
src/env.rs Removed unused constants moved to consts.rs
README.md Updated documentation to reflect new output modes and configuration options
Cargo.toml Updated dependencies including anyhow for error handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@ruksi ruksi left a comment

Choose a reason for hiding this comment

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

good changes all around!

could've used the stdout and no-restart modes when developing 😆

@akx akx enabled auto-merge September 10, 2025 07:04
@akx akx merged commit db004a1 into main Sep 10, 2025
6 checks passed
@akx akx deleted the next branch September 10, 2025 07:04
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.

2 participants