From e0f4bcae95cf652911cf1bcc05638c4daf714047 Mon Sep 17 00:00:00 2001 From: Kirill Fedoseev Date: Thu, 21 Apr 2022 00:46:52 +0200 Subject: [PATCH] Fix confirmation count in alerts --- prometheus/alertmanager.yml | 2 +- prometheus/templates/slack.tmpl | 8 ++++---- repository/postgres/signed_information_requests.go | 1 + repository/postgres/signed_messages.go | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/prometheus/alertmanager.yml b/prometheus/alertmanager.yml index 1a06ad9..532a4c8 100644 --- a/prometheus/alertmanager.yml +++ b/prometheus/alertmanager.yml @@ -151,7 +151,7 @@ route: group_by: [ "..." ] routes: - receiver: slack-stuck-message - group_by: [ "bridge_id", "chain_id", "block_number", "tx_hash" ] + group_by: [ "alertname", "bridge_id", "chain_id", "block_number", "tx_hash" ] matchers: - alertname = StuckMessage - receiver: slack-unknown-confirmation diff --git a/prometheus/templates/slack.tmpl b/prometheus/templates/slack.tmpl index 75999ca..663a672 100644 --- a/prometheus/templates/slack.tmpl +++ b/prometheus/templates/slack.tmpl @@ -8,7 +8,7 @@ Stuck AMB message confirmation *Chain ID:* {{ .CommonLabels.chain_id }} *Block number:* {{ .CommonLabels.block_number }} *Age:* {{ .CommonAnnotations.age }} -*Collected confirmations:* {{ .CommonLabels.count }} +*Collected confirmations:* {{ $count := "" }}{{ range .Alerts }}{{ $count = .Labels.count }}{{ end }}{{ $count }} *Tx:* {{ template "explorer.tx.link" .CommonLabels }} {{- end }} @@ -58,7 +58,7 @@ Stuck AMB information request *Chain ID:* {{ .CommonLabels.chain_id }} *Block number:* {{ .CommonLabels.block_number }} *Age:* {{ .CommonAnnotations.age }} -*Collected confirmations:* {{ .CommonLabels.count }} +*Collected confirmations:* {{ $count := "" }}{{ range .Alerts }}{{ $count = .Labels.count }}{{ end }}{{ $count }} *Tx:* {{ template "explorer.tx.link" .CommonLabels }} {{- end }} @@ -111,7 +111,7 @@ Validators signed different AMB information request results *Block number:* {{ .CommonLabels.block_number }} *Age:* {{ .CommonAnnotations.age }} *Message id:* {{ .CommonLabels.message_id }} -*Distinct information signatures:* {{ .CommonLabels.count }} +*Distinct information signatures:* {{ $count := "" }}{{ range .Alerts }}{{ $count = .Labels.count }}{{ end }}{{ $count }} *Tx:* {{ template "explorer.tx.link" .CommonLabels }} {{- end }} @@ -123,7 +123,7 @@ Stuck ERC_TO_NATIVE message confirmation *Chain ID:* {{ .CommonLabels.chain_id }} *Block number:* {{ .CommonLabels.block_number }} *Age:* {{ .CommonAnnotations.age }} -*Collected confirmations:* {{ .CommonLabels.count }} +*Collected confirmations:* {{ $count := "" }}{{ range .Alerts }}{{ $count = .Labels.count }}{{ end }}{{ $count }} *Receiver:* {{ .CommonLabels.receiver }} *Value:* {{ .CommonLabels.value }} *Tx:* {{ template "explorer.tx.link" .CommonLabels }} diff --git a/repository/postgres/signed_information_requests.go b/repository/postgres/signed_information_requests.go index 1e0c444..d840ab0 100644 --- a/repository/postgres/signed_information_requests.go +++ b/repository/postgres/signed_information_requests.go @@ -62,6 +62,7 @@ func (r *signedInformationRequestsRepo) FindByMessageID(ctx context.Context, bri q, args, err := sq.Select("*"). From(r.table). Where(sq.Eq{"bridge_id": bridgeID, "message_id": messageID}). + OrderBy("signer"). PlaceholderFormat(sq.Dollar). ToSql() if err != nil { diff --git a/repository/postgres/signed_messages.go b/repository/postgres/signed_messages.go index 686ab1c..94481b3 100644 --- a/repository/postgres/signed_messages.go +++ b/repository/postgres/signed_messages.go @@ -59,6 +59,7 @@ func (r *signedMessagesRepo) FindByMsgHash(ctx context.Context, bridgeID string, q, args, err := sq.Select("*"). From(r.table). Where(sq.Eq{"bridge_id": bridgeID, "msg_hash": msgHash}). + OrderBy("signer"). PlaceholderFormat(sq.Dollar). ToSql() if err != nil {