From e0701b24cdf8cc04963af2845f0663df604f3390 Mon Sep 17 00:00:00 2001 From: Tyler Coleman Date: Wed, 6 Dec 2023 23:26:06 -0800 Subject: [PATCH 1/6] Expose build version in `/debug/vars` Signed-off-by: Tyler Coleman --- go/vt/servenv/buildinfo.go | 4 +++- web/vtadmin/src/util/tabletDebugVars.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/go/vt/servenv/buildinfo.go b/go/vt/servenv/buildinfo.go index 15e34217dae..cddabda720c 100644 --- a/go/vt/servenv/buildinfo.go +++ b/go/vt/servenv/buildinfo.go @@ -121,6 +121,7 @@ func init() { stats.NewString("BuildHost").Set(AppVersion.buildHost) stats.NewString("BuildUser").Set(AppVersion.buildUser) stats.NewGauge("BuildTimestamp", "build timestamp").Set(AppVersion.buildTime) + stats.NewString("BuildVersion").Set(AppVersion.version) stats.NewString("BuildGitRev").Set(AppVersion.buildGitRev) stats.NewString("BuildGitBranch").Set(AppVersion.buildGitBranch) stats.NewGauge("BuildNumber", "build number").Set(AppVersion.jenkinsBuildNumber) @@ -128,11 +129,12 @@ func init() { stats.NewString("GoOS").Set(AppVersion.goOS) stats.NewString("GoArch").Set(AppVersion.goArch) - buildLabels := []string{"BuildHost", "BuildUser", "BuildTimestamp", "BuildGitRev", "BuildGitBranch", "BuildNumber"} + buildLabels := []string{"BuildHost", "BuildUser", "BuildTimestamp", "BuildVersion", "BuildGitRev", "BuildGitBranch", "BuildNumber"} buildValues := []string{ AppVersion.buildHost, AppVersion.buildUser, fmt.Sprintf("%v", AppVersion.buildTime), + AppVersion.version, AppVersion.buildGitRev, AppVersion.buildGitBranch, fmt.Sprintf("%v", AppVersion.jenkinsBuildNumber), diff --git a/web/vtadmin/src/util/tabletDebugVars.ts b/web/vtadmin/src/util/tabletDebugVars.ts index 37ea08e49b1..1d01ec16bee 100644 --- a/web/vtadmin/src/util/tabletDebugVars.ts +++ b/web/vtadmin/src/util/tabletDebugVars.ts @@ -33,6 +33,7 @@ export type TabletDebugVars = Partial<{ BuildNumber: string; BuildTimestamp: string; BuildUser: string; + BuildVersion: string; QPS: { [k: string]: number[] }; From a85bb425050d205d78cb9e0d3e7cf5fb4c201ad1 Mon Sep 17 00:00:00 2001 From: Tyler Coleman Date: Thu, 7 Dec 2023 16:49:29 -0800 Subject: [PATCH 2/6] Export `buildValues`; add unit test; fix typos * Export `buildValues` for use in the unit test * Add a unit test to assert that the version name appears in `buildValues` * Fix spelling and spacing in other files Signed-off-by: Tyler Coleman --- go/vt/servenv/buildinfo.go | 3 ++- go/vt/servenv/buildinfo_test.go | 4 ++++ go/vt/vtgate/vtgate.go | 2 +- test/README.md | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/go/vt/servenv/buildinfo.go b/go/vt/servenv/buildinfo.go index cddabda720c..8f88f8f48c2 100644 --- a/go/vt/servenv/buildinfo.go +++ b/go/vt/servenv/buildinfo.go @@ -34,6 +34,7 @@ var ( buildGitRev = "" buildGitBranch = "" jenkinsBuildNumberStr = "" + buildValues []string // version registers the command line flag to expose build info. version bool @@ -130,7 +131,7 @@ func init() { stats.NewString("GoArch").Set(AppVersion.goArch) buildLabels := []string{"BuildHost", "BuildUser", "BuildTimestamp", "BuildVersion", "BuildGitRev", "BuildGitBranch", "BuildNumber"} - buildValues := []string{ + buildValues = []string{ AppVersion.buildHost, AppVersion.buildUser, fmt.Sprintf("%v", AppVersion.buildTime), diff --git a/go/vt/servenv/buildinfo_test.go b/go/vt/servenv/buildinfo_test.go index be35511a036..2ef40465fc1 100644 --- a/go/vt/servenv/buildinfo_test.go +++ b/go/vt/servenv/buildinfo_test.go @@ -47,3 +47,7 @@ func TestVersionString(t *testing.T) { assert.Equal(t, "8.0.30-Vitess", v.MySQLVersion()) } + +func TestBuildVersionInBuildValues(t *testing.T) { + assert.Contains(t, buildValues, versionName) +} diff --git a/go/vt/vtgate/vtgate.go b/go/vt/vtgate/vtgate.go index a5ace194c2f..64260e628f0 100644 --- a/go/vt/vtgate/vtgate.go +++ b/go/vt/vtgate/vtgate.go @@ -190,7 +190,7 @@ var ( vstreamSkewDelayCount = stats.NewCounter("VStreamEventsDelayedBySkewAlignment", "Number of events that had to wait because the skew across shards was too high") - vindexUnknownParams = stats.NewGauge("VindexUnknownParameters", "Number of parameterss unrecognized by Vindexes") + vindexUnknownParams = stats.NewGauge("VindexUnknownParameters", "Number of parameters unrecognized by Vindexes") timings = stats.NewMultiTimings( "VtgateApi", diff --git a/test/README.md b/test/README.md index 5fd5fadbedb..6579245ef45 100644 --- a/test/README.md +++ b/test/README.md @@ -1,4 +1,4 @@ -##Github CI Workflows +## Github CI Workflows This document has a short outline of how tests are run in CI, how to add new tests and where these are configured. From 661967e1f4bb29c70669ecc80c07c2da5856d7f4 Mon Sep 17 00:00:00 2001 From: Tyler Coleman Date: Fri, 8 Dec 2023 12:26:14 -0800 Subject: [PATCH 3/6] Remove version from `buildValues`; update test Signed-off-by: Tyler Coleman --- go/vt/servenv/buildinfo.go | 10 +++++----- go/vt/servenv/buildinfo_test.go | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/go/vt/servenv/buildinfo.go b/go/vt/servenv/buildinfo.go index 8f88f8f48c2..8bd7dc4b479 100644 --- a/go/vt/servenv/buildinfo.go +++ b/go/vt/servenv/buildinfo.go @@ -33,8 +33,8 @@ var ( buildTime = "" buildGitRev = "" buildGitBranch = "" + buildVersion *stats.String jenkinsBuildNumberStr = "" - buildValues []string // version registers the command line flag to expose build info. version bool @@ -122,7 +122,8 @@ func init() { stats.NewString("BuildHost").Set(AppVersion.buildHost) stats.NewString("BuildUser").Set(AppVersion.buildUser) stats.NewGauge("BuildTimestamp", "build timestamp").Set(AppVersion.buildTime) - stats.NewString("BuildVersion").Set(AppVersion.version) + buildVersion = stats.NewString("BuildVersion") + buildVersion.Set(AppVersion.version) stats.NewString("BuildGitRev").Set(AppVersion.buildGitRev) stats.NewString("BuildGitBranch").Set(AppVersion.buildGitBranch) stats.NewGauge("BuildNumber", "build number").Set(AppVersion.jenkinsBuildNumber) @@ -130,12 +131,11 @@ func init() { stats.NewString("GoOS").Set(AppVersion.goOS) stats.NewString("GoArch").Set(AppVersion.goArch) - buildLabels := []string{"BuildHost", "BuildUser", "BuildTimestamp", "BuildVersion", "BuildGitRev", "BuildGitBranch", "BuildNumber"} - buildValues = []string{ + buildLabels := []string{"BuildHost", "BuildUser", "BuildTimestamp", "BuildGitRev", "BuildGitBranch", "BuildNumber"} + buildValues := []string{ AppVersion.buildHost, AppVersion.buildUser, fmt.Sprintf("%v", AppVersion.buildTime), - AppVersion.version, AppVersion.buildGitRev, AppVersion.buildGitBranch, fmt.Sprintf("%v", AppVersion.jenkinsBuildNumber), diff --git a/go/vt/servenv/buildinfo_test.go b/go/vt/servenv/buildinfo_test.go index 2ef40465fc1..b05eae95421 100644 --- a/go/vt/servenv/buildinfo_test.go +++ b/go/vt/servenv/buildinfo_test.go @@ -48,6 +48,7 @@ func TestVersionString(t *testing.T) { assert.Equal(t, "8.0.30-Vitess", v.MySQLVersion()) } -func TestBuildVersionInBuildValues(t *testing.T) { - assert.Contains(t, buildValues, versionName) +func TestBuildVersionStats(t *testing.T) { + buildVersion := buildVersion.Get() + assert.Equal(t, buildVersion, versionName) } From cbceb850f8947ade7a84047ec56a8ac7e5375bf0 Mon Sep 17 00:00:00 2001 From: Tyler Coleman Date: Fri, 8 Dec 2023 12:57:20 -0800 Subject: [PATCH 4/6] =?UTF-8?q?Rename=20`buildVersion`=20=E2=86=92=20`stat?= =?UTF-8?q?sBuildVersion`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tyler Coleman --- go/vt/servenv/buildinfo.go | 6 +++--- go/vt/servenv/buildinfo_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go/vt/servenv/buildinfo.go b/go/vt/servenv/buildinfo.go index 8bd7dc4b479..d55e01d84c0 100644 --- a/go/vt/servenv/buildinfo.go +++ b/go/vt/servenv/buildinfo.go @@ -33,7 +33,7 @@ var ( buildTime = "" buildGitRev = "" buildGitBranch = "" - buildVersion *stats.String + statsBuildVersion *stats.String jenkinsBuildNumberStr = "" // version registers the command line flag to expose build info. @@ -122,8 +122,8 @@ func init() { stats.NewString("BuildHost").Set(AppVersion.buildHost) stats.NewString("BuildUser").Set(AppVersion.buildUser) stats.NewGauge("BuildTimestamp", "build timestamp").Set(AppVersion.buildTime) - buildVersion = stats.NewString("BuildVersion") - buildVersion.Set(AppVersion.version) + statsBuildVersion = stats.NewString("BuildVersion") + statsBuildVersion.Set(AppVersion.version) stats.NewString("BuildGitRev").Set(AppVersion.buildGitRev) stats.NewString("BuildGitBranch").Set(AppVersion.buildGitBranch) stats.NewGauge("BuildNumber", "build number").Set(AppVersion.jenkinsBuildNumber) diff --git a/go/vt/servenv/buildinfo_test.go b/go/vt/servenv/buildinfo_test.go index b05eae95421..bc972df03ea 100644 --- a/go/vt/servenv/buildinfo_test.go +++ b/go/vt/servenv/buildinfo_test.go @@ -49,6 +49,6 @@ func TestVersionString(t *testing.T) { } func TestBuildVersionStats(t *testing.T) { - buildVersion := buildVersion.Get() + buildVersion := statsBuildVersion.Get() assert.Equal(t, buildVersion, versionName) } From db365fcc2f223428f2d90da111516d022cf106b0 Mon Sep 17 00:00:00 2001 From: Tyler Coleman Date: Fri, 8 Dec 2023 14:20:12 -0800 Subject: [PATCH 5/6] Add change to `19.0.0` changelog Signed-off-by: Tyler Coleman --- changelog/19.0/19.0.0/summary.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/changelog/19.0/19.0.0/summary.md b/changelog/19.0/19.0.0/summary.md index a303dff02cc..75cfd995c83 100644 --- a/changelog/19.0/19.0.0/summary.md +++ b/changelog/19.0/19.0.0/summary.md @@ -10,6 +10,7 @@ - [New MySQL Image](#mysql-image) - **[New Stats](#new-stats)** - [Stream Consolidations](#stream-consolidations) + - [Build Version in `/debug/vars`](#build-version-in-debug-vars) - **[VTGate](#vtgate)** - [`FOREIGN_KEY_CHECKS` is now a Vitess Aware Variable](#fk-checks-vitess-aware) - **[Vttestserver](#vttestserver)** @@ -53,6 +54,10 @@ Several tags are available to let you choose what version of MySQL you want to u Prior to 19.0 VTTablet reported how much time non-streaming executions spend waiting for consolidations to occur. In 19.0, VTTablet reports a similar stat for streaming executions in `/debug/vars` stat `Waits.Histograms.StreamConsolidations`. +#### Build Version in `/debug/vars` + +The build version (e.g., `19.0.0-SNAPSHOT`) has been added to `/debug/vars`, allowing users to programatically inspect Vitess components' build version at runtime. + ### VTGate #### `FOREIGN_KEY_CHECKS` is now a Vitess Aware Variable From d064586081377d6179c83dbc441014a0f343188a Mon Sep 17 00:00:00 2001 From: Tyler Coleman Date: Fri, 8 Dec 2023 14:23:55 -0800 Subject: [PATCH 6/6] Fix spelling Signed-off-by: Tyler Coleman --- changelog/19.0/19.0.0/summary.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/19.0/19.0.0/summary.md b/changelog/19.0/19.0.0/summary.md index 75cfd995c83..eafea7b163e 100644 --- a/changelog/19.0/19.0.0/summary.md +++ b/changelog/19.0/19.0.0/summary.md @@ -56,7 +56,7 @@ Prior to 19.0 VTTablet reported how much time non-streaming executions spend wai #### Build Version in `/debug/vars` -The build version (e.g., `19.0.0-SNAPSHOT`) has been added to `/debug/vars`, allowing users to programatically inspect Vitess components' build version at runtime. +The build version (e.g., `19.0.0-SNAPSHOT`) has been added to `/debug/vars`, allowing users to programmatically inspect Vitess components' build version at runtime. ### VTGate