fixup! Support for prometheus /metrics endpoint
All checks were successful
CI / build (push) Successful in 4m14s

This commit is contained in:
Fijxu 2024-11-06 00:53:01 -03:00
parent 21036c3e30
commit 7d40f898a6
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4

22
main.go
View file

@ -196,28 +196,28 @@ type Metrics struct {
var metrics = Metrics{ var metrics = Metrics{
Uptime: prometheus.NewGauge(prometheus.GaugeOpts{ Uptime: prometheus.NewGauge(prometheus.GaugeOpts{
Name: "uptime", Name: "http3_ytproxy_uptime",
}), }),
RequestCount: prometheus.NewGauge(prometheus.GaugeOpts{ RequestCount: prometheus.NewGauge(prometheus.GaugeOpts{
Name: "request_count", Name: "http3_ytproxy_request_count",
}), }),
RequestPerSecond: prometheus.NewGauge(prometheus.GaugeOpts{ RequestPerSecond: prometheus.NewGauge(prometheus.GaugeOpts{
Name: "request_per_second", Name: "http3_ytproxy_request_per_second",
}), }),
RequestPerMinute: prometheus.NewGauge(prometheus.GaugeOpts{ RequestPerMinute: prometheus.NewGauge(prometheus.GaugeOpts{
Name: "request_per_minute", Name: "http3_ytproxy_request_per_minute",
}), }),
TotalConnEstablished: prometheus.NewGauge(prometheus.GaugeOpts{ TotalConnEstablished: prometheus.NewGauge(prometheus.GaugeOpts{
Name: "total_conn_established", Name: "http3_ytproxy_total_conn_established",
}), }),
EstablishedConnections: prometheus.NewGauge(prometheus.GaugeOpts{ EstablishedConnections: prometheus.NewGauge(prometheus.GaugeOpts{
Name: "established_conns", Name: "http3_ytproxy_established_conns",
}), }),
ActiveConnections: prometheus.NewGauge(prometheus.GaugeOpts{ ActiveConnections: prometheus.NewGauge(prometheus.GaugeOpts{
Name: "active_conns", Name: "http3_ytproxy_active_conns",
}), }),
IdleConnections: prometheus.NewGauge(prometheus.GaugeOpts{ IdleConnections: prometheus.NewGauge(prometheus.GaugeOpts{
Name: "idle_conns", Name: "http3_ytproxy_idle_conns",
}), }),
RequestForbidden: struct { RequestForbidden: struct {
@ -226,13 +226,13 @@ var metrics = Metrics{
Ggpht prometheus.Counter Ggpht prometheus.Counter
}{ }{
Videoplayback: prometheus.NewCounter(prometheus.CounterOpts{ Videoplayback: prometheus.NewCounter(prometheus.CounterOpts{
Name: "request_forbidden_videoplayback", Name: "http3_ytproxy_request_forbidden_videoplayback",
}), }),
Vi: prometheus.NewCounter(prometheus.CounterOpts{ Vi: prometheus.NewCounter(prometheus.CounterOpts{
Name: "request_forbidden_vi", Name: "http3_ytproxy_request_forbidden_vi",
}), }),
Ggpht: prometheus.NewCounter(prometheus.CounterOpts{ Ggpht: prometheus.NewCounter(prometheus.CounterOpts{
Name: "request_forbidden_ggpht", Name: "http3_ytproxy_request_forbidden_ggpht",
}), }),
}, },
} }