diff --git a/engine/cmd/database-lab/main.go b/engine/cmd/database-lab/main.go index d4a63f2afac3a08b688e33d4538d9525ee780133..e3cb27a5ea2efe8a3f9db7e4edb74aa8ae5fe51a 100644 --- a/engine/cmd/database-lab/main.go +++ b/engine/cmd/database-lab/main.go @@ -13,11 +13,13 @@ import ( "fmt" "os" "os/signal" + "runtime" "strings" "syscall" "time" "github.com/docker/docker/client" + "github.com/pbnjay/memory" "github.com/pkg/errors" "gitlab.com/postgres-ai/database-lab/v3/internal/cloning" @@ -159,9 +161,14 @@ func main() { tm.SendEvent(ctx, telemetry.EngineStartedEvent, telemetry.EngineStarted{ EngineVersion: version.GetVersion(), + DBEngine: cfg.Global.Engine, DBVersion: provisioner.DetectDBVersion(), Pools: pm.CollectPoolStat(), Restore: retrievalSvc.ReportState(), + System: telemetry.System{ + CPU: runtime.NumCPU(), + TotalMemory: memory.TotalMemory(), + }, }) embeddedUI := embeddedui.New(cfg.EmbeddedUI, engProps, runner, docker) diff --git a/engine/go.mod b/engine/go.mod index de3c2b64a40b43fd13506e00572f252b7e5805ee..cada63aa6dab7eacf2ff0116dbbe14d4fe2c69f6 100644 --- a/engine/go.mod +++ b/engine/go.mod @@ -65,6 +65,7 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.2 // indirect github.com/opencontainers/runc v1.1.0 // indirect + github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/russross/blackfriday/v2 v2.0.1 // indirect github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect diff --git a/engine/go.sum b/engine/go.sum index 861cc0ab529bbebdbe475830b58725d7ce25bfc2..3a570cb9f632a01e3897db83a7f5b73d2e3b3c9c 100644 --- a/engine/go.sum +++ b/engine/go.sum @@ -580,6 +580,8 @@ github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xA github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= diff --git a/engine/internal/telemetry/events.go b/engine/internal/telemetry/events.go index f85823aa38574762eb9e5d5948c7c6c81a8a009f..2f341d5774eed7835c402344c72880e9a9f695f5 100644 --- a/engine/internal/telemetry/events.go +++ b/engine/internal/telemetry/events.go @@ -12,9 +12,11 @@ import ( // EngineStarted describes the engine start event. type EngineStarted struct { EngineVersion string `json:"engine_version"` + DBEngine string `json:"db_engine"` DBVersion string `json:"db_version"` Pools PoolStat `json:"pools"` Restore Restore `json:"restore"` + System System `json:"system"` } // PoolStat describes the pool stat data. @@ -32,6 +34,12 @@ type Restore struct { Jobs []string `json:"jobs"` } +// System describes system stats of the machine where the DLE instance runs. +type System struct { + CPU int `json:"cpu"` + TotalMemory uint64 `json:"total_memory"` +} + // EngineStopped describes the engine stop event. type EngineStopped struct { Uptime float64 `json:"uptime"`