Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
357a58d
feat: Introducing query performance monitoring for slow queries, bloc…
spathlavath Jan 8, 2025
30e3b9f
refactor: Enhanced query execution plan for supporting With, Insert, …
spathlavath Jan 9, 2025
e5cda53
refactor: handle nil or empty query text/ID to resolve compile issues
spathlavath Jan 10, 2025
f3f1973
reafctor: Updated wait events query to analyze wait events and execu…
spathlavath Jan 12, 2025
fb94bf2
Instrumented with Go APM Agent
spathlavath Jan 13, 2025
e29d31d
Added license key to args
spathlavath Jan 13, 2025
fec2443
Added license key to args
spathlavath Jan 13, 2025
3af35b1
Added license key to args
spathlavath Jan 13, 2025
b8bb8e0
Added nrmysql driver
spathlavath Jan 13, 2025
cd222b0
updated app name
spathlavath Jan 13, 2025
7cc61b1
updated app name
spathlavath Jan 13, 2025
371c0ab
instrumentation changes
spathlavath Jan 13, 2025
de1a5b1
instrumentation changes for all files
spathlavath Jan 13, 2025
6cfc048
instrumentation changes for all files
spathlavath Jan 13, 2025
8ae26c4
instrumentation fixes
spathlavath Jan 13, 2025
d7f1926
instrumentation fixes
spathlavath Jan 13, 2025
6ec4dd3
instrumentation fixes
spathlavath Jan 13, 2025
908caba
instrumentation fixes
spathlavath Jan 13, 2025
bdb7151
debugging
spathlavath Jan 13, 2025
b9de9f1
debug
spathlavath Jan 13, 2025
8957f39
debug-1
spathlavath Jan 13, 2025
f875b8e
removed go-sql-driver
spathlavath Jan 14, 2025
e0add7d
refactored nrmysql changes in database.go
spathlavath Jan 14, 2025
fc6f981
refactored nrmysql changes in mysql.go
spathlavath Jan 14, 2025
9361cc7
debug logger
spathlavath Jan 14, 2025
634a264
nymysql changes in database.go
spathlavath Jan 14, 2025
3a226f9
nymysql changes in performance_main.go
spathlavath Jan 14, 2025
b117223
nymysql changes in performance_main.go
spathlavath Jan 14, 2025
1873094
nymysql changes in performance_main.go
spathlavath Jan 14, 2025
ed55c3e
nymysql changes in performance_main.go
spathlavath Jan 14, 2025
469cb4d
Added datastore segment
spathlavath Jan 14, 2025
a24f86f
datastore fixes
spathlavath Jan 14, 2025
f237a18
Merge branch 'master' into epic_performance_monitoring
spathlavath Jan 15, 2025
c022d71
Merge branch 'epic_performance_monitoring' into apm_integration
spathlavath Jan 15, 2025
5841f87
Merge branch 'epic_performance_monitoring' into apm_integration
spathlavath Jan 15, 2025
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
9 changes: 8 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/newrelic/go-agent/v3 v3.35.1 // indirect
github.com/newrelic/go-agent/v3/integrations/nrmysql v1.2.2
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
16 changes: 16 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/newrelic/go-agent/v3 v3.35.1 h1:N43qBNDILmnwLDCSfnE1yy6adyoVEU95nAOtdUgG4vA=
github.com/newrelic/go-agent/v3 v3.35.1/go.mod h1:GNTda53CohAhkgsc7/gqSsJhDZjj8vaky5u+vKz7wqM=
github.com/newrelic/go-agent/v3/integrations/nrmysql v1.2.2 h1:JtaJdL4y1hj5mH0JA2XIIIZtOsivsCmG0wsp3cGtoNo=
github.com/newrelic/go-agent/v3/integrations/nrmysql v1.2.2/go.mod h1:0JZ1gqlaBi9FUrQsg9LLZR357oDH4fGYYTbQQPhOd8o=
github.com/newrelic/infra-integrations-sdk/v3 v3.9.1 h1:dCtVLsYNHWTQ5aAlAaHroomOUlqxlGTrdi6XTlvBDfI=
github.com/newrelic/infra-integrations-sdk/v3 v3.9.1/go.mod h1:yPeidhcq9Cla0QDquGXH0KqvS2k9xtetFOD7aLA0Z8M=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
Expand All @@ -37,8 +41,20 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
1 change: 1 addition & 0 deletions src/args/argument_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ type ArgumentList struct {
QueryResponseTimeThreshold int `default:"500" help:"Threshold in milliseconds for query response time to fetch individual query performance metrics."`
QueryCountThreshold int `default:"20" help:"Query count limit for fetching grouped slow and individual query performance metrics."`
ExcludedDatabases string `default:"[]" help:"A JSON array that list databases that will be excluded from collection. system databases are excluded by default."`
LicenseKey string `default:"" help:"New Relic license key."`
}
7 changes: 7 additions & 0 deletions src/query-performance-monitoring/mysql-apm/mysql_apm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package mysqlapm

