mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
ff92b701c3
refactored data structure for sync statistics
19 lines
480 B
Go
19 lines
480 B
Go
package diagnostics
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
func SetupStagesAccess(metricsMux *http.ServeMux, diag *DiagnosticClient) {
|
|
metricsMux.HandleFunc("/snapshot-sync", func(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
w.Header().Set("Content-Type", "application/json")
|
|
writeStages(w, diag)
|
|
})
|
|
}
|
|
|
|
func writeStages(w http.ResponseWriter, diag *DiagnosticClient) {
|
|
json.NewEncoder(w).Encode(diag.SyncStatistics())
|
|
}
|