mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 22:30:56 +03:00
add Prometheus support
some basic counters and gauges are now exposed
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/drakkan/sftpgo/metrics"
|
||||
"github.com/go-chi/chi/middleware"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
@@ -54,6 +55,7 @@ func (l *StructuredLogger) NewLogEntry(r *http.Request) middleware.LogEntry {
|
||||
|
||||
// Write logs a new entry at the end of the HTTP request
|
||||
func (l *StructuredLoggerEntry) Write(status, bytes int, elapsed time.Duration) {
|
||||
metrics.HTTPRequestServed(status)
|
||||
l.Logger.Info().Fields(l.fields).Int(
|
||||
"resp_status", status).Int(
|
||||
"resp_size", bytes).Int64(
|
||||
|
||||
Reference in New Issue
Block a user