2021-08-19 13:51:43 +00:00
|
|
|
//go:build nometrics
|
2020-06-19 15:08:51 +00:00
|
|
|
// +build nometrics
|
|
|
|
|
2021-07-11 13:26:51 +00:00
|
|
|
package metric
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
import (
|
2021-03-01 18:28:11 +00:00
|
|
|
"github.com/go-chi/chi/v5"
|
2020-06-19 15:08:51 +00:00
|
|
|
|
2022-07-24 14:18:54 +00:00
|
|
|
"github.com/drakkan/sftpgo/v2/internal/version"
|
2020-06-19 15:08:51 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
version.AddFeature("-metrics")
|
|
|
|
}
|
|
|
|
|
2023-02-09 08:33:33 +00:00
|
|
|
// AddMetricsEndpoint publishes metrics to the specified endpoint
|
2022-07-19 21:28:33 +00:00
|
|
|
func AddMetricsEndpoint(_ string, _ chi.Router) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
// TransferCompleted updates metrics after an upload or a download
|
2022-07-19 21:28:33 +00:00
|
|
|
func TransferCompleted(_, _ int64, _ int, _ error, _ bool) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
// S3TransferCompleted updates metrics after an S3 upload or a download
|
2022-07-19 21:28:33 +00:00
|
|
|
func S3TransferCompleted(_ int64, _ int, _ error) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
// S3ListObjectsCompleted updates metrics after an S3 list objects request terminates
|
2022-07-19 21:28:33 +00:00
|
|
|
func S3ListObjectsCompleted(_ error) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
// S3CopyObjectCompleted updates metrics after an S3 copy object request terminates
|
2022-07-19 21:28:33 +00:00
|
|
|
func S3CopyObjectCompleted(_ error) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
// S3DeleteObjectCompleted updates metrics after an S3 delete object request terminates
|
2022-07-19 21:28:33 +00:00
|
|
|
func S3DeleteObjectCompleted(_ error) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
// S3HeadBucketCompleted updates metrics after an S3 head bucket request terminates
|
2022-07-19 21:28:33 +00:00
|
|
|
func S3HeadBucketCompleted(_ error) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
// GCSTransferCompleted updates metrics after a GCS upload or a download
|
2022-07-19 21:28:33 +00:00
|
|
|
func GCSTransferCompleted(_ int64, _ int, _ error) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
// GCSListObjectsCompleted updates metrics after a GCS list objects request terminates
|
2022-07-19 21:28:33 +00:00
|
|
|
func GCSListObjectsCompleted(_ error) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
// GCSCopyObjectCompleted updates metrics after a GCS copy object request terminates
|
2022-07-19 21:28:33 +00:00
|
|
|
func GCSCopyObjectCompleted(_ error) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
// GCSDeleteObjectCompleted updates metrics after a GCS delete object request terminates
|
2022-07-19 21:28:33 +00:00
|
|
|
func GCSDeleteObjectCompleted(_ error) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
// GCSHeadBucketCompleted updates metrics after a GCS head bucket request terminates
|
2022-07-19 21:28:33 +00:00
|
|
|
func GCSHeadBucketCompleted(_ error) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
2022-07-17 18:16:00 +00:00
|
|
|
// HTTPFsTransferCompleted updates metrics after an HTTPFs upload or a download
|
2022-07-19 21:28:33 +00:00
|
|
|
func HTTPFsTransferCompleted(_ int64, _ int, _ error) {}
|
2022-07-17 18:16:00 +00:00
|
|
|
|
2020-06-19 15:08:51 +00:00
|
|
|
// SSHCommandCompleted update metrics after an SSH command terminates
|
2022-07-19 21:28:33 +00:00
|
|
|
func SSHCommandCompleted(_ error) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
// UpdateDataProviderAvailability updates the metric for the data provider availability
|
2022-07-19 21:28:33 +00:00
|
|
|
func UpdateDataProviderAvailability(_ error) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
// AddLoginAttempt increments the metrics for login attempts
|
2022-07-19 21:28:33 +00:00
|
|
|
func AddLoginAttempt(_ string) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
// AddLoginResult increments the metrics for login results
|
2022-07-19 21:28:33 +00:00
|
|
|
func AddLoginResult(_ string, _ error) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
2023-05-12 16:34:59 +00:00
|
|
|
// AddNoAuthTried increments the metric for clients disconnected
|
2020-07-29 19:56:56 +00:00
|
|
|
// for inactivity before trying to login
|
2023-05-12 16:34:59 +00:00
|
|
|
func AddNoAuthTried() {}
|
2020-07-29 19:56:56 +00:00
|
|
|
|
2020-06-19 15:08:51 +00:00
|
|
|
// HTTPRequestServed increments the metrics for HTTP requests
|
2022-07-19 21:28:33 +00:00
|
|
|
func HTTPRequestServed(_ int) {}
|
2020-06-19 15:08:51 +00:00
|
|
|
|
|
|
|
// UpdateActiveConnectionsSize sets the metric for active connections
|
2022-07-19 21:28:33 +00:00
|
|
|
func UpdateActiveConnectionsSize(_ int) {}
|