all: Minor deprecation updates

This commit is contained in:
Jakob Borg 2022-07-28 17:54:12 +02:00
parent 5958f42294
commit 79f8bd0f33
2 changed files with 6 additions and 3 deletions

View File

@ -10,6 +10,7 @@ import (
"os" "os"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
) )
var ( var (
@ -109,7 +110,7 @@ func init() {
databaseKeys, databaseStatisticsSeconds, databaseKeys, databaseStatisticsSeconds,
databaseOperations, databaseOperationSeconds) databaseOperations, databaseOperationSeconds)
processCollectorOpts := prometheus.ProcessCollectorOpts{ processCollectorOpts := collectors.ProcessCollectorOpts{
Namespace: "syncthing_discovery", Namespace: "syncthing_discovery",
PidFn: func() (int, error) { PidFn: func() (int, error) {
return os.Getpid(), nil return os.Getpid(), nil
@ -117,7 +118,7 @@ func init() {
} }
prometheus.MustRegister( prometheus.MustRegister(
prometheus.NewProcessCollector(processCollectorOpts), collectors.NewProcessCollector(processCollectorOpts),
) )
} }

View File

@ -26,6 +26,8 @@ import (
"unicode" "unicode"
"github.com/oschwald/geoip2-golang" "github.com/oschwald/geoip2-golang"
"golang.org/x/text/cases"
"golang.org/x/text/language"
"github.com/syncthing/syncthing/lib/upgrade" "github.com/syncthing/syncthing/lib/upgrade"
"github.com/syncthing/syncthing/lib/ur/contract" "github.com/syncthing/syncthing/lib/ur/contract"
@ -773,7 +775,7 @@ func getReport(db *sql.DB) map[string]interface{} {
} }
for transport, count := range rep.TransportStats { for transport, count := range rep.TransportStats {
add(featureGroups["Connection"]["v3"], "Transport", strings.Title(transport), count) add(featureGroups["Connection"]["v3"], "Transport", cases.Title(language.English).String(transport), count)
if strings.HasSuffix(transport, "4") { if strings.HasSuffix(transport, "4") {
add(featureGroups["Connection"]["v3"], "IP version", "IPv4", count) add(featureGroups["Connection"]["v3"], "IP version", "IPv4", count)
} else if strings.HasSuffix(transport, "6") { } else if strings.HasSuffix(transport, "6") {