metric_disabled.go 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // Copyright (C) 2019 Nicola Murino
  2. //
  3. // This program is free software: you can redistribute it and/or modify
  4. // it under the terms of the GNU Affero General Public License as published
  5. // by the Free Software Foundation, version 3.
  6. //
  7. // This program is distributed in the hope that it will be useful,
  8. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. // GNU Affero General Public License for more details.
  11. //
  12. // You should have received a copy of the GNU Affero General Public License
  13. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. //go:build nometrics
  15. package metric
  16. import (
  17. "github.com/go-chi/chi/v5"
  18. "github.com/drakkan/sftpgo/v2/internal/version"
  19. )
  20. func init() {
  21. version.AddFeature("-metrics")
  22. }
  23. // AddMetricsEndpoint publishes metrics to the specified endpoint
  24. func AddMetricsEndpoint(_ string, _ chi.Router) {}
  25. // TransferCompleted updates metrics after an upload or a download
  26. func TransferCompleted(_, _ int64, _ int, _ error, _ bool) {}
  27. // S3TransferCompleted updates metrics after an S3 upload or a download
  28. func S3TransferCompleted(_ int64, _ int, _ error) {}
  29. // S3ListObjectsCompleted updates metrics after an S3 list objects request terminates
  30. func S3ListObjectsCompleted(_ error) {}
  31. // S3CopyObjectCompleted updates metrics after an S3 copy object request terminates
  32. func S3CopyObjectCompleted(_ error) {}
  33. // S3DeleteObjectCompleted updates metrics after an S3 delete object request terminates
  34. func S3DeleteObjectCompleted(_ error) {}
  35. // S3HeadBucketCompleted updates metrics after an S3 head bucket request terminates
  36. func S3HeadBucketCompleted(_ error) {}
  37. // GCSTransferCompleted updates metrics after a GCS upload or a download
  38. func GCSTransferCompleted(_ int64, _ int, _ error) {}
  39. // GCSListObjectsCompleted updates metrics after a GCS list objects request terminates
  40. func GCSListObjectsCompleted(_ error) {}
  41. // GCSCopyObjectCompleted updates metrics after a GCS copy object request terminates
  42. func GCSCopyObjectCompleted(_ error) {}
  43. // GCSDeleteObjectCompleted updates metrics after a GCS delete object request terminates
  44. func GCSDeleteObjectCompleted(_ error) {}
  45. // GCSHeadBucketCompleted updates metrics after a GCS head bucket request terminates
  46. func GCSHeadBucketCompleted(_ error) {}
  47. // HTTPFsTransferCompleted updates metrics after an HTTPFs upload or a download
  48. func HTTPFsTransferCompleted(_ int64, _ int, _ error) {}
  49. // SSHCommandCompleted update metrics after an SSH command terminates
  50. func SSHCommandCompleted(_ error) {}
  51. // UpdateDataProviderAvailability updates the metric for the data provider availability
  52. func UpdateDataProviderAvailability(_ error) {}
  53. // AddLoginAttempt increments the metrics for login attempts
  54. func AddLoginAttempt(_ string) {}
  55. // AddLoginResult increments the metrics for login results
  56. func AddLoginResult(_ string, _ error) {}
  57. // AddNoAuthTried increments the metric for clients disconnected
  58. // for inactivity before trying to login
  59. func AddNoAuthTried() {}
  60. // HTTPRequestServed increments the metrics for HTTP requests
  61. func HTTPRequestServed(_ int) {}
  62. // UpdateActiveConnectionsSize sets the metric for active connections
  63. func UpdateActiveConnectionsSize(_ int) {}