Skip to content

ROX-30836: implement hotreloading configuration for outputs#119

Merged
Molter73 merged 3 commits intomainfrom
mauro/ROX-30836/hotreload-output
Oct 30, 2025
Merged

ROX-30836: implement hotreloading configuration for outputs#119
Molter73 merged 3 commits intomainfrom
mauro/ROX-30836/hotreload-output

Conversation

@Molter73
Copy link
Copy Markdown
Contributor

@Molter73 Molter73 commented Oct 20, 2025

Description

With this patch, it is possible to reload the configuration used for gRPC communication. Allowing changes to the certificate directory or output URL to be done without a full restart being required.

The output code has also been slightly refactored, the module now has a single start function that will spawn a task for gRPC output and another for JSON to stdout (if this is required at start up or the gRPC output is not configured).
Both the gRPC and stdout code now live as submodules of the output module.
The stdout output is meant mostly for debugging, so hotreloading was not implemented for it.
Lastly, there used to be a task that would receive Arc<Event> messages from the BPF worker, translate them to the FileActivity type and forward them out a separate channel that ultimately was the gRPC stream, this whole workflow has now been replaced by a filter_map operation that does the translating on the gRPC stream directly, leading to more concise code.

I don't expect the URL reloading to be particularly useful but, when we inevitable get asked to have certificate hot reloading, this will make the required change trivial (simply trigger a gRPC configuration reloading when the certificate files change).

Checklist

  • Investigated and inspected CI test results
  • Updated documentation accordingly

Automated testing

  • Added unit tests
  • Added integration tests
  • Added regression tests

If any of these don't apply, please comment below.

Testing Performed

Manually tested with the mock-server + added integration test.

@Molter73 Molter73 changed the title Mauro/rox 30836/hotreload output ROX-30836: implement hotreloading configuration for outputs Oct 20, 2025
@Molter73
Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@Molter73
Copy link
Copy Markdown
Contributor Author

/retest

Copy link
Copy Markdown
Contributor

@Stringy Stringy left a comment

Choose a reason for hiding this comment

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

Couple of nits but nothing major

Comment thread fact/src/output/grpc.rs Outdated
}
}

pub(super) fn is_active(&self) -> bool {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[nit] is_active implies to me that there is a connection -- perhaps is_enabled?

Comment thread fact/src/output/grpc.rs
Comment thread fact/src/config/mod.rs
@Molter73 Molter73 force-pushed the mauro/ROX-30836/hotreload-output branch from a75dddc to 642301c Compare October 29, 2025 11:32
Base automatically changed from mauro/ROX-30836/config-hotreload to main October 30, 2025 09:53
With this patch, it is possible to reload the configuration used for
gRPC communication. Allowing changes to the certificate directory or
output URL to be done without a full restart being required.

The output code has also been slightly refactored, the module now has a
single start function that will spawn a task for gRPC output and another
for JSON to stdout (if this is required at start up or the gRPC output
is not configured). Both the gRPC and stdout code now live as submodules
of the output module. The stdout output is meant mostly for debugging,
so hotreloading was not implemented for it. Lastly, there used to be a
task that would receive `Arc<Event>` messages from the BPF worker,
translate them to the `FileActivity` type and forward them out a
separate channel that ultimately was the gRPC stream, this whole
workflow has now been replaced by a filter_map operation that does the
translating on the gRPC stream directly, leading to more concise code.
@Molter73 Molter73 force-pushed the mauro/ROX-30836/hotreload-output branch from 642301c to 5b2adad Compare October 30, 2025 09:54
@Molter73 Molter73 merged commit 3e95067 into main Oct 30, 2025
20 checks passed
@Molter73 Molter73 deleted the mauro/ROX-30836/hotreload-output branch October 30, 2025 10:45
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