Documentation ¶
Overview ¶
Package db creates DB tables, call resource manager interfaces and populates the DB with compute units
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // For estimating average values, we do weighted average method using following // values as weight for each DB column // For CPU and GPU, we use CPU time and GPU time as weights // For memory usage, we use Walltime * Mem for CPU as weight and just walltime // for GPU Weights = map[string]string{ "avg_cpu_usage": "alloc_cputime", "avg_gpu_usage": "alloc_gputime", "avg_cpu_mem_usage": "alloc_cpumemtime", "avg_gpu_mem_usage": "alloc_gpumemtime", } // Admin users sources AdminUsersSources = []string{"ceems", "grafana"} )
View Source
var MigrationsFS embed.FS
View Source
var StatementsFS embed.FS
Functions ¶
func NewStatsDB ¶
NewStatsDB returns a new instance of statsDB struct
Types ¶
type AdminConfig ¶
type AdminConfig struct { Users []string `yaml:"users"` Grafana common.GrafanaWebConfig `yaml:"grafana"` }
AdminConfig is the container for the admin users related config
type Config ¶
type Config struct { Logger log.Logger Data DataConfig Admin AdminConfig ResourceManager func(log.Logger) (*resource.Manager, error) Updater func(log.Logger) (*updater.UnitUpdater, error) }
Config makes a DB config from config file
type DataConfig ¶
type DataConfig struct { Path string `yaml:"path"` BackupPath string `yaml:"backup_path"` RetentionPeriod model.Duration `yaml:"retention_period"` UpdateInterval model.Duration `yaml:"update_interval"` BackupInterval model.Duration `yaml:"backup_interval"` LastUpdateTime time.Time `yaml:"update_from"` SkipDeleteOldUnits bool }
DataConfig is the container for the data related config
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator implements DB migrations
func NewMigrator ¶
NewMigrator returns new instance of Migrator
Directories ¶
Path | Synopsis |
---|---|
Package sqlite3 implements a connect hook around the sqlite3 driver so that the underlying connection can be fetched from the driver for more advanced operations such as backups.
|
Package sqlite3 implements a connect hook around the sqlite3 driver so that the underlying connection can be fetched from the driver for more advanced operations such as backups. |
Click to show internal directories.
Click to hide internal directories.