-
Notifications
You must be signed in to change notification settings - Fork 804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove user from state key metric value #5453
Remove user from state key metric value #5453
Conversation
83dd411
to
0a9d0f4
Compare
@@ -168,19 +168,19 @@ func newAlertmanagerMetrics() *alertmanagerMetrics { | |||
partialMerges: prometheus.NewDesc( | |||
"cortex_alertmanager_partial_state_merges_total", | |||
"Number of times we have received a partial state to merge for a key.", | |||
[]string{"user"}, nil), | |||
[]string{"user", "key"}, nil), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will be the value of the key
label? I am okay to add this as seems this is what we have in AM so I am not worried about cardinality issue. Just out of curiosity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed with @qinxx108 offline, this won't increase cardinality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
0a9d0f4
to
bdc940f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline too, I think it would be cause less confusion to the reader of the metrics and code if we use the label name "type" instead of "key" for alertmanager state replication related metrics.
s.partialStateMergesFailed.WithLabelValues(key) | ||
s.stateReplicationTotal.WithLabelValues(key) | ||
s.stateReplicationFailed.WithLabelValues(key) | ||
s.partialStateMergesTotal.WithLabelValues(getKeyWithoutUser(key)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to do keyWithoutUser = getKeyWithoutUser(key)
then use the new variable to pass into WithLabelValues
|
||
// getKeyWithoutUser used for trim the userID out of the metric label value. | ||
func getKeyWithoutUser(key string) string { | ||
if strings.IndexByte(key, ':') < 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why call IndexByte
twice? We can save the result in a variable right?
bdc940f
to
278f184
Compare
* Implementing Bucket index sync status Signed-off-by: Alan Protasio <alanprot@gmail.com> * fixing bug when returning from cache Signed-off-by: Alan Protasio <alanprot@gmail.com> * Addressing some comments Signed-off-by: Alan Protasio <alanprot@gmail.com> * Changelog Signed-off-by: Alan Protasio <alanprot@gmail.com> --------- Signed-off-by: Alan Protasio <alanprot@gmail.com> Signed-off-by: Yijie Qin <qinyijie@amazon.com>
Signed-off-by: Yijie Qin <qinyijie@amazon.com>
Signed-off-by: Yijie Qin <qinyijie@amazon.com>
Signed-off-by: Yijie Qin <qinyijie@amazon.com>
Signed-off-by: Yijie Qin <qinyijie@amazon.com>
Signed-off-by: Yijie Qin <qinyijie@amazon.com>
Signed-off-by: Yijie Qin <qinyijie@amazon.com>
25e9b6f
to
d6f1b06
Compare
Signed-off-by: Yijie Qin <qinyijie@amazon.com>
Signed-off-by: Yijie Qin <qinyijie@amazon.com>
Signed-off-by: Yijie Qin <qinyijie@amazon.com>
What this PR does:
The metric helper will remove the userID label and aggregate the metric, however we have a key label value in the state replicator which cause a memory leak on alert manager since the key label value include the userId which is not getting removed. This PR will remove the userId from the key
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]