Skip to content

Make configuration immutable#330

Merged
bal-e merged 3 commits intomainfrom
immutable-config
Nov 15, 2025
Merged

Make configuration immutable#330
bal-e merged 3 commits intomainfrom
immutable-config

Conversation

@bal-e
Copy link
Contributor

@bal-e bal-e commented Nov 5, 2025

We have decided that Cascade will load configuration on startup, and that changes to configuration necessitate restarting it. The only part of configuration that could change dynamically is the log level. So, I've moved the actual config field from State to Center. This eliminates a number of mutex locks and some boilerplate bookkeeping. This also removes cascade config reload; we need to discuss the appropriate CLI for modifying the log level and add that in a separate PR.

@bal-e bal-e self-assigned this Nov 5, 2025
@bal-e bal-e linked an issue Nov 5, 2025 that may be closed by this pull request
@bal-e bal-e marked this pull request as ready for review November 5, 2025 08:51
It is no longer necessary to lock the state to access configuration.
This also completely removes the ability to change configuration at
runtime -- we will provide specialized commands for changing the log
level dynamically.
- Restored the correct interpretation of the 'trace_targets' setting
  and removed the potential for errors when parsing it.

- Replaced 'EnvFilter' (which adds a lot of complexity) with a simple
  manual filter implementation.  It requires about the same number of
  lines of code on our end.

- Replaced 'Result<_, String>' with a structured error type.

- Added 'RuntimeConfig' to account for runtime configuration, such as
  logging.

- Changed 'apply()' to use 'RuntimeConfig', so it is only applicable to
  dynamic runtime changes.

- Overhauled the syslog writer considerably:

  - Moved the code under a 'cfg(unix)' submodule.

  - Improved support for non-UTF-8 printing, for the hostname and
    program name.

  - Accounted for failures from all connection attempts in the
    connection error type.

  - Disabled Nagle's algorithm for TCP connections instead of flushing
    bytes explicitly (which is an extra syscall).

  - Added IPv6 support for UDP and TCP connections.
The 'cascade config reload' command is removed in favor of a specialized
command for changing logging behaviour, 'cascade debug change-logging'.
@bal-e bal-e linked an issue Nov 13, 2025 that may be closed by this pull request
@bal-e bal-e merged commit 245665b into main Nov 15, 2025
27 checks passed
@bal-e bal-e deleted the immutable-config branch November 15, 2025 16:12
bal-e added a commit that referenced this pull request Nov 21, 2025
I forgot to update the documentation!
@bal-e bal-e added this to the 0.1.0-alpha5 milestone Nov 21, 2025
bal-e added a commit that referenced this pull request Nov 21, 2025
I forgot to update the documentation!
bal-e added a commit that referenced this pull request Nov 21, 2025
I forgot to update the documentation!
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.

Change log level at runtime cascade config reload does not apply changes at runtime

2 participants