Use labels for metrics #444
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#444
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "dstepanov-yadro/frostfs-node:fix/wc_metrics_labels"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #424
Closes #432
The names of the metrics have been changed in accordance with https://prometheus.io/docs/practices/naming/
Added use of labels for the same metrics
Embedding replaced with fields
Use labels for metricsto WIP: Use labels for metrics13621abe10
tod11c0cb878
d11c0cb878
to321dd2e464
WIP: Use labels for metricsto Use labels for metrics@ -0,0 +11,4 @@
if !v.Valid {
return ""
}
return fmt.Sprintf("%v", v.Bool)
Ca we use
strconv.FormatBool()
here?fixed
eb944e1a4a
to540dd8a7e0
Please, resolve conflicts.
540dd8a7e0
to2a8e05e070
Done
@ -64,3 +64,3 @@
func (m *writeCacheMetrics) Get(d time.Duration, success bool, st writecache.StorageType) {
m.metrics.AddGetDuration(m.shardID, success, d, st.String())
m.metrics.AddMethodDuration(m.shardID, "Get", success, d, st.String())
Why
Get
and notget
orGET
? (just a question)Because it is just method name with capital letter
@ -0,0 +30,4 @@
}
}
func (m *shardIDModeValue) SetMode(shardID string, mode string) {
So we have const
shardID
andmode
labels and create a new metric for each.Why not just have variable labels?
Also IMO
readonly{shard="abc"}
+degraded{shard="abc"}
is enough -- this is what we are interested in, so instead of 4 metrics for each shard we have 2.Agree, fixed
So we have 2 metrics instead of 1, because we have label "mode" with string value
@ -17,3 +11,1 @@
treeService *treeServiceMetrics
epoch prometheus.Gauge
gc *gcMetrics
engine *engineMetrics
I think I get why you do not like embedding, by why adding a pointer here?
For consistency with other code.
With what code?
2a8e05e070
to26b305f82b
Also renamed
mode
->mode_info
because it is pseudo-metric: https://prometheus.io/docs/practices/naming/@dstepanov-yadro it is said that pseudo-metric provides info about the binary, shard mode is a valid runtime state, it is not about the binary. Am I missing something here?
@ -0,0 +22,4 @@
}
func (m *shardIDModeValue) SetMode(shardID string, mode string) {
m.modeValue.DeletePartialMatch(prometheus.Labels{
So in theory we can receive no metrics for an existing shard here?
Probably not very important, but may be this is "easily" fixable?
Like, receiving 2 may be better -- we are transitioning between states anyway.
Yes, we can receive no metric for shard for some period of time when mode changes. We can use
GaugeFunc
to get continous graph.But i think it is the limitation of Go client for Prometheus, because
GaugeFunc
doesn't support removing, so deleted shard will be presented until restart.Agree, but i think we can extend this point to mode value. I think it will be clever use text label value instead of some magic number.