Skip to content

Commit

Permalink
server: use constant for filtering internal stmt stats
Browse files Browse the repository at this point in the history
Previously, the internal app name prefix was hard-coded
into the query used to fetch combined stmt/txn stats.
This commit replaces that usage with the pre-existing
internal app prefix defined in constants.

Release note: None
  • Loading branch information
xinhaoz committed Feb 4, 2022
1 parent 8a76b59 commit 3447e1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/server/combined_statement_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func getFilterAndParams(
buffer.WriteString(testingKnobs.GetAOSTClause())

// Filter out internal statements by app name.
buffer.WriteString(" WHERE app_name NOT LIKE '$ internal%'")
buffer.WriteString(fmt.Sprintf(" WHERE app_name NOT LIKE '%s%%'", catconstants.InternalAppNamePrefix))

if start != nil {
buffer.WriteString(" AND aggregated_ts >= $1")
Expand Down
5 changes: 2 additions & 3 deletions pkg/server/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1989,9 +1989,8 @@ func TestStatusAPICombinedStatements(t *testing.T) {
continue
}
if strings.HasPrefix(respStatement.Key.KeyData.App, catconstants.InternalAppNamePrefix) {
// We ignore internal queries, these are not relevant for the
// validity of this test.
continue
// CombinedStatementStats should filter out internal queries.
t.Fatalf("unexpected internal query: %s", respStatement.Key.KeyData.Query)
}
if strings.HasPrefix(respStatement.Key.KeyData.Query, "ALTER USER") {
// Ignore the ALTER USER ... VIEWACTIVITY statement.
Expand Down

0 comments on commit 3447e1e

Please sign in to comment.