node: Add path of the write_cache to metric labels #1107

Merged
fyrchik merged 3 commits from achuprov/frostfs-node:add_path_writecache_metrics into master 2024-05-02 06:46:49 +00:00
Member

Close: #966

curl s01.frostfs.devenv:9090 | grep writecache
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 79585 # HELP frostfs_node_writecache_actual_objects_total Actual objects count in writecache
   # TYPE frostfs_node_writecache_actual_objects_total gauge
0 7frostfs_node_writecache_actual_objects_total{path="/storage/wc0",shard_id="9KGwFEyFmXVvCHCAhshwf4",storage="db"} 0
95frostfs_node_writecache_actual_objects_total{path="/storage/wc0",shard_id="9KGwFEyFmXVvCHCAhshwf4",storage="fstree"} 0
85frostfs_node_writecache_actual_objects_total{path="/storage/wc1",shard_id="Y68tuiY3zucvjNzfagsf9w",storage="db"} 0
 frostfs_node_writecache_actual_objects_total{path="/storage/wc1",shard_id="Y68tuiY3zucvjNzfagsf9w",storage="fstree"} 0
  # HELP frostfs_node_writecache_estimated_size_bytes Estimated writecache size
 0# TYPE frostfs_node_writecache_estimated_size_bytes gauge
  frostfs_node_writecache_estimated_size_bytes{path="/storage/wc0",shard_id="9KGwFEyFmXVvCHCAhshwf4",storage="db"} 0
  frostfs_node_writecache_estimated_size_bytes{path="/storage/wc0",shard_id="9KGwFEyFmXVvCHCAhshwf4",storage="fstree"} 0
 0frostfs_node_writecache_estimated_size_bytes{path="/storage/wc1",shard_id="Y68tuiY3zucvjNzfagsf9w",storage="db"} 0
  frostfs_node_writecache_estimated_size_bytes{path="/storage/wc1",shard_id="Y68tuiY3zucvjNzfagsf9w",storage="fstree"} 0
24# HELP frostfs_node_writecache_mode_info Writecache mode value
.5# TYPE frostfs_node_writecache_mode_info gauge
M frostfs_node_writecache_mode_info{mode="READ_WRITE",shard_id="9KGwFEyFmXVvCHCAhshwf4"} 1
  frostfs_node_writecache_mode_info{mode="READ_WRITE",shard_id="Y68tuiY3zucvjNzfagsf9w"} 1
   0 --:--:-- --:--:-- --:--:-- 37.9M
achuprov@NB-4053:~/Documents/work/frostfs-n

Signed-off-by: Alexander Chuprov a.chuprov@yadro.com

