From 48a60d82946ecf7f5f33c4d0dcbc8dba08ab084a Mon Sep 17 00:00:00 2001 From: Tyler Date: Mon, 11 Dec 2023 09:52:03 -0800 Subject: [PATCH] Debug vars: Expose build version in `/debug/vars` (#14713) Signed-off-by: Tyler Coleman --- changelog/19.0/19.0.0/summary.md | 5 +++++ go/vt/servenv/buildinfo.go | 3 +++ go/vt/servenv/buildinfo_test.go | 5 +++++ go/vt/vtgate/vtgate.go | 2 +- test/README.md | 2 +- web/vtadmin/src/util/tabletDebugVars.ts | 1 + 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/changelog/19.0/19.0.0/summary.md b/changelog/19.0/19.0.0/summary.md index a303dff02cc..eafea7b163e 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 programmatically inspect Vitess components' build version at runtime. + ### VTGate #### `FOREIGN_KEY_CHECKS` is now a Vitess Aware Variable diff --git a/go/vt/servenv/buildinfo.go b/go/vt/servenv/buildinfo.go index 15e34217dae..d55e01d84c0 100644 --- a/go/vt/servenv/buildinfo.go +++ b/go/vt/servenv/buildinfo.go @@ -33,6 +33,7 @@ var ( buildTime = "" buildGitRev = "" buildGitBranch = "" + statsBuildVersion *stats.String jenkinsBuildNumberStr = "" // version registers the command line flag to expose build info. @@ -121,6 +122,8 @@ func init() { stats.NewString("BuildHost").Set(AppVersion.buildHost) stats.NewString("BuildUser").Set(AppVersion.buildUser) stats.NewGauge("BuildTimestamp", "build timestamp").Set(AppVersion.buildTime) + 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 be35511a036..bc972df03ea 100644 --- a/go/vt/servenv/buildinfo_test.go +++ b/go/vt/servenv/buildinfo_test.go @@ -47,3 +47,8 @@ func TestVersionString(t *testing.T) { assert.Equal(t, "8.0.30-Vitess", v.MySQLVersion()) } + +func TestBuildVersionStats(t *testing.T) { + buildVersion := statsBuildVersion.Get() + assert.Equal(t, buildVersion, 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. 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[] };