Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Event timestamp in unix seconds. ColumnTimestamp = "timestamp" // event name // e.g., "memory_oom", "memory_oom_kill_constraint", "memory_oom_cgroup", "memory_edac_correctable_errors". ColumnName = "name" // event type // e.g., "Unknown", "Info", "Warning", "Critical", "Fatal". ColumnType = "type" // event message // e.g., "VFS file-max limit reached" ColumnMessage = "message" // event extra info // e.g., // data source: "dmesg", "nvml", "nvidia-smi". // event target: "gpu_id", "gpu_uuid". // log detail: "oom_reaper: reaped process 345646 (vector), now anon-rss:0kB, file-rss:0kB, shmem-rss:0". ColumnExtraInfo = "extra_info" // event suggested actions // e.g., "reboot" ColumnSuggestedActions = "suggested_actions" )
View Source
const DefaultRetention = 3 * 24 * time.Hour // 3 days
Variables ¶
View Source
var ( ErrNoDBRWSet = errors.New("no writable db set") ErrNoDBROSet = errors.New("no read-only db set") )
Functions ¶
func CreateDefaultTableName ¶
Creates the default table name for the component. The table name is in the format of "components_{component_name}_events_v0_4_0". Suffix with the version, in case we change the table schema.
Types ¶
type Store ¶
type Store interface { Insert(ctx context.Context, ev components.Event) error Find(ctx context.Context, ev components.Event) (*components.Event, error) // Returns the event in the descending order of timestamp (latest event first). Get(ctx context.Context, since time.Time) ([]components.Event, error) // Returns the latest event. // Returns nil if no event found. Latest(ctx context.Context) (*components.Event, error) Purge(ctx context.Context, beforeTimestamp int64) (int, error) Close() }
func NewStore ¶
Creates a new DB instance with the table created. Requires write-only and read-only instances for minimize conflicting writes/reads. ref. https://github.com/mattn/go-sqlite3/issues/1179#issuecomment-1638083995
Click to show internal directories.
Click to hide internal directories.