Skip to content

Commit

Permalink
Merge pull request #8 from zeeshanakram3/enhanced_postgres_query_traces
Browse files Browse the repository at this point in the history
Enable OpenTelemetry enhanced Postgres query traces
  • Loading branch information
zeeshanakram3 authored Dec 20, 2023
2 parents dbd260b + 8419d5b commit 7402805
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.2.0

- patched `@subsquid/openreader` to pass parameter values in 'queryConfig' object instead of passing as param to `pgClient.query` function.
- enabled enhanced Opentelemetry postgres query traces.

# 1.1.0

- remove unused dependencies from `package.json` file.
Expand Down
13 changes: 13 additions & 0 deletions assets/patches/@subsquid+openreader+4.4.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/@subsquid/openreader/lib/db.js b/node_modules/@subsquid/openreader/lib/db.js
index c87884b..9a9801e 100644
--- a/node_modules/@subsquid/openreader/lib/db.js
+++ b/node_modules/@subsquid/openreader/lib/db.js
@@ -9,7 +9,7 @@ class PgDatabase {
this.client = client;
}
query(sql, parameters) {
- return this.client.query({ text: sql, rowMode: 'array' }, parameters)
+ return this.client.query({ text: sql, values: parameters, rowMode: 'array' })
.then(result => result.rows)
.catch((0, error_handling_1.withErrorContext)({ sql, parameters }));
}
1 change: 1 addition & 0 deletions opentelemetry/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumenta
// See: https://github.com/Joystream/joystream/pull/4779#discussion_r1262515887
const instrumentations = getNodeAutoInstrumentations({
'@opentelemetry/instrumentation-dns': { enabled: false },
'@opentelemetry/instrumentation-pg': { enhancedDatabaseReporting: true },
})

const { NodeSDK } = require('@opentelemetry/sdk-node')
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "storage-squid",
"version": "1.1.0",
"version": "1.2.0",
"engines": {
"node": ">=16"
},
Expand Down

0 comments on commit 7402805

Please sign in to comment.