monitors

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

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(logger echo.Logger) *debugmonitor.Monitor

func NewLogsMonitor

func NewLogsMonitor(logger echo.Logger) (*debugmonitor.Monitor, echo.Logger)

NewLogsMonitor creates a new monitor for logging and returns the monitor along with a wrapped logger

func NewQueriesMonitor

func NewQueriesMonitor(dsn string, drv driver.Driver) (*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(w io.Writer) (*debugmonitor.Monitor, io.Writer)

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() (*debugmonitor.Monitor, ErrorRecorder)

NewErrorsMonitor creates a new monitor for errors and returns the monitor along with an error recording function

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) Level

func (l *LoggerWrapper) Level() log.Lvl

Level returns the log 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) Prefix

func (l *LoggerWrapper) Prefix() string

Prefix returns the prefix

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 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
}

RequestsMonitorConfig defines the config for Requests monitor.

type TeeWriter

type TeeWriter struct {
	// contains filtered or unexported fields
}

func (*TeeWriter) Write

func (t *TeeWriter) Write(p []byte) (n int, err error)

type WriterPayload

type WriterPayload struct {
	Data string `json:"data"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL