Skip to content

Commit

Permalink
Add the application name to the event (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
fgarces committed Feb 26, 2020
1 parent 5aa4158 commit d50791f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# postgres-vacuum-monitor

## v.0.8.0
- Also report on queries that are being blocked by another process.
- Add the application name in the event.

## v.0.8.0
- Report on queries that are being blocked by another process.

## v.0.7.0
- Lower the default `LongTransactions` threshold from 1 hour to 5 minutes and make this configurable via
Expand Down
2 changes: 2 additions & 0 deletions lib/postgres/vacuum/jobs/monitor_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ def perform(*)
BLOCKED_QUERIES,
database_name: name,
blocked_pid: row['blocked_pid'],
blocked_application: row['blocked_application'],
blocked_statement: row['blocked_statement'],
blocking_pid: row['blocking_pid'],
blocking_application: row['blocking_application'],
current_statement_in_blocking_process: row['current_statement_in_blocking_process']
)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/postgres/vacuum/monitor/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Postgres
module Vacuum
module Monitor
VERSION = '0.8.0'.freeze
VERSION = '0.9.0'.freeze
end
end
end
4 changes: 4 additions & 0 deletions spec/postgres/vacuum/jobs/monitor_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ def self.report_event(name, attributes = {})
allow(mock_connection).to receive(:execute).with(Postgres::Vacuum::Monitor::Query.blocked_queries).and_return(
[
'blocked_pid' => 2,
'blocked_application' => 'foo',
'blocked_statement' => 'SELECT 1 FROM products',
'blocking_pid' => 3,
'blocking_application' => 'bar',
'current_statement_in_blocking_process' => 'SELECT 2 FROM products'
]
)
Expand All @@ -87,9 +89,11 @@ def self.report_event(name, attributes = {})
expect(TestMetricsReporter).to have_received(:report_event).with(
Postgres::Vacuum::Jobs::MonitorJob::BLOCKED_QUERIES,
database_name: 'postgres_vacuum_monitor_test',
blocked_application: 'foo',
blocked_pid: 2,
blocked_statement: 'SELECT 1 FROM products',
blocking_pid: 3,
blocking_application: 'bar',
current_statement_in_blocking_process: 'SELECT 2 FROM products'
)
end
Expand Down

0 comments on commit d50791f

Please sign in to comment.