add Prometheus support

some basic counters and gauges are now exposed
This commit is contained in:
Nicola Murino
2019-09-13 18:45:36 +02:00
parent fd59f35108
commit 7eb5b01169
17 changed files with 377 additions and 20 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/drakkan/sftpgo/dataprovider"
"github.com/drakkan/sftpgo/logger"
"github.com/drakkan/sftpgo/metrics"
)
const (
@@ -105,6 +106,7 @@ func (t *Transfer) Close() error {
executeAction(operationUpload, t.user.Username, t.path, "")
}
}
metrics.TransferCompleted(t.bytesSent, t.bytesReceived, t.transferType, t.transferError)
removeTransfer(t)
if t.transferType == transferUpload && (numFiles != 0 || t.bytesReceived > 0) {
dataprovider.UpdateUserQuota(dataProvider, t.user, numFiles, t.bytesReceived, false)