Skip to content

Commit

Permalink
queries -> queryExecutions metric name
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Gangal <[email protected]>
  • Loading branch information
harshit-gangal committed Feb 28, 2025
1 parent 72c561a commit dca525e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions changelog/22.0/22.0.0/summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ $ vtctldclient ApplySchema --ddl-strategy="pt-osc" ...

#### New Metrics Added:
Three new metrics have been introduced for queries:
1. `QueryProcessed` – Counts the number of queries executed. **Dimensions:** Query type, Plan type, Tablet type.
1. `QueryExecutions` – Counts the number of queries executed. **Dimensions:** Query type, Plan type, Tablet type.
2. `QueryRouted` – Counts the number of vttablets the query was executed on. **Dimensions:** Query type, Plan type, Tablet type.
3. `QueryTables` – Tracks queries processed at VTGate, with counts recorded per table. **Dimensions:** Query type, Table.
3. `QueryTables` – Tracks queries executed at VTGate, with counts recorded per table. **Dimensions:** Query type, Table.

Example:
```
Expand All @@ -72,7 +72,7 @@ Shards: 2
Sharding Key: id for both tables
Metrics Published:
1. QueryProcessed – {select, scatter, primary}, 1
1. QueryExecutions – {select, scatter, primary}, 1
2. QueryRouted – {select, scatter, primary}, 2
3. QueryTables – {select, t1}, 1 and {select, t2}, 1
```
Expand Down
6 changes: 3 additions & 3 deletions go/test/endtoend/vtgate/misc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -989,16 +989,16 @@ func TestQueryProcessedMetric(t *testing.T) {
tableMetrics: []string{"SELECT.ks_t1", "SELECT.ks_t2", "SELECT.ks_t3", "SELECT.ks_t4"},
}}

initialQP := getQPMetric(t, "Queries")
initialQP := getQPMetric(t, "QueryExecutions")
initialQR := getQPMetric(t, "QueryRoutes")
initialQT := getQPMetric(t, "QueryTables")
for _, tc := range tcases {
t.Run(tc.sql, func(t *testing.T) {
utils.Exec(t, conn, tc.sql)
updatedQP := getQPMetric(t, "Queries")
updatedQP := getQPMetric(t, "QueryExecutions")
updatedQR := getQPMetric(t, "QueryRoutes")
updatedQT := getQPMetric(t, "QueryTables")
assert.EqualValuesf(t, 1, getValue(updatedQP, tc.queryMetric)-getValue(initialQP, tc.queryMetric), "queries metric: %s", tc.queryMetric)
assert.EqualValuesf(t, 1, getValue(updatedQP, tc.queryMetric)-getValue(initialQP, tc.queryMetric), "queryExecutions metric: %s", tc.queryMetric)
assert.EqualValuesf(t, tc.shards, getValue(updatedQR, tc.queryMetric)-getValue(initialQR, tc.queryMetric), "queryRoutes metric: %s", tc.queryMetric)
for _, metric := range tc.tableMetrics {
assert.EqualValuesf(t, 1, getValue(updatedQT, metric)-getValue(initialQT, metric), "queryTables metric: %s", metric)
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtgate/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ var (
queriesProcessedByTable = stats.NewCountersWithMultiLabels("QueriesProcessedByTable", "Deprecated: Queries processed at vtgate by plan type, keyspace and table", []string{"Plan", "Keyspace", "Table"})
queriesRoutedByTable = stats.NewCountersWithMultiLabels("QueriesRoutedByTable", "Deprecated: Queries routed from vtgate to vttablet by plan type, keyspace and table", []string{"Plan", "Keyspace", "Table"})

queries = stats.NewCountersWithMultiLabels("Queries", "Counts queries processed at VTGate by query type, plan type, and tablet type.", []string{"Query", "Plan", "Tablet"})
queries = stats.NewCountersWithMultiLabels("QueryExecutions", "Counts queries executed at at VTGate by query type, plan type, and tablet type.", []string{"Query", "Plan", "Tablet"})
queryRoutes = stats.NewCountersWithMultiLabels("QueryRoutes", "Counts queries routed from VTGate to VTTablet by query type, plan type, and tablet type.", []string{"Query", "Plan", "Tablet"})
queriesByTable = stats.NewCountersWithMultiLabels("QueryTables", "Counts queries processed at VTGate per table by query type and table.", []string{"Query", "Table"})
queriesByTable = stats.NewCountersWithMultiLabels("QueryTables", "Counts queries executed at VTGate per table by query type and table.", []string{"Query", "Table"})

// commitMode records the timing of the commit phase of a transaction.
// It also tracks between different transaction mode i.e. Single, Multi and TwoPC
Expand Down

0 comments on commit dca525e

Please sign in to comment.