31 lines
593 B
Go
31 lines
593 B
Go
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()))
|
|
}
|