Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions src/query-performance-monitoring/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,24 +82,3 @@ const (
*/
MinVersionParts = 2
)

/*
DefaultExcludedDatabases defines a list of database names that are excluded by default.
These databases are typically system databases in MySQL that are used for internal purposes
and typically do not require user interactions or modifications.

- "mysql": This database contains the system user accounts and privileges information.
- "information_schema": This database provides access to database metadata,
i.e., data about data. It is read-only and is used for querying about database objects.
- "performance_schema": This database provides performance-related data and metrics
about server execution and resource usage. It is mainly used for monitoring purposes.
- "sys": This database provides simplified views and functions for easier system
administration and performance tuning.
- "": The empty string is included because some queries may not be associated with
any specific database. Including "" ensures that these undetermined or global queries
are not incorrectly related to a specific user database.

Excluding these databases by default helps to prevent accidental modifications
and focuses system operations only on user-defined databases.
*/
var DefaultExcludedDatabases = []string{"", "mysql", "information_schema", "performance_schema", "sys"}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ import (

// PopulateBlockingSessionMetrics retrieves blocking session metrics from the database and populates them into the integration entity.
func PopulateBlockingSessionMetrics(db utils.DataSource, i *integration.Integration, args arguments.ArgumentList, excludedDatabases []string) {
// Get the blocking sessions query SQL
blockingSessionsQuerySQL := utils.GetBlockingSessionsSQL(excludedDatabases)

// Get the query count threshold
queryCountThreshold := validator.GetValidQueryCountThreshold(args.QueryMonitoringCountThreshold)

// Prepare the SQL query with the provided parameters
query, inputArgs, err := sqlx.In(utils.BlockingSessionsQuery, excludedDatabases, queryCountThreshold)
// Prepare arguments for the query
var inputArgs []interface{}
inputArgs = append(inputArgs, queryCountThreshold)

// Use sqlx.In to handle excludedDatabases dynamically
query, inputArgs, err := sqlx.In(blockingSessionsQuerySQL, inputArgs...)
if err != nil {
log.Error("Failed to prepare blocking sessions query: %v", err)
return
Expand Down
Loading