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

[EUWE] Set database application name #14909

Merged
merged 2 commits into from May 9, 2017

Conversation

jrafanie
Copy link
Member

This is a manual backport of:
#13856
#14904

https://bugzilla.redhat.com/show_bug.cgi?id=1445928

When we need to do database lock or connection triaging, it's really hard to tell where each connection originated from because we don't specify an application_name. It looks something like this:

vmdb_production=# select pid, application_name from pg_stat_activity;
pid | application_name
------+--------------------------------------------------
13770 | /var/www/miq/vmdb/lib/workers/bin/evm_server.rb
13950 | /var/www/miq/vmdb/lib/workers/bin/evm_server.rb
13957 | /var/www/miq/vmdb/lib/workers/bin/evm_server.rb
13969 | /var/www/miq/vmdb/lib/workers/bin/evm_server.rb
13975 | /var/www/miq/vmdb/lib/workers/bin/evm_server.rb
13984 | /var/www/miq/vmdb/lib/workers/bin/evm_server.rb
The much debated format of the application_name now looks like this:

MIQ [], s[], []
OR:
MIQ Server[], []

Note, the pg backend pid isn't needed in application_name since the pid column in pg_stat_activity is the backend pid. Plus, each of our processes can have more than one spid.

It now looks like this:

vmdb_development=# select pid, application_name from pg_stat_activity;
pid | application_name
------------------+------+-------------+----------------------
5844 | MIQ 5835 Server[1r2], default[1r1]
5888 | MIQ 5886 Generic[1r1111], s[1r2], default[1r1]
5891 | MIQ 5889 Generic[1r1112], s[1r2], default[1r1]
5894 | MIQ 5892 Priority[1r1113], s[1r2], default[1r1]
5897 | MIQ 5895 Priority[1r1114], s[1r2], default[1r1]
5900 | MIQ 5898 Schedule[1r1115], s[1r2], default[1r1]
5928 | MIQ 5926 EventHandler[1r1116], s[1r2], default[1r1]
5932 | MIQ 5929 Reporting[1r1117], s[1r2], default[1r1]
5934 | MIQ 5931 Reporting[1r1118], s[1r2], default[1r1]
5943 | MIQ 5941 Ui[1r1120], s[1r2], default[1r1]
5940 | MIQ 5935 Websocket[1r1119], s[1r2], default[1r1]
5946 | MIQ 5944 WebService[1r1121], s[1r2], default[1r1]
5964 | MIQ 5935 Websocket[1r1119], s[1r2], default[1r1]
5965 | MIQ 5941 Ui[1r1120], s[1r2], default[1r1]
5966 | MIQ 5944 WebService[1r1121], s[1r2], default[1r1]

…ion_name

Set database application name in workers and server
(cherry picked from commit f241df4)
…me_after_server_row_created

Set the db application_name after the server row is created
@miq-bot
Copy link
Member

miq-bot commented Apr 26, 2017

Checked commits jrafanie/manageiq@b8a12ee~...8c339a7 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
6 files checked, 0 offenses detected
Everything looks fine. 🍰

@simaishi simaishi merged commit 8211244 into ManageIQ:euwe May 9, 2017
@simaishi simaishi added this to the Sprint 61 Ending May 22, 2017 milestone May 9, 2017
@jrafanie jrafanie deleted the set_database_application_name_euwe branch May 9, 2017 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants