Documentation
¶
Index ¶
- func HTTPErrorHandlerWrapper(recorder ErrorRecorder, handler echo.HTTPErrorHandler) echo.HTTPErrorHandler
- func NewLoggerWriterMonitor(config LoggerWriterMonitorConfig) *debugmonitor.Monitor
- func NewLogsMonitor(config LogsMonitorConfig) (*debugmonitor.Monitor, echo.Logger)
- func NewQueriesMonitor(config QueriesMonitorConfig) (*debugmonitor.Monitor, *sql.DB)
- func NewRequestsMonitor(config *RequestsMonitorConfig) (*debugmonitor.Monitor, echo.MiddlewareFunc)
- func NewWriterMonitor(config WriterMonitorConfig) (*debugmonitor.Monitor, io.Writer)
- type ErrorPayload
- type ErrorRecorder
- type ErrorsMonitorConfig
- type LogPayload
- type LoggerWrapper
- func (l *LoggerWrapper) Debug(i ...interface{})
- func (l *LoggerWrapper) Debugf(format string, args ...interface{})
- func (l *LoggerWrapper) Debugj(j log.JSON)
- func (l *LoggerWrapper) Error(i ...interface{})
- func (l *LoggerWrapper) Errorf(format string, args ...interface{})
- func (l *LoggerWrapper) Errorj(j log.JSON)
- func (l *LoggerWrapper) Fatal(i ...interface{})
- func (l *LoggerWrapper) Fatalf(format string, args ...interface{})
- func (l *LoggerWrapper) Fatalj(j log.JSON)
- func (l *LoggerWrapper) Info(i ...interface{})
- func (l *LoggerWrapper) Infof(format string, args ...interface{})
- func (l *LoggerWrapper) Infoj(j log.JSON)
- func (l *LoggerWrapper) Level() log.Lvl
- func (l *LoggerWrapper) Output() io.Writer
- func (l *LoggerWrapper) Panic(i ...interface{})
- func (l *LoggerWrapper) Panicf(format string, args ...interface{})
- func (l *LoggerWrapper) Panicj(j log.JSON)
- func (l *LoggerWrapper) Prefix() string
- func (l *LoggerWrapper) Print(i ...interface{})
- func (l *LoggerWrapper) Printf(format string, args ...interface{})
- func (l *LoggerWrapper) Printj(j log.JSON)
- func (l *LoggerWrapper) SetHeader(h string)
- func (l *LoggerWrapper) SetLevel(v log.Lvl)
- func (l *LoggerWrapper) SetOutput(w io.Writer)
- func (l *LoggerWrapper) SetPrefix(p string)
- func (l *LoggerWrapper) Warn(i ...interface{})
- func (l *LoggerWrapper) Warnf(format string, args ...interface{})
- func (l *LoggerWrapper) Warnj(j log.JSON)
- type LoggerWriterMonitorConfig
- type LogsMonitorConfig
- type QueriesMonitorConfig
- type QueryPayload
- type RequestPayload
- type RequestsMonitorConfig
- type TeeWriter
- type WriterMonitorConfig
- type WriterPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPErrorHandlerWrapper ¶
func HTTPErrorHandlerWrapper(recorder ErrorRecorder, handler echo.HTTPErrorHandler) echo.HTTPErrorHandler
HTTPErrorHandlerWrapper returns an echo.HTTPErrorHandler that records errors and then delegates to the provided handler
func NewLoggerWriterMonitor ¶
func NewLoggerWriterMonitor(config LoggerWriterMonitorConfig) *debugmonitor.Monitor
NewLoggerWriterMonitor creates a logger writer monitor with the given configuration.
func NewLogsMonitor ¶
func NewLogsMonitor(config LogsMonitorConfig) (*debugmonitor.Monitor, echo.Logger)
NewLogsMonitor creates a new monitor for logging and returns the monitor along with a wrapped logger
func NewQueriesMonitor ¶
func NewQueriesMonitor(config QueriesMonitorConfig) (*debugmonitor.Monitor, *sql.DB)
NewQueriesMonitor creates a new monitor for database queries and returns a wrapped *sql.DB. This function wraps an existing database driver with monitoring capabilities without requiring changes to existing *sql.DB usage code.
func NewRequestsMonitor ¶
func NewRequestsMonitor(config *RequestsMonitorConfig) (*debugmonitor.Monitor, echo.MiddlewareFunc)
NewRequestsMonitor creates a new monitor for HTTP requests and returns the monitor along with an Echo middleware function that captures request information
func NewWriterMonitor ¶
func NewWriterMonitor(config WriterMonitorConfig) (*debugmonitor.Monitor, io.Writer)
NewWriterMonitor creates a new writer monitor with the given configuration. It returns the monitor and a new io.Writer that writes to both the original writer and the monitor's store.
Types ¶
type ErrorPayload ¶
type ErrorPayload struct {
Error string `json:"error"`
Type string `json:"type"`
Message string `json:"message"`
StackTrace string `json:"stackTrace"`
Timestamp time.Time `json:"timestamp"`
}
ErrorPayload represents the data structure for error monitoring
type ErrorRecorder ¶
type ErrorRecorder func(err error)
ErrorRecorder is a function type for recording errors
func NewErrorsMonitor ¶
func NewErrorsMonitor(config ErrorsMonitorConfig) (*debugmonitor.Monitor, ErrorRecorder)
NewErrorsMonitor creates a new monitor for errors and returns the monitor along with an error recording function
type ErrorsMonitorConfig ¶ added in v0.0.2
type ErrorsMonitorConfig struct {
// UsePolling enables polling mode instead of SSE for real-time updates.
UsePolling bool
}
ErrorsMonitorConfig defines the config for Errors monitor.
type LogPayload ¶
type LogPayload struct {
Level string `json:"level"`
Message string `json:"message"`
Timestamp time.Time `json:"timestamp"`
}
LogPayload represents the data structure for log monitoring
type LoggerWrapper ¶
type LoggerWrapper struct {
// contains filtered or unexported fields
}
LoggerWrapper wraps an echo.Logger and intercepts all logging calls
func (*LoggerWrapper) Debug ¶
func (l *LoggerWrapper) Debug(i ...interface{})
Debug logs a message at debug level
func (*LoggerWrapper) Debugf ¶
func (l *LoggerWrapper) Debugf(format string, args ...interface{})
Debugf logs a formatted message at debug level
func (*LoggerWrapper) Debugj ¶
func (l *LoggerWrapper) Debugj(j log.JSON)
Debugj logs a JSON message at debug level
func (*LoggerWrapper) Error ¶
func (l *LoggerWrapper) Error(i ...interface{})
Error logs a message at error level
func (*LoggerWrapper) Errorf ¶
func (l *LoggerWrapper) Errorf(format string, args ...interface{})
Errorf logs a formatted message at error level
func (*LoggerWrapper) Errorj ¶
func (l *LoggerWrapper) Errorj(j log.JSON)
Errorj logs a JSON message at error level
func (*LoggerWrapper) Fatal ¶
func (l *LoggerWrapper) Fatal(i ...interface{})
Fatal logs a message at fatal level
func (*LoggerWrapper) Fatalf ¶
func (l *LoggerWrapper) Fatalf(format string, args ...interface{})
Fatalf logs a formatted message at fatal level
func (*LoggerWrapper) Fatalj ¶
func (l *LoggerWrapper) Fatalj(j log.JSON)
Fatalj logs a JSON message at fatal level
func (*LoggerWrapper) Info ¶
func (l *LoggerWrapper) Info(i ...interface{})
Info logs a message at info level
func (*LoggerWrapper) Infof ¶
func (l *LoggerWrapper) Infof(format string, args ...interface{})
Infof logs a formatted message at info level
func (*LoggerWrapper) Infoj ¶
func (l *LoggerWrapper) Infoj(j log.JSON)
Infoj logs a JSON message at info level
func (*LoggerWrapper) Output ¶
func (l *LoggerWrapper) Output() io.Writer
Output returns the output writer
func (*LoggerWrapper) Panic ¶
func (l *LoggerWrapper) Panic(i ...interface{})
Panic logs a message at panic level
func (*LoggerWrapper) Panicf ¶
func (l *LoggerWrapper) Panicf(format string, args ...interface{})
Panicf logs a formatted message at panic level
func (*LoggerWrapper) Panicj ¶
func (l *LoggerWrapper) Panicj(j log.JSON)
Panicj logs a JSON message at panic level
func (*LoggerWrapper) Print ¶
func (l *LoggerWrapper) Print(i ...interface{})
Print logs a message at print level
func (*LoggerWrapper) Printf ¶
func (l *LoggerWrapper) Printf(format string, args ...interface{})
Printf logs a formatted message at print level
func (*LoggerWrapper) Printj ¶
func (l *LoggerWrapper) Printj(j log.JSON)
Printj logs a JSON message at print level
func (*LoggerWrapper) SetHeader ¶
func (l *LoggerWrapper) SetHeader(h string)
SetHeader sets the log header
func (*LoggerWrapper) SetLevel ¶
func (l *LoggerWrapper) SetLevel(v log.Lvl)
SetLevel sets the log level
func (*LoggerWrapper) SetOutput ¶
func (l *LoggerWrapper) SetOutput(w io.Writer)
SetOutput sets the output writer
func (*LoggerWrapper) SetPrefix ¶
func (l *LoggerWrapper) SetPrefix(p string)
SetPrefix sets the prefix
func (*LoggerWrapper) Warn ¶
func (l *LoggerWrapper) Warn(i ...interface{})
Warn logs a message at warn level
func (*LoggerWrapper) Warnf ¶
func (l *LoggerWrapper) Warnf(format string, args ...interface{})
Warnf logs a formatted message at warn level
func (*LoggerWrapper) Warnj ¶
func (l *LoggerWrapper) Warnj(j log.JSON)
Warnj logs a JSON message at warn level
type LoggerWriterMonitorConfig ¶ added in v0.0.2
type LoggerWriterMonitorConfig struct {
// Logger is the echo.Logger to wrap with monitoring.
Logger echo.Logger
// UsePolling enables polling mode instead of SSE for real-time updates.
UsePolling bool
}
LoggerWriterMonitorConfig is the configuration for the logger writer monitor.
type LogsMonitorConfig ¶ added in v0.0.2
type LogsMonitorConfig struct {
// Logger is the original echo.Logger to wrap with monitoring.
Logger echo.Logger
// UsePolling enables polling mode instead of SSE for real-time updates.
UsePolling bool
}
LogsMonitorConfig defines the config for Logs monitor.
type QueriesMonitorConfig ¶ added in v0.0.2
type QueriesMonitorConfig struct {
// DSN is the data source name for the database connection.
DSN string
// Driver is the database driver to wrap with monitoring.
Driver driver.Driver
// UsePolling enables polling mode instead of SSE for real-time updates.
UsePolling bool
}
QueriesMonitorConfig defines the config for Queries monitor.
type QueryPayload ¶
type QueryPayload struct {
Query string `json:"query"`
Args []interface{} `json:"args,omitempty"`
Duration int64 `json:"duration"` // in milliseconds
Error string `json:"error,omitempty"`
Timestamp time.Time `json:"timestamp"`
Operation string `json:"operation"` // Query, Exec, Prepare, Begin, Commit, Rollback
}
QueryPayload represents the data structure for database query monitoring
type RequestPayload ¶
type RequestPayload struct {
Method string `json:"method"`
URI string `json:"uri"`
Status int `json:"status"`
Latency int64 `json:"latency"` // in milliseconds
RemoteAddr string `json:"remoteAddr"`
UserAgent string `json:"userAgent"`
Error string `json:"error,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
RequestPayload represents the data structure for HTTP request monitoring
type RequestsMonitorConfig ¶
type RequestsMonitorConfig struct {
// Skipper defines a function to skip middleware.
// Optional. Default: DefaultSkipper
Skipper middleware.Skipper
// UsePolling enables polling mode instead of SSE for real-time updates.
UsePolling bool
}
RequestsMonitorConfig defines the config for Requests monitor.
type WriterMonitorConfig ¶ added in v0.0.2
type WriterMonitorConfig struct {
// Writer is the original io.Writer to write to.
Writer io.Writer
// UsePolling enables polling mode instead of SSE for real-time updates.
UsePolling bool
}
WriterMonitorConfig is the configuration for the writer monitor.
type WriterPayload ¶
type WriterPayload struct {
Data string `json:"data"`
}