feat(node): allow user to set the metrics server port #849
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.
Description
Summary generated by Reviewpad on 18 Oct 23 14:45 UTC
This pull request includes the following changes:
In the file diff for
sn_node/src/network_builder.rs
, a new fieldmetrics_server_port
has been introduced in theNetworkBuilder
struct. The field has a default value of 0, and a new methodmetrics_server_port
has been implemented to set the value of this field.The file
sn_node/src/main.rs
has undergone changes, including the addition of themetrics_server_port
field in theOpt
struct, allowing users to specify the port for the OpenMetrics Server. Themain()
function now creates aNodeBuilder
instance and sets themetrics_server_port
if the"open-metrics"
feature flag is enabled. The functionstart_node()
has been renamed torun_node()
and now accepts aNodeBuilder
instance instead of individual parameters. Lastly, therun_node()
function uses theNodeBuilder
instance to build and run the node.The file
sn_node/src/put_validation.rs
has been modified to reorganize the import statements by movingTRANSFER_NOTIF_TOPIC
to the correct module. Some references to theNode
struct have been updated, and an extra comma has been removed.The file
sn_node/src/replication.rs
has been updated with changes to import statements. The import statement forNode
has been modified fromcrate::Node
tocrate::node::Node
, and the import statement forlibp2p
has been updated to includekad::{Record, RecordKey, K_VALUE}
. Additionally, the import statements forResult
andMarker
have been removed.The file
sn_node/src/metrics_service.rs
includes changes to therun_metrics_server
function, which now accepts an additional parameterport
of typeu16
. The linelet addr = ([0, 0, 0, 0], 0).into();
has also been modified tolet addr = ([0, 0, 0, 0], port).into();
.The file
sn_node/src/lib.rs
has undergone multiple changes, including the removal of theapi
module and the addition of thenode
module. Module imports have been reordered anduse
statements have been updated. TheNode
struct has been renamed toRunningNode
, and theevents_channel
field of theRunningNode
struct has been renamed tonode_events_channel
. Additionally, implementations for methods in theRunningNode
struct have been added.The file
sn_node/src/storecost.rs
has been deleted, as it contained code related to getting the local store cost in theNode
struct.These changes introduce new features, improve organization and clarity of the code, and address import statement updates and function modifications.
Let me know if you need any further assistance!