wood chen 68c27b544b feat(metrics): enhance metrics functionality and configuration
- Added new dependency on github.com/mattn/go-sqlite3 for improved metrics storage.
- Updated main.go to initialize metrics collector with a new database path and configuration settings.
- Enhanced config.json to include additional metrics settings such as alert configurations and latency thresholds.
- Refactored internal metrics handling to support new metrics structures and improve data retrieval.
- Introduced a new metrics history endpoint for retrieving historical data, enhancing monitoring capabilities.
- Improved UI for metrics dashboard to include historical data visualization options.
2024-12-03 17:48:11 +08:00

24 lines
339 B
Go

package errors
type ErrorCode int
const (
ErrDatabase ErrorCode = iota + 1
ErrInvalidConfig
ErrRateLimit
ErrMetricsCollection
)
type MetricsError struct {
Code ErrorCode
Message string
Err error
}
func (e *MetricsError) Error() string {
if e.Err != nil {
return e.Message + ": " + e.Err.Error()
}
return e.Message
}