Collect statistics about transaction explorer views
parent
e082ca3bb7
commit
049b4d21f0
|
@ -17,6 +17,7 @@ type Metrics struct {
|
|||
RPCLatency *prometheus.HistogramVec
|
||||
IndexResyncErrors *prometheus.CounterVec
|
||||
IndexDBSize prometheus.Gauge
|
||||
TxExplorerRedirects *prometheus.CounterVec
|
||||
}
|
||||
|
||||
type Labels = prometheus.Labels
|
||||
|
@ -104,6 +105,14 @@ func GetMetrics(coin string) (*Metrics, error) {
|
|||
ConstLabels: Labels{"coin": coin},
|
||||
},
|
||||
)
|
||||
metrics.TxExplorerRedirects = prometheus.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Name: "blockbook_tx_explorer_views",
|
||||
Help: "Number of views of the transaction explorer",
|
||||
ConstLabels: Labels{"coin": coin},
|
||||
},
|
||||
[]string{},
|
||||
)
|
||||
|
||||
v := reflect.ValueOf(metrics)
|
||||
for i := 0; i < v.NumField(); i++ {
|
||||
|
|
|
@ -128,6 +128,7 @@ func (s *SocketIoServer) Shutdown(ctx context.Context) error {
|
|||
func (s *SocketIoServer) txRedirect(w http.ResponseWriter, r *http.Request) {
|
||||
if s.explorerURL != "" {
|
||||
http.Redirect(w, r, s.explorerURL+r.URL.Path, 302)
|
||||
s.metrics.TxExplorerRedirects.With(common.Labels{}).Inc()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue