mirror of
https://github.com/jetkvm/kvm.git
synced 2025-09-16 08:38:14 +00:00
* chore(network): improve connectivity check * refactor(network): rewrite network and timesync component * feat(display): show cloud connection status * chore: change logging verbosity * chore(websecure): update log message * fix(ota): validate root certificate when downloading update * feat(ui): add network settings tab * fix(display): cloud connecting animation * fix: golintci issues * feat: add network settings tab * feat(timesync): query servers in parallel * refactor(network): move to internal/network package * feat(timesync): add metrics * refactor(log): move log to internal/logging package * refactor(mdms): move mdns to internal/mdns package * feat(developer): add pprof endpoint * feat(logging): add a simple logging streaming endpoint * fix(mdns): do not start mdns until network is up * feat(network): allow users to update network settings from ui * fix(network): handle errors when net.IPAddr is nil * fix(mdns): scopedLogger SIGSEGV * fix(dhcp): watch directory instead of file to catch fsnotify.Create event * refactor(nbd): move platform-specific code to different files * refactor(native): move platform-specific code to different files * chore: fix linter issues * chore(dev_deploy): allow to override PION_LOG_TRACE
148 lines
4.2 KiB
Go
148 lines
4.2 KiB
Go
package timesync
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
)
|
|
|
|
var (
|
|
metricTimeSyncStatus = promauto.NewGauge(
|
|
prometheus.GaugeOpts{
|
|
Name: "jetkvm_timesync_status",
|
|
Help: "The status of the timesync, 1 if successful, 0 if not",
|
|
},
|
|
)
|
|
metricTimeSyncCount = promauto.NewCounter(
|
|
prometheus.CounterOpts{
|
|
Name: "jetkvm_timesync_count",
|
|
Help: "The number of times the timesync has been run",
|
|
},
|
|
)
|
|
metricTimeSyncSuccessCount = promauto.NewCounter(
|
|
prometheus.CounterOpts{
|
|
Name: "jetkvm_timesync_success_count",
|
|
Help: "The number of times the timesync has been successful",
|
|
},
|
|
)
|
|
metricRTCUpdateCount = promauto.NewCounter( //nolint:unused
|
|
prometheus.CounterOpts{
|
|
Name: "jetkvm_timesync_rtc_update_count",
|
|
Help: "The number of times the RTC has been updated",
|
|
},
|
|
)
|
|
metricNtpTotalSuccessCount = promauto.NewCounter(
|
|
prometheus.CounterOpts{
|
|
Name: "jetkvm_timesync_ntp_total_success_count",
|
|
Help: "The total number of successful NTP requests",
|
|
},
|
|
)
|
|
metricNtpTotalRequestCount = promauto.NewCounter(
|
|
prometheus.CounterOpts{
|
|
Name: "jetkvm_timesync_ntp_total_request_count",
|
|
Help: "The total number of NTP requests sent",
|
|
},
|
|
)
|
|
metricNtpSuccessCount = promauto.NewCounterVec(
|
|
prometheus.CounterOpts{
|
|
Name: "jetkvm_timesync_ntp_success_count",
|
|
Help: "The number of successful NTP requests",
|
|
},
|
|
[]string{"url"},
|
|
)
|
|
metricNtpRequestCount = promauto.NewCounterVec(
|
|
prometheus.CounterOpts{
|
|
Name: "jetkvm_timesync_ntp_request_count",
|
|
Help: "The number of NTP requests sent to the server",
|
|
},
|
|
[]string{"url"},
|
|
)
|
|
metricNtpServerLastRTT = promauto.NewGaugeVec(
|
|
prometheus.GaugeOpts{
|
|
Name: "jetkvm_timesync_ntp_server_last_rtt",
|
|
Help: "The last RTT of the NTP server in milliseconds",
|
|
},
|
|
[]string{"url"},
|
|
)
|
|
metricNtpServerRttHistogram = promauto.NewHistogramVec(
|
|
prometheus.HistogramOpts{
|
|
Name: "jetkvm_timesync_ntp_server_rtt",
|
|
Help: "The histogram of the RTT of the NTP server in milliseconds",
|
|
Buckets: []float64{
|
|
10, 25, 50, 100, 200, 300, 500, 1000,
|
|
},
|
|
},
|
|
[]string{"url"},
|
|
)
|
|
metricNtpServerInfo = promauto.NewGaugeVec(
|
|
prometheus.GaugeOpts{
|
|
Name: "jetkvm_timesync_ntp_server_info",
|
|
Help: "The info of the NTP server",
|
|
},
|
|
[]string{"url", "reference", "stratum", "precision"},
|
|
)
|
|
|
|
metricHttpTotalSuccessCount = promauto.NewCounter(
|
|
prometheus.CounterOpts{
|
|
Name: "jetkvm_timesync_http_total_success_count",
|
|
Help: "The total number of successful HTTP requests",
|
|
},
|
|
)
|
|
metricHttpTotalRequestCount = promauto.NewCounter(
|
|
prometheus.CounterOpts{
|
|
Name: "jetkvm_timesync_http_total_request_count",
|
|
Help: "The total number of HTTP requests sent",
|
|
},
|
|
)
|
|
metricHttpTotalCancelCount = promauto.NewCounter(
|
|
prometheus.CounterOpts{
|
|
Name: "jetkvm_timesync_http_total_cancel_count",
|
|
Help: "The total number of HTTP requests cancelled",
|
|
},
|
|
)
|
|
metricHttpSuccessCount = promauto.NewCounterVec(
|
|
prometheus.CounterOpts{
|
|
Name: "jetkvm_timesync_http_success_count",
|
|
Help: "The number of successful HTTP requests",
|
|
},
|
|
[]string{"url"},
|
|
)
|
|
metricHttpRequestCount = promauto.NewCounterVec(
|
|
prometheus.CounterOpts{
|
|
Name: "jetkvm_timesync_http_request_count",
|
|
Help: "The number of HTTP requests sent to the server",
|
|
},
|
|
[]string{"url"},
|
|
)
|
|
metricHttpCancelCount = promauto.NewCounterVec(
|
|
prometheus.CounterOpts{
|
|
Name: "jetkvm_timesync_http_cancel_count",
|
|
Help: "The number of HTTP requests cancelled",
|
|
},
|
|
[]string{"url"},
|
|
)
|
|
metricHttpServerLastRTT = promauto.NewGaugeVec(
|
|
prometheus.GaugeOpts{
|
|
Name: "jetkvm_timesync_http_server_last_rtt",
|
|
Help: "The last RTT of the HTTP server in milliseconds",
|
|
},
|
|
[]string{"url"},
|
|
)
|
|
metricHttpServerRttHistogram = promauto.NewHistogramVec(
|
|
prometheus.HistogramOpts{
|
|
Name: "jetkvm_timesync_http_server_rtt",
|
|
Help: "The histogram of the RTT of the HTTP server in milliseconds",
|
|
Buckets: []float64{
|
|
10, 25, 50, 100, 200, 300, 500, 1000,
|
|
},
|
|
},
|
|
[]string{"url"},
|
|
)
|
|
metricHttpServerInfo = promauto.NewGaugeVec(
|
|
prometheus.GaugeOpts{
|
|
Name: "jetkvm_timesync_http_server_info",
|
|
Help: "The info of the HTTP server",
|
|
},
|
|
[]string{"url", "http_code"},
|
|
)
|
|
)
|