chore(model): add metric for total number of conflicts (#10037)

This commit is contained in:
Sébastien WENSKE
2025-04-04 09:24:04 -07:00
committed by GitHub
parent 6bc2784e9a
commit 3e7ccf7c48
2 changed files with 9 additions and 0 deletions
+1
View File
@@ -1854,6 +1854,7 @@ func (f *sendReceiveFolder) moveForConflict(name, lastModBy string, scanChan cha
return nil
}
metricFolderConflictsTotal.WithLabelValues(f.ID).Inc()
newName := conflictName(name, lastModBy)
err := f.mtimefs.Rename(name, newName)
if fs.IsNotExist(err) {
+8
View File
@@ -57,6 +57,13 @@ var (
Name: "folder_processed_bytes_total",
Help: "Total amount of data processed during folder syncing, per folder ID and data source (network/local_origin/local_other/local_shifted/skipped)",
}, []string{"folder", "source"})
metricFolderConflictsTotal = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "syncthing",
Subsystem: "model",
Name: "folder_conflicts_total",
Help: "Total number of conflicts",
}, []string{"folder"})
)
const (
@@ -90,4 +97,5 @@ func registerFolderMetrics(folderID string) {
metricFolderProcessedBytesTotal.WithLabelValues(folderID, metricSourceLocalOther)
metricFolderProcessedBytesTotal.WithLabelValues(folderID, metricSourceLocalShifted)
metricFolderProcessedBytesTotal.WithLabelValues(folderID, metricSourceSkipped)
metricFolderConflictsTotal.WithLabelValues(folderID)
}