import "github.com/newrelic/go-agent/v3/newrelic"

var ArgsGlobal = ""
var NewrelicApp = newrelic.Application{}
var Txn *newrelic.Transaction = nil
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package performancemetricscollectors

import (
"github.com/jmoiron/sqlx"
"github.com/newrelic/go-agent/v3/newrelic"
"github.com/newrelic/infra-integrations-sdk/v3/integration"
"github.com/newrelic/infra-integrations-sdk/v3/log"
arguments "github.com/newrelic/nri-mysql/src/args"
Expand All @@ -10,15 +11,15 @@ import (
)

// PopulateBlockingSessionMetrics retrieves blocking session metrics from the database and populates them into the integration entity.
func PopulateBlockingSessionMetrics(db utils.DataSource, i *integration.Integration, e *integration.Entity, args arguments.ArgumentList, excludedDatabases []string) {
func PopulateBlockingSessionMetrics(app *newrelic.Application, db utils.DataSource, i *integration.Integration, e *integration.Entity, args arguments.ArgumentList, excludedDatabases []string) {
// Prepare the SQL query with the provided parameters
query, inputArgs, err := sqlx.In(utils.BlockingSessionsQuery, excludedDatabases, min(args.QueryCountThreshold, constants.MaxQueryCountThreshold))
if err != nil {
log.Error("Failed to prepare blocking sessions query: %v", err)
}

// Collect the blocking session metrics
metrics, err := utils.CollectMetrics[utils.BlockingSessionMetrics](db, query, inputArgs...)
metrics, err := utils.CollectMetrics[utils.BlockingSessionMetrics](app, db, query, inputArgs...)
if err != nil {
log.Error("Error collecting blocking session metrics: %v", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

"github.com/jmoiron/sqlx"
"github.com/newrelic/go-agent/v3/newrelic"
"github.com/newrelic/infra-integrations-sdk/v3/integration"
"github.com/newrelic/infra-integrations-sdk/v3/log"
arguments "github.com/newrelic/nri-mysql/src/args"
Expand All @@ -12,8 +13,8 @@ import (
)

// PopulateSlowQueryMetrics collects and sets slow query metrics and returns the list of query IDs
func PopulateSlowQueryMetrics(i *integration.Integration, e *integration.Entity, db utils.DataSource, args arguments.ArgumentList, excludedDatabases []string) []string {
rawMetrics, queryIDList, err := collectGroupedSlowQueryMetrics(db, args.SlowQueryFetchInterval, args.QueryCountThreshold, excludedDatabases)
func PopulateSlowQueryMetrics(app *newrelic.Application, i *integration.Integration, e *integration.Entity, db utils.DataSource, args arguments.ArgumentList, excludedDatabases []string) []string {
rawMetrics, queryIDList, err := collectGroupedSlowQueryMetrics(app, db, args.SlowQueryFetchInterval, args.QueryCountThreshold, excludedDatabases)
if err != nil {
log.Error("Failed to collect slow query metrics: %v", err)
return []string{}
Expand All @@ -34,7 +35,7 @@ func PopulateSlowQueryMetrics(i *integration.Integration, e *integration.Entity,
}

// collectGroupedSlowQueryMetrics collects metrics from the performance schema database for slow queries
func collectGroupedSlowQueryMetrics(db utils.DataSource, slowQueryfetchInterval int, queryCountThreshold int, excludedDatabases []string) ([]utils.SlowQueryMetrics, []string, error) {
func collectGroupedSlowQueryMetrics(app *newrelic.Application, db utils.DataSource, slowQueryfetchInterval int, queryCountThreshold int, excludedDatabases []string) ([]utils.SlowQueryMetrics, []string, error) {
// Prepare the SQL query with the provided parameters
query, args, err := sqlx.In(utils.SlowQueries, slowQueryfetchInterval, excludedDatabases, min(queryCountThreshold, constants.MaxQueryCountThreshold))
if err != nil {
Expand All @@ -43,7 +44,7 @@ func collectGroupedSlowQueryMetrics(db utils.DataSource, slowQueryfetchInterval

ctx, cancel := context.WithTimeout(context.Background(), constants.TimeoutDuration)
defer cancel()
rows, err := db.QueryxContext(ctx, query, args...)
rows, err := db.QueryxContext(app, ctx, query, args...)
if err != nil {
return nil, []string{}, err
}
Expand Down Expand Up @@ -88,20 +89,20 @@ func setSlowQueryMetrics(i *integration.Integration, metrics []utils.SlowQueryMe
}

// PopulateIndividualQueryDetails collects and sets individual query details
func PopulateIndividualQueryDetails(db utils.DataSource, queryIDList []string, i *integration.Integration, e *integration.Entity, args arguments.ArgumentList) []utils.QueryGroup {
currentQueryMetrics, currentQueryMetricsErr := currentQueryMetrics(db, queryIDList, args)
func PopulateIndividualQueryDetails(app *newrelic.Application, db utils.DataSource, queryIDList []string, i *integration.Integration, e *integration.Entity, args arguments.ArgumentList) []utils.QueryGroup {
currentQueryMetrics, currentQueryMetricsErr := currentQueryMetrics(app, db, queryIDList, args)
if currentQueryMetricsErr != nil {
log.Error("Failed to collect current query metrics: %v", currentQueryMetricsErr)
return nil
}

recentQueryList, recentQueryErr := recentQueryMetrics(db, queryIDList, args)
recentQueryList, recentQueryErr := recentQueryMetrics(app, db, queryIDList, args)
if recentQueryErr != nil {
log.Error("Failed to collect recent query metrics: %v", recentQueryErr)
return nil
}

extensiveQueryList, extensiveQueryErr := extensiveQueryMetrics(db, queryIDList, args)
extensiveQueryList, extensiveQueryErr := extensiveQueryMetrics(app, db, queryIDList, args)
if extensiveQueryErr != nil {
log.Error("Failed to collect history query metrics: %v", extensiveQueryErr)
return nil
Expand Down Expand Up @@ -152,8 +153,8 @@ func groupQueriesByDatabase(filteredList []utils.IndividualQueryMetrics) []utils
}

// currentQueryMetrics collects current query metrics from the performance schema database for the given query IDs
func currentQueryMetrics(db utils.DataSource, queryIDList []string, args arguments.ArgumentList) ([]utils.IndividualQueryMetrics, error) {
metrics, err := collectIndividualQueryMetrics(db, queryIDList, utils.CurrentRunningQueriesSearch, args)
func currentQueryMetrics(app *newrelic.Application, db utils.DataSource, queryIDList []string, args arguments.ArgumentList) ([]utils.IndividualQueryMetrics, error) {
metrics, err := collectIndividualQueryMetrics(app, db, queryIDList, utils.CurrentRunningQueriesSearch, args)
if err != nil {
return nil, err
}
Expand All @@ -162,8 +163,8 @@ func currentQueryMetrics(db utils.DataSource, queryIDList []string, args argumen
}

// recentQueryMetrics collects recent query metrics from the performance schema database for the given query IDs
func recentQueryMetrics(db utils.DataSource, queryIDList []string, args arguments.ArgumentList) ([]utils.IndividualQueryMetrics, error) {
metrics, err := collectIndividualQueryMetrics(db, queryIDList, utils.RecentQueriesSearch, args)
func recentQueryMetrics(app *newrelic.Application, db utils.DataSource, queryIDList []string, args arguments.ArgumentList) ([]utils.IndividualQueryMetrics, error) {
metrics, err := collectIndividualQueryMetrics(app, db, queryIDList, utils.RecentQueriesSearch, args)
if err != nil {
return nil, err
}
Expand All @@ -172,8 +173,8 @@ func recentQueryMetrics(db utils.DataSource, queryIDList []string, args argument
}

// extensiveQueryMetrics collects extensive query metrics from the performance schema database for the given query IDs
func extensiveQueryMetrics(db utils.DataSource, queryIDList []string, args arguments.ArgumentList) ([]utils.IndividualQueryMetrics, error) {
metrics, err := collectIndividualQueryMetrics(db, queryIDList, utils.PastQueriesSearch, args)
func extensiveQueryMetrics(app *newrelic.Application, db utils.DataSource, queryIDList []string, args arguments.ArgumentList) ([]utils.IndividualQueryMetrics, error) {
metrics, err := collectIndividualQueryMetrics(app, db, queryIDList, utils.PastQueriesSearch, args)
if err != nil {
return nil, err
}
Expand All @@ -182,7 +183,7 @@ func extensiveQueryMetrics(db utils.DataSource, queryIDList []string, args argum
}

// collectIndividualQueryMetrics collects current query metrics from the performance schema database for the given query IDs
func collectIndividualQueryMetrics(db utils.DataSource, queryIDList []string, queryString string, args arguments.ArgumentList) ([]utils.IndividualQueryMetrics, error) {
func collectIndividualQueryMetrics(app *newrelic.Application, db utils.DataSource, queryIDList []string, queryString string, args arguments.ArgumentList) ([]utils.IndividualQueryMetrics, error) {
// Early exit if queryIDList is empty
if len(queryIDList) == 0 {
log.Warn("queryIDList is empty")
Expand All @@ -193,16 +194,16 @@ func collectIndividualQueryMetrics(db utils.DataSource, queryIDList []string, qu

for _, queryID := range queryIDList {
// Combine queryID and thresholds into args
args := []interface{}{queryID, args.QueryResponseTimeThreshold, min(constants.IndividualQueryCountThreshold, args.QueryCountThreshold)}
inputArgs := []interface{}{queryID, args.QueryResponseTimeThreshold, min(constants.IndividualQueryCountThreshold, args.QueryCountThreshold)}

// Use sqlx.In to safely include the slices in the query
query, args, err := sqlx.In(queryString, args...)
query, preparedArgs, err := sqlx.In(queryString, inputArgs...)
if err != nil {
return []utils.IndividualQueryMetrics{}, err
}

// Collect the individual query metrics
metrics, err := utils.CollectMetrics[utils.IndividualQueryMetrics](db, query, args...)
metrics, err := utils.CollectMetrics[utils.IndividualQueryMetrics](app, db, query, preparedArgs...)
if err != nil {
return []utils.IndividualQueryMetrics{}, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"

"github.com/bitly/go-simplejson"
"github.com/newrelic/go-agent/v3/newrelic"
"github.com/newrelic/infra-integrations-sdk/v3/integration"
"github.com/newrelic/infra-integrations-sdk/v3/log"
arguments "github.com/newrelic/nri-mysql/src/args"
Expand All @@ -16,7 +17,7 @@ import (
)

// PopulateExecutionPlans populates execution plans for the given queries.
func PopulateExecutionPlans(db utils.DataSource, queryGroups []utils.QueryGroup, i *integration.Integration, e *integration.Entity, args arguments.ArgumentList) {
func PopulateExecutionPlans(app *newrelic.Application, db utils.DataSource, queryGroups []utils.QueryGroup, i *integration.Integration, e *integration.Entity, args arguments.ArgumentList) {
var events []utils.QueryPlanMetrics

for _, group := range queryGroups {
Expand All @@ -27,7 +28,7 @@ func PopulateExecutionPlans(db utils.DataSource, queryGroups []utils.QueryGroup,
defer db.Close()

for _, query := range group.Queries {
tableIngestionDataList, err := processExecutionPlanMetrics(db, query)
tableIngestionDataList, err := processExecutionPlanMetrics(app, db, query)
if err != nil {
log.Error("Error processing execution plan metrics: %v", err)
}
Expand All @@ -47,7 +48,7 @@ func PopulateExecutionPlans(db utils.DataSource, queryGroups []utils.QueryGroup,
}

// processExecutionPlanMetrics processes the execution plan metrics for a given query.
func processExecutionPlanMetrics(db utils.DataSource, query utils.IndividualQueryMetrics) ([]utils.QueryPlanMetrics, error) {
func processExecutionPlanMetrics(app *newrelic.Application, db utils.DataSource, query utils.IndividualQueryMetrics) ([]utils.QueryPlanMetrics, error) {
ctx, cancel := context.WithTimeout(context.Background(), constants.QueryPlanTimeoutDuration)
defer cancel()

Expand All @@ -72,7 +73,7 @@ func processExecutionPlanMetrics(db utils.DataSource, query utils.IndividualQuer

// Execute the EXPLAIN query
execPlanQuery := fmt.Sprintf(constants.ExplainQueryFormat, queryText)
rows, err := db.QueryxContext(ctx, execPlanQuery)
rows, err := db.QueryxContext(app, ctx, execPlanQuery)
if err != nil {
return []utils.QueryPlanMetrics{}, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package performancemetricscollectors

import (
"github.com/jmoiron/sqlx"
"github.com/newrelic/go-agent/v3/newrelic"
"github.com/newrelic/infra-integrations-sdk/v3/integration"
"github.com/newrelic/infra-integrations-sdk/v3/log"
arguments "github.com/newrelic/nri-mysql/src/args"
Expand All @@ -10,7 +11,7 @@ import (
)

// PopulateWaitEventMetrics retrieves wait event metrics from the database and sets them in the integration.
func PopulateWaitEventMetrics(db utils.DataSource, i *integration.Integration, e *integration.Entity, args arguments.ArgumentList, excludedDatabases []string) {
func PopulateWaitEventMetrics(app *newrelic.Application, db utils.DataSource, i *integration.Integration, e *integration.Entity, args arguments.ArgumentList, excludedDatabases []string) {
// Prepare the arguments for the query
excludedDatabasesArgs := []interface{}{excludedDatabases, excludedDatabases, min(args.QueryCountThreshold, constants.MaxQueryCountThreshold)}

Expand All @@ -21,7 +22,7 @@ func PopulateWaitEventMetrics(db utils.DataSource, i *integration.Integration, e
}

// Collect the wait event metrics
metrics, err := utils.CollectMetrics[utils.WaitEventQueryMetrics](db, preparedQuery, preparedArgs...)
metrics, err := utils.CollectMetrics[utils.WaitEventQueryMetrics](app, db, preparedQuery, preparedArgs...)
if err != nil {
log.Error("Error collecting wait event metrics: %v", err)
}
Expand Down
Loading