fdctl: add monitor --topo flag#8659
Open
ripatel-fd wants to merge 1 commit intofiredancer-io:mainfrom
Open
Conversation
Allows running monitor for custom topologies
mmcgee-jump
approved these changes
Mar 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for selecting an alternate predefined topology when running fdctl monitor, enabling the monitor UI to attach to non-default topologies.
Changes:
- Extend
monitorcommand args with atopostring buffer to store the selected topology name. - Parse a new
--topoflag inmonitorand reconstructconfig->topoby looking up the named action inACTIONS[]. - Invoke topology reconstruction at the start of
monitor_cmd_fn.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/app/shared/fd_action.h |
Adds monitor.topo storage to args_t so the selected topology name can be passed through execution. |
src/app/shared/commands/monitor/monitor.c |
Parses --topo, looks up the matching action topology via ACTIONS[], and rebuilds config->topo before starting the monitor. |
| char const * topo_name = fd_env_strip_cmdline_cstr( pargc, pargv, "--topo", NULL, "" ); | ||
|
|
||
| ulong topo_name_len = strlen( topo_name ); | ||
| if( FD_UNLIKELY( topo_name_len > sizeof(args->monitor.topo)-1 ) ) FD_LOG_ERR(( "Unknown --topo %s", topo_name )); |
There was a problem hiding this comment.
The length check for --topo reports "Unknown --topo", but the actual failure mode here is that the provided string is too long for args->monitor.topo. This is misleading for users and also logs the full (potentially very large) input string. Consider changing the message to something like "--topo too long (max N)" and/or truncating the logged value to the buffer size.
Suggested change
| if( FD_UNLIKELY( topo_name_len > sizeof(args->monitor.topo)-1 ) ) FD_LOG_ERR(( "Unknown --topo %s", topo_name )); | |
| ulong max_topo_len = sizeof(args->monitor.topo) - 1UL; | |
| if( FD_UNLIKELY( topo_name_len > max_topo_len ) ) | |
| FD_LOG_ERR(( "--topo too long (max %lu chars)", max_topo_len )); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allows running monitor for custom topologies