-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from Layr-Labs/fix-tx-revert-logs-metrics-alerts
Add metrics to track txs reverting
- Loading branch information
Showing
10 changed files
with
90 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package main | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/promauto" | ||
"github.com/prometheus/client_golang/prometheus/promhttp" | ||
) | ||
|
||
var ( | ||
erroredTxs = promauto.NewCounter(prometheus.CounterOpts{ | ||
Name: "errored_txs_total", | ||
Help: "The total number of transactions that errored (failed to get processed by chain)", | ||
}) | ||
revertedTxs = promauto.NewCounter(prometheus.CounterOpts{ | ||
Name: "reverted_txs_total", | ||
Help: "The total number of transactions that reverted (processed by chain but reverted)", | ||
}) | ||
operatorsUpdated = promauto.NewGaugeVec(prometheus.GaugeOpts{ | ||
Name: "operators_updated", | ||
Help: "The total number of operators updated (during the last quorum sync)", | ||
}, []string{"quorum"}) | ||
) | ||
|
||
func StartMetricsServer(metricsAddr string) { | ||
registry := prometheus.NewRegistry() | ||
registry.MustRegister(erroredTxs, revertedTxs, operatorsUpdated) | ||
http.Handle("/metrics", promhttp.HandlerFor(registry, promhttp.HandlerOpts{})) | ||
// not sure if we need to handle this error, since if metric server errors, then we will get alerts from grafana | ||
go http.ListenAndServe(metricsAddr, nil) | ||
} |