Close: #966 ``` curl s01.frostfs.devenv:9090 | grep writecache % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 79585 # HELP frostfs_node_writecache_actual_objects_total Actual objects count in writecache # TYPE frostfs_node_writecache_actual_objects_total gauge 0 7frostfs_node_writecache_actual_objects_total{path="/storage/wc0",shard_id="9KGwFEyFmXVvCHCAhshwf4",storage="db"} 0 95frostfs_node_writecache_actual_objects_total{path="/storage/wc0",shard_id="9KGwFEyFmXVvCHCAhshwf4",storage="fstree"} 0 85frostfs_node_writecache_actual_objects_total{path="/storage/wc1",shard_id="Y68tuiY3zucvjNzfagsf9w",storage="db"} 0 frostfs_node_writecache_actual_objects_total{path="/storage/wc1",shard_id="Y68tuiY3zucvjNzfagsf9w",storage="fstree"} 0 # HELP frostfs_node_writecache_estimated_size_bytes Estimated writecache size 0# TYPE frostfs_node_writecache_estimated_size_bytes gauge frostfs_node_writecache_estimated_size_bytes{path="/storage/wc0",shard_id="9KGwFEyFmXVvCHCAhshwf4",storage="db"} 0 frostfs_node_writecache_estimated_size_bytes{path="/storage/wc0",shard_id="9KGwFEyFmXVvCHCAhshwf4",storage="fstree"} 0 0frostfs_node_writecache_estimated_size_bytes{path="/storage/wc1",shard_id="Y68tuiY3zucvjNzfagsf9w",storage="db"} 0 frostfs_node_writecache_estimated_size_bytes{path="/storage/wc1",shard_id="Y68tuiY3zucvjNzfagsf9w",storage="fstree"} 0 24# HELP frostfs_node_writecache_mode_info Writecache mode value .5# TYPE frostfs_node_writecache_mode_info gauge M frostfs_node_writecache_mode_info{mode="READ_WRITE",shard_id="9KGwFEyFmXVvCHCAhshwf4"} 1 frostfs_node_writecache_mode_info{mode="READ_WRITE",shard_id="Y68tuiY3zucvjNzfagsf9w"} 1 0 --:--:-- --:--:-- --:--:-- 37.9M achuprov@NB-4053:~/Documents/work/frostfs-n ``` Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
achuprov force-pushed add_path_writecache_metrics from b827c88b40 to 5590bbef63 2024-04-24 17:23:18 +00:00 Compare
achuprov requested review from storage-core-committers 2024-04-24 17:24:50 +00:00
achuprov requested review from storage-core-developers 2024-04-24 17:25:11 +00:00
dstepanov-yadro requested changes 2024-04-26 07:24:30 +00:00
@ -190,6 +190,9 @@ func New(opts ...Option) *Shard {
s.fillInfo()
if c.useWriteCache {

Please move to existed if c.useWriteCache branch:


	if c.useWriteCache {
		s.writeCache = writecache.New(
			append(c.writeCacheOpts,
				writecache.WithReportErrorFunc(reportFunc),
				writecache.WithBlobstor(bs),
				writecache.WithMetabase(mb))...)
	}

It is more complex when multiple if-statements with the same condition exist.

Please move to existed `if c.useWriteCache` branch: ``` if c.useWriteCache { s.writeCache = writecache.New( append(c.writeCacheOpts, writecache.WithReportErrorFunc(reportFunc), writecache.WithBlobstor(bs), writecache.WithMetabase(mb))...) } ``` It is more complex when multiple `if`-statements with the same condition exist.
Author
Member

fixed

fixed
@ -22,3 +22,1 @@
var (
subjectNotFoundErrorMessage = "subject not found"
)
var subjectNotFoundErrorMessage = "subject not found"

fyrchik will ask to move to separate commit:)

`fyrchik` will ask to move to separate commit:)
Owner

Of course, I will!

Of course, I will!
Author
Member

fixed

fixed
fyrchik requested changes 2024-04-26 10:35:43 +00:00
@ -22,3 +22,3 @@
}
func (m *shardIDModeValue) SetMode(shardID string, mode string) {
func (m *shardIDModeValue) SetMode(shardID, mode string) {
Owner

Unrelated to the commit.

Unrelated to the commit.
Author
Member

fixed

fixed
@ -12,4 +12,0 @@
AddMethodDuration(shardID string, method string, success bool, d time.Duration, storageType string)
SetActualCount(shardID string, count uint64, storageType string)
SetEstimateSize(shardID string, size uint64, storageType string)
SetMode(shardID string, mode string)
Owner

Unrelated to the commit.

Unrelated to the commit.
Author
Member

fixed

fixed
achuprov force-pushed add_path_writecache_metrics from 5590bbef63 to e2a839beb0 2024-04-26 16:30:34 +00:00 Compare
achuprov force-pushed add_path_writecache_metrics from e2a839beb0 to 3fe3eb1d31 2024-04-26 16:39:51 +00:00 Compare
achuprov force-pushed add_path_writecache_metrics from 3fe3eb1d31 to d90946e5f2 2024-04-26 16:44:30 +00:00 Compare
Owner

Could you also describe a reason for parameter reordering in the commit message? e.g. success bool, d time.Duration are the last parameters in all our interfaces.

Could you also describe a reason for parameter reordering in the commit message? e.g. `success bool, d time.Duration` are the last parameters in all our interfaces.
achuprov force-pushed add_path_writecache_metrics from d90946e5f2 to e6dff95cb2 2024-04-27 12:44:55 +00:00 Compare
achuprov force-pushed add_path_writecache_metrics from e6dff95cb2 to fa0bc8e1df 2024-04-27 12:49:41 +00:00 Compare
Author
Member

@fyrchik fixed

@fyrchik fixed
fyrchik approved these changes 2024-04-27 13:45:24 +00:00
acid-ant approved these changes 2024-04-27 18:29:11 +00:00
fyrchik added this to the v0.39.0 milestone 2024-05-02 06:46:34 +00:00
fyrchik removed this from the v0.39.0 milestone 2024-05-02 06:46:42 +00:00
fyrchik merged commit c9efaa5819 into master 2024-05-02 06:46:49 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-core-developers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#1107
No description provided.