Skip to content

Commit

Permalink
Announce storage node version via the attributes (#2484)
Browse files Browse the repository at this point in the history
  • Loading branch information
cthulhu-rider committed Aug 10, 2023
2 parents 9f0077e + 26db709 commit 4e0eb31
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Changelog for NeoFS Node
- Stored payload metric per container (#2116)
- Stored payload metric per shard (#2023)
- Histogram metrics for RPC and engine operations (#2351)
- SN's version is announced via the attributes automatically but can be overwritten explicitly (#2455)

### Fixed
- `neo-go` RPC connection loss handling (#1337)
Expand Down
11 changes: 11 additions & 0 deletions cmd/neofs-node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,11 @@ var persistateSideChainLastBlockKey = []byte("side_chain_last_processed_block")
func initCfg(appCfg *config.Config) *cfg {
c := &cfg{}

// attaching version to the node's attributes; do not
// move it anywhere below reading the other attributes
// since a user should be able to overwrite it.
writeAppVersion(c)

err := c.readConfig(appCfg)
if err != nil {
panic(fmt.Errorf("config reading: %w", err))
Expand Down Expand Up @@ -963,3 +968,9 @@ func (c *cfg) configWatcher(ctx context.Context) {
}
}
}

// writeAppVersion writes app version as defined at compilation
// step to the node's attributes.
func writeAppVersion(c *cfg) {
c.cfgNodeInfo.localInfo.SetAttribute("Version", misc.Version)
}

0 comments on commit 4e0eb31

Please sign in to comment.