feat(agent) multi-driver db monitoring, hot-plug config, release pipeline
This commit is contained in:
30
internal/collectors/sqlite/sqlite.go
Normal file
30
internal/collectors/sqlite/sqlite.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package sqlite
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"bugs.watch/agent/internal/aggregate"
|
||||
)
|
||||
|
||||
// Collector reports the on-disk size of a SQLite database file.
|
||||
// No driver or connection is needed; we simply stat the file.
|
||||
// Failures are silently skipped.
|
||||
type Collector struct {
|
||||
path string
|
||||
}
|
||||
|
||||
func New(path string) *Collector {
|
||||
return &Collector{path: path}
|
||||
}
|
||||
|
||||
func (c *Collector) Name() string { return "sqlite" }
|
||||
|
||||
func (c *Collector) Close() {}
|
||||
|
||||
func (c *Collector) Collect(window *aggregate.Window) {
|
||||
info, err := os.Stat(c.path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
window.SetDBSizeBytes(uint64(info.Size()))
|
||||
}
|
||||
Reference in New Issue
Block a user