Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reusing existing DB connection #22

Merged
merged 253 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
253 commits
Select commit Hold shift + click to select a range
b0a7952
Updated
sjyothi54 Nov 28, 2024
8ffb56a
comment log
tharun0064 Nov 29, 2024
2d108a5
update
sjyothi54 Dec 2, 2024
179a9a9
Update
sjyothi54 Dec 2, 2024
231ec77
test
sjyothi54 Dec 2, 2024
977a870
test
sjyothi54 Dec 9, 2024
f7c3e6e
test
sjyothi54 Dec 9, 2024
0831d0e
test
sjyothi54 Dec 9, 2024
ec7d389
test
sjyothi54 Dec 9, 2024
d99c26a
test
sjyothi54 Dec 9, 2024
c071bd4
test
sjyothi54 Dec 9, 2024
c30c811
test
sjyothi54 Dec 9, 2024
2140787
test
tharun0064 Dec 11, 2024
ac432fc
test
tharun0064 Dec 11, 2024
c2752ac
test
tharun0064 Dec 11, 2024
5261578
test
tharun0064 Dec 11, 2024
1aad951
test
tharun0064 Dec 11, 2024
63c2e35
test
tharun0064 Dec 11, 2024
4e46e45
test
tharun0064 Dec 11, 2024
d4c5f41
test
tharun0064 Dec 11, 2024
22bd7ea
test
tharun0064 Dec 11, 2024
5d15b42
test
tharun0064 Dec 11, 2024
8da8ce8
test
tharun0064 Dec 11, 2024
96bbaba
test
tharun0064 Dec 11, 2024
cffa30f
test
tharun0064 Dec 11, 2024
709e6ce
test
tharun0064 Dec 11, 2024
dbdc735
test
tharun0064 Dec 11, 2024
7a304c7
test
tharun0064 Dec 11, 2024
47104e3
test
tharun0064 Dec 11, 2024
0758045
test
tharun0064 Dec 11, 2024
831bcb9
test
tharun0064 Dec 11, 2024
c3af905
test
tharun0064 Dec 12, 2024
35ff7d2
test
tharun0064 Dec 12, 2024
e99e973
test
tharun0064 Dec 12, 2024
0f65c72
test
tharun0064 Dec 12, 2024
5f0f9d8
test
tharun0064 Dec 12, 2024
a7ed654
test
tharun0064 Dec 12, 2024
6b511b4
test
tharun0064 Dec 12, 2024
cf1c2f9
test
tharun0064 Dec 12, 2024
c29bd8c
test
tharun0064 Dec 12, 2024
f6617f5
test
tharun0064 Dec 12, 2024
c8f8755
test
tharun0064 Dec 12, 2024
754d897
test
tharun0064 Dec 12, 2024
33879fa
test
tharun0064 Dec 12, 2024
e12070a
test
tharun0064 Dec 12, 2024
ec7dc7f
test
tharun0064 Dec 12, 2024
ae81355
test
tharun0064 Dec 12, 2024
0aec2f7
final working code for all events
tharun0064 Dec 12, 2024
f3366da
test
tharun0064 Dec 12, 2024
9822142
test
tharun0064 Dec 12, 2024
ad0f6d9
test
tharun0064 Dec 12, 2024
3abcb71
test
tharun0064 Dec 12, 2024
f092eda
test
tharun0064 Dec 12, 2024
cedb56a
test
tharun0064 Dec 12, 2024
a132d8e
test
tharun0064 Dec 12, 2024
bdc8830
test
tharun0064 Dec 12, 2024
af0ec4b
refactor
tharun0064 Dec 13, 2024
e96bc9a
refactor
tharun0064 Dec 13, 2024
7e42a1d
refactor wait events
tharun0064 Dec 13, 2024
01d21b1
refactor individual quer
tharun0064 Dec 13, 2024
dc13259
refactor
tharun0064 Dec 13, 2024
6d9750a
refactor
tharun0064 Dec 13, 2024
fcb9935
refactor execution plan
tharun0064 Dec 13, 2024
199d259
refactor blocking sessions
tharun0064 Dec 13, 2024
5df9b37
refactor - fix set metric bug
tharun0064 Dec 13, 2024
b59f00f
add cpu metric data
tharun0064 Dec 13, 2024
d22e4af
refactor
tharun0064 Dec 13, 2024
8d6ff50
refactor
tharun0064 Dec 13, 2024
4468a52
refactor
tharun0064 Dec 13, 2024
a9a0c86
refactor
tharun0064 Dec 13, 2024
1dee739
refactor
tharun0064 Dec 13, 2024
bf0285c
refactor
tharun0064 Dec 13, 2024
0eea044
refactor : change in columns
tharun0064 Dec 13, 2024
b1d6674
refactor : change in event name
tharun0064 Dec 13, 2024
8dbcde1
refactor
tharun0064 Dec 13, 2024
47371a1
refactor
tharun0064 Dec 13, 2024
33f6375
refactor
tharun0064 Dec 13, 2024
2848c10
removed cpu time metrics
tharun0064 Dec 13, 2024
11a89e0
refactor
tharun0064 Dec 13, 2024
4e913f6
refactor : anonamize query
tharun0064 Dec 13, 2024
fae48c4
refactor
tharun0064 Dec 13, 2024
ea91caa
refactor
tharun0064 Dec 13, 2024
f5c6935
refactor
tharun0064 Dec 13, 2024
35e86b6
refactor
tharun0064 Dec 13, 2024
00eeff0
refactor common util
tharun0064 Dec 13, 2024
ca35e55
refactor : ingestion helper usage
tharun0064 Dec 13, 2024
505d4e5
refactor
tharun0064 Dec 13, 2024
6351089
refactor
tharun0064 Dec 13, 2024
6fa1757
refactor ingestion helper
tharun0064 Dec 16, 2024
eef0cd3
test
tharun0064 Dec 16, 2024
9b28e57
refactor : remove commented code
tharun0064 Dec 16, 2024
4236827
refactor : naming of variables
tharun0064 Dec 16, 2024
dfb666d
feat : ingestionHelper
tharun0064 Dec 16, 2024
94c20ae
queries
sjyothi54 Dec 16, 2024
ada757b
refactor
tharun0064 Dec 16, 2024
c71d7ac
fix ingestion helper
tharun0064 Dec 16, 2024
08bb335
test
sjyothi54 Dec 16, 2024
e5bb6f8
refactor
tharun0064 Dec 16, 2024
4fa0ff7
test
sjyothi54 Dec 16, 2024
86b1ab0
refactor
tharun0064 Dec 16, 2024
b13e804
refactor
tharun0064 Dec 16, 2024
7482083
refactor
tharun0064 Dec 16, 2024
ef6ed03
refactor
tharun0064 Dec 16, 2024
2751e8a
refactor
tharun0064 Dec 16, 2024
f37ea91
refactor : remove unused vars
tharun0064 Dec 16, 2024
e10d6c2
Query analysis testing (#2)
tharun0064 Dec 16, 2024
f448005
increase publish threshold
tharun0064 Dec 16, 2024
c78e73a
undo version change
tharun0064 Dec 16, 2024
945afd3
Merge branch 'query-performance-monitoring' into queryAnalysisTestingV5
tharun0064 Dec 16, 2024
a8c0b70
add planid and cpu time addition
tharun0064 Dec 16, 2024
d1e095f
modify query for individual query
tharun0064 Dec 16, 2024
b45cc67
refactor
tharun0064 Dec 16, 2024
d5a0810
refactor
tharun0064 Dec 16, 2024
cb9394c
refactor
tharun0064 Dec 16, 2024
89e1e81
refactor
tharun0064 Dec 16, 2024
84fcf14
refactor
tharun0064 Dec 16, 2024
b561955
refactor
tharun0064 Dec 16, 2024
4b6262f
refactor
tharun0064 Dec 16, 2024
f1ce23f
refactor
tharun0064 Dec 16, 2024
5fdc95b
change in event name
tharun0064 Dec 17, 2024
3e9af3f
Merge branch 'queryAnalysisTestingV4' into queryAnalysisTestingV5
tharun0064 Dec 17, 2024
777d3ad
refactor
tharun0064 Dec 17, 2024
8816297
changing database and query text metric name
sjyothi54 Dec 17, 2024
fbd34e7
refactor
tharun0064 Dec 17, 2024
5712814
refactor
tharun0064 Dec 17, 2024
49aaf57
query text
sjyothi54 Dec 17, 2024
10a1b36
refactor
tharun0064 Dec 17, 2024
744838e
refactor
tharun0064 Dec 17, 2024
642b735
refactor
tharun0064 Dec 17, 2024
5907275
test
tharun0064 Dec 18, 2024
5fd8419
test
tharun0064 Dec 18, 2024
46a8c09
test
tharun0064 Dec 18, 2024
553496a
test
tharun0064 Dec 18, 2024
9429220
test
tharun0064 Dec 18, 2024
1b70663
test
tharun0064 Dec 18, 2024
2557166
test
tharun0064 Dec 18, 2024
90cabca
loooped execution plan metrics
tharun0064 Dec 18, 2024
21fd51a
refactor
tharun0064 Dec 18, 2024
0de1464
Update CHANGELOG.md (#186)
alvarocabanas Dec 18, 2024
a5983d4
test anonamization of query in execution plan
tharun0064 Dec 19, 2024
22e13c0
test
tharun0064 Dec 19, 2024
518f28c
test
tharun0064 Dec 19, 2024
5655ede
test
tharun0064 Dec 19, 2024
fe8e3bd
test
tharun0064 Dec 19, 2024
504b72f
test
tharun0064 Dec 23, 2024
b29c5e0
test
tharun0064 Dec 23, 2024
bdc2cb4
test
tharun0064 Dec 23, 2024
883232b
test
tharun0064 Dec 24, 2024
33e776f
test
tharun0064 Dec 24, 2024
c3ffda7
comment unused code
tharun0064 Dec 24, 2024
5f5af55
test
tharun0064 Dec 24, 2024
c8377f9
test
tharun0064 Dec 24, 2024
103e998
test
tharun0064 Dec 24, 2024
17ca32c
test
tharun0064 Dec 24, 2024
8efffc5
test
tharun0064 Dec 24, 2024
6a68e21
test
tharun0064 Dec 24, 2024
5a5b36f
test
tharun0064 Dec 24, 2024
9989ede
test
tharun0064 Dec 24, 2024
3974890
test
tharun0064 Dec 24, 2024
518158f
test
tharun0064 Dec 24, 2024
28499ba
remove json print logs
tharun0064 Dec 30, 2024
611ee0a
Merge branch 'master' into queryAnalysisTestingV6V2
tharun0064 Dec 30, 2024
810e53e
config use in slow queries
tharun0064 Dec 30, 2024
c04866f
config use in wait query
tharun0064 Dec 30, 2024
554ef80
config use in blocking session query
tharun0064 Dec 30, 2024
d28cd19
config use in individual queries
tharun0064 Dec 30, 2024
9d275fe
fix individual metric model
tharun0064 Dec 30, 2024
bf479d9
test
tharun0064 Dec 30, 2024
677f029
test
tharun0064 Dec 30, 2024
4a3b9c2
test
tharun0064 Dec 30, 2024
fcaec10
test
tharun0064 Dec 30, 2024
1a4c8f8
test
tharun0064 Dec 30, 2024
e3557b2
test
tharun0064 Dec 30, 2024
614f213
test
tharun0064 Dec 30, 2024
228aac8
test
tharun0064 Dec 30, 2024
e77d944
test
tharun0064 Dec 30, 2024
1202862
test
tharun0064 Dec 30, 2024
52ff017
test
tharun0064 Dec 30, 2024
44bf8ef
test
tharun0064 Dec 30, 2024
c0995a6
test
tharun0064 Dec 30, 2024
6191e38
test
tharun0064 Dec 30, 2024
69ff322
test
tharun0064 Dec 30, 2024
4467c6d
test
tharun0064 Dec 30, 2024
f6c33d0
test
tharun0064 Dec 30, 2024
012d226
test
tharun0064 Dec 30, 2024
dc78e6f
test
tharun0064 Dec 30, 2024
52eff7c
test
tharun0064 Dec 30, 2024
3dfea98
test
tharun0064 Dec 30, 2024
bfa3978
test
tharun0064 Dec 30, 2024
1fbfe0b
test
tharun0064 Dec 30, 2024
57198a6
test
tharun0064 Dec 30, 2024
6d38d08
test
tharun0064 Dec 30, 2024
3e8b730
test
tharun0064 Dec 30, 2024
ca3b38a
test
tharun0064 Dec 30, 2024
3292402
test
tharun0064 Dec 30, 2024
c7ad12a
test
tharun0064 Dec 30, 2024
5af5997
test
tharun0064 Dec 30, 2024
5b58fb5
test
tharun0064 Dec 30, 2024
36bb37d
test
tharun0064 Dec 30, 2024
14062e6
test
tharun0064 Dec 30, 2024
18e285d
test
tharun0064 Dec 30, 2024
04c37bf
test
tharun0064 Dec 30, 2024
6ada476
test
tharun0064 Dec 30, 2024
aa51b66
test
tharun0064 Dec 30, 2024
874d9a6
test
tharun0064 Dec 30, 2024
ba4bb0a
test
tharun0064 Dec 30, 2024
6945bcd
line breaks resolve
tharun0064 Dec 30, 2024
f9365f4
fix linting issue
tharun0064 Dec 30, 2024
f44c57f
fix go imports issue
tharun0064 Dec 30, 2024
532f5df
fix linting issue
tharun0064 Dec 30, 2024
979c452
fix linting issue
tharun0064 Dec 30, 2024
850daa9
fix linting issue
tharun0064 Dec 30, 2024
fd9eaf3
fix linting issue
tharun0064 Dec 30, 2024
b18830b
fix linting issue
tharun0064 Dec 30, 2024
9d04fb9
fix linting issue
tharun0064 Dec 30, 2024
0ad39cc
fix linting issue
tharun0064 Dec 30, 2024
0be5620
test
tharun0064 Dec 30, 2024
eb65d49
fix linting issue
tharun0064 Dec 30, 2024
e5dac86
fix linting issue
tharun0064 Dec 30, 2024
5c9b182
fix linting issue
tharun0064 Dec 30, 2024
6d95621
Query performance monitoring
tharun0064 Dec 30, 2024
3bd1e70
undo change
tharun0064 Dec 30, 2024
d1b34c1
remove test query
tharun0064 Dec 30, 2024
e448f01
fix warnings
tharun0064 Dec 31, 2024
c91520a
fix linting issue
tharun0064 Dec 31, 2024
eb02de3
Merge branch 'feat_performance_monitoring' into queryAnalysisTestingV6V6
tharun0064 Dec 31, 2024
ba2301f
Query performance monitoring
tharun0064 Dec 30, 2024
93b225c
log level change and validation change
tharun0064 Dec 31, 2024
1905260
merge
tharun0064 Dec 31, 2024
f1a5b56
fix lint issues
tharun0064 Dec 31, 2024
b7dcc09
Query performance monitoring
tharun0064 Dec 31, 2024
2b21672
slow query len check in individual queries metrics populate
tharun0064 Dec 31, 2024
131e76c
trim query text
tharun0064 Dec 31, 2024
5f9cf6d
Merge branch 'feat_performance_monitoring' into queryAnalysisTestingV6V7
tharun0064 Dec 31, 2024
96497f0
lint issue fix
tharun0064 Dec 31, 2024
0cc0acb
Merge branch 'feat_performance_monitoring' into queryAnalysisTestingV6V7
tharun0064 Dec 31, 2024
949ee75
filter queries executed through OHI
tharun0064 Jan 2, 2025
6451b85
data model fix
tharun0064 Jan 2, 2025
1224baa
test
tharun0064 Jan 2, 2025
a72c932
test
tharun0064 Jan 2, 2025
6a050b1
test
tharun0064 Jan 2, 2025
9e8ba46
test
tharun0064 Jan 2, 2025
82097c3
filter system queries
tharun0064 Jan 2, 2025
ef1ccf8
test
tharun0064 Jan 2, 2025
0f16800
test
tharun0064 Jan 2, 2025
28fa5e2
test
tharun0064 Jan 2, 2025
3e509eb
test
tharun0064 Jan 2, 2025
601996a
existing DB connection reusage
tharun0064 Jan 2, 2025
aa0f302
remove unused function
tharun0064 Jan 2, 2025
ee99025
reusage of code
tharun0064 Jan 2, 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
5 changes: 0 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ Unreleased section should follow [Release Toolkit](https://github.com/newrelic/r

## Unreleased

## v2.16.1 - 2024-12-16

### ⛓️ Dependencies
- Updated golang patch version to v1.23.4

## v2.16.0 - 2024-11-11

### 🚀 Enhancements
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package datamodels

type SlowRunningQueryMetrics struct {
Newrelic *string `db:"newrelic" metric_name:"newrelic" source_type:"attribute" ingestData:"false"`
QueryID *int64 `db:"query_id" metric_name:"query_id" source_type:"gauge"`
QueryText *string `db:"query_text" metric_name:"query_text" source_type:"attribute"`
DatabaseName *string `db:"database_name" metric_name:"database_name" source_type:"attribute"`
Expand All @@ -24,6 +25,7 @@ type WaitEventMetrics struct {
DatabaseName *string `db:"database_name" metric_name:"database_name" source_type:"attribute"`
}
type BlockingSessionMetrics struct {
Newrelic *string `db:"newrelic" metric_name:"newrelic" source_type:"attribute" ingestData:"false"`
BlockedPid *int64 `db:"blocked_pid" metric_name:"blocked_pid" source_type:"gauge"`
BlockedQuery *string `db:"blocked_query" metric_name:"blocked_query" source_type:"attribute"`
BlockedQueryID *string `db:"blocked_query_id" metric_name:"blocked_query_id" source_type:"attribute"`
Expand All @@ -42,6 +44,7 @@ type IndividualQueryMetrics struct {
AvgCPUTimeInMS *float64 `json:"avg_cpu_time_ms" db:"avg_cpu_time_ms" metric_name:"avg_cpu_time_ms" source_type:"gauge"`
PlanID *string `json:"planid" db:"planid" metric_name:"plan_id" source_type:"attribute"`
RealQueryText *string `ingestData:"false"`
Newrelic *string `db:"newrelic" metric_name:"newrelic" source_type:"attribute" ingestData:"false"`
}

type QueryExecutionPlanMetrics struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/newrelic/infra-integrations-sdk/v3/log"
"github.com/newrelic/nri-postgresql/src/args"
performancedbconnection "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/connections"
performancedbconnection "github.com/newrelic/nri-postgresql/src/connection"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/datamodels"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/queries"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"github.com/newrelic/infra-integrations-sdk/v3/integration"
"github.com/newrelic/infra-integrations-sdk/v3/log"
"github.com/newrelic/nri-postgresql/src/args"
performancedbconnection "github.com/newrelic/nri-postgresql/src/connection"
commonutils "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/common-utils"
performancedbconnection "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/connections"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/datamodels"
)

Expand All @@ -25,7 +25,10 @@
var executionPlanMetricsList []interface{}
var groupIndividualQueriesByDatabase = GroupQueriesByDatabase(results)
for dbName, individualQueriesList := range groupIndividualQueriesByDatabase {
dbConn, err := performancedbconnection.OpenDB(args, dbName)
connectionInfo := performancedbconnection.DefaultConnectionInfo(&args)
dbConn, err := connectionInfo.NewConnection(dbName)

//dbConn, err := performancedbconnection.OpenDB(args, dbName)

Check failure on line 31 in src/query-performance-monitoring/performance-metrics/execution_plan_metrics.go

View workflow job for this annotation

GitHub Actions / push-pr / static-analysis / Run all static analysis checks

commentFormatting: put a space between `//` and comment text (gocritic)
if err != nil {
log.Error("Error opening database connection: %v", err)
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/newrelic/infra-integrations-sdk/v3/integration"
"github.com/newrelic/infra-integrations-sdk/v3/log"
"github.com/newrelic/nri-postgresql/src/args"
performancedbconnection "github.com/newrelic/nri-postgresql/src/connection"
commonutils "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/common-utils"
performancedbconnection "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/connections"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/datamodels"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/queries"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/validations"
Expand Down Expand Up @@ -78,6 +78,7 @@ func GetIndividualQueryMetrics(conn *performancedbconnection.PGSQLConnection, sl
}
if closeErr := rows.Close(); closeErr != nil {
log.Error("Error closing rows: %v", closeErr)
return nil, nil
}
return individualQueryMetricsListInterface, individualQueryMetricsForExecPlanList
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/newrelic/infra-integrations-sdk/v3/integration"
"github.com/newrelic/infra-integrations-sdk/v3/log"
"github.com/newrelic/nri-postgresql/src/args"
performancedbconnection "github.com/newrelic/nri-postgresql/src/connection"
commonutils "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/common-utils"
performancedbconnection "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/connections"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/datamodels"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/queries"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/validations"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/newrelic/infra-integrations-sdk/v3/integration"
"github.com/newrelic/infra-integrations-sdk/v3/log"
"github.com/newrelic/nri-postgresql/src/args"
performancedbconnection "github.com/newrelic/nri-postgresql/src/connection"
commonutils "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/common-utils"
performancedbconnection "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/connections"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/datamodels"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/queries"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/validations"
Expand Down
17 changes: 12 additions & 5 deletions src/query-performance-monitoring/queries/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package queries

const (
SlowQueries = `SELECT
SlowQueries = `SELECT 'newrelic' as newrelic,
pss.queryid AS query_id,
LEFT(pss.query, 4095) AS query_text,
pd.datname AS database_name,
Expand All @@ -25,7 +25,14 @@ const (
JOIN
pg_database pd ON pss.dbid = pd.oid
WHERE
pss.query NOT LIKE 'EXPLAIN (FORMAT JSON) %%'
pss.query NOT ILIKE 'EXPLAIN (FORMAT JSON) %%'
AND pss.query NOT ILIKE 'SELECT $1 as newrelic%%'
AND pss.query NOT ILIKE 'WITH wait_history AS%%'
AND pss.query NOT ILIKE 'select -- BLOATQUERY%%'
AND pss.query NOT ILIKE 'select -- INDEXQUERY%%'
AND pss.query NOT ILIKE 'SELECT -- TABLEQUERY%%'
AND pss.query NOT ILIKE 'SELECT table_schema%%'
AND pss.query ILIKE '%%Departments%%'
ORDER BY
avg_elapsed_time_ms DESC -- Order by the average elapsed time in descending order
LIMIT
Expand Down Expand Up @@ -68,7 +75,7 @@ const (
ORDER BY total_wait_time_ms DESC
LIMIT %d;`

BlockingQueries = `SELECT
BlockingQueries = `SELECT 'newrelic' as newrelic,
blocked_activity.pid AS blocked_pid,
LEFT(blocked_statements.query,4095) AS blocked_query,
blocked_statements.queryid AS blocked_query_id,
Expand Down Expand Up @@ -99,15 +106,15 @@ const (
LIMIT %d;
`

IndividualQuerySearch = `SELECT
IndividualQuerySearch = `SELECT 'newrelic' as newrelic,
LEFT(query,4095) as query,
queryid,
datname,
planid,
ROUND(((cpu_user_time + cpu_sys_time) / NULLIF(calls, 0))::numeric, 3) AS avg_cpu_time_ms
FROM
pg_stat_monitor
Where query NOT LIKE 'EXPLAIN (FORMAT JSON) %%' AND queryid IN (%s)
Where queryid IN (%s)
GROUP BY
query, queryid, datname, planid, cpu_user_time, cpu_sys_time, calls `
)
2 changes: 1 addition & 1 deletion src/query-performance-monitoring/query_performance_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"

"github.com/newrelic/infra-integrations-sdk/v3/log"
performancedbconnection "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/connections"
performancedbconnection "github.com/newrelic/nri-postgresql/src/connection"

"github.com/newrelic/infra-integrations-sdk/v3/integration"
"github.com/newrelic/nri-postgresql/src/args"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

"github.com/newrelic/infra-integrations-sdk/v3/log"
performancedbconnection "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/connections"
performancedbconnection "github.com/newrelic/nri-postgresql/src/connection"
)

func isExtensionEnabled(conn *performancedbconnection.PGSQLConnection, extensionName string) (bool, error) {
Expand Down
Loading