// Copyright (C) 2018 Audrius Butkevicius and Contributors (see the CONTRIBUTORS file).
packagemain
import(
"encoding/json"
"net"
"net/http"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/syncthing/syncthing/lib/sync"
)
var(
statusClient=http.Client{
Timeout:5*time.Second,
}
apiRequestsTotal=makeCounter("api_requests_total","Number of API requests.","type","result")
apiRequestsSeconds=makeSummary("api_requests_seconds","Latency of API requests.","type")
relayTestsTotal=makeCounter("tests_total","Number of relay tests.","result")
relayTestActionsSeconds=makeSummary("test_actions_seconds","Latency of relay test actions.","type")
locationLookupSeconds=makeSummary("location_lookup_seconds","Latency of location lookups.").WithLabelValues()
metricsRequestsSeconds=makeSummary("metrics_requests_seconds","Latency of metric requests.").WithLabelValues()
scrapeSeconds=makeSummary("relay_scrape_seconds","Latency of metric scrapes from remote relays.","result")
relayUptime=makeGauge("relay_uptime","Uptime of relay","relay")
relayPendingSessionKeys=makeGauge("relay_pending_session_keys","Number of pending session keys (two keys per session, one per each side of the connection)","relay")
relayActiveSessions=makeGauge("relay_active_sessions","Number of sessions that are happening, a session contains two parties","relay")
relayConnections=makeGauge("relay_connections","Number of devices connected to the relay","relay")
relayProxies=makeGauge("relay_proxies","Number of active proxy routines sending data between peers (two proxies per session, one for each way)","relay")
relayBytesProxied=makeGauge("relay_bytes_proxied","Number of bytes proxied by the relay","relay")
relayGoRoutines=makeGauge("relay_go_routines","Number of Go routines in the process","relay")
relaySessionRate=makeGauge("relay_session_rate","Rate applied per session","relay")
relayGlobalRate=makeGauge("relay_global_rate","Global rate applied on the whole relay","relay")
relayBuildInfo=makeGauge("relay_build_info","Build information about a relay","relay","go_version","go_os","go_arch")
relayLocationInfo=makeGauge("relay_location_info","Location information about a relay","relay","city","country","continent")