Monitor PostgreSQL flavor in usage ping
What does this MR do and why?
This MR adds PostgreSQL flavor to usage data metrics.
Flavor can be one of :
- "Amazon Aurora PostgreSQL"
- "PostgreSQL on Amazon RDS"
- "Cloud SQL for PostgreSQL"
- "Azure Database for PostgreSQL - Flexible Server"
- "Azure Database for PostgreSQL - Single Server"
- "null" (if we can't detect what flavor is used)
https://gitlab.com/gitlab-services/version-gitlab-com/-/merge_requests/637 will add new database column to VersionApp where we'll store this new data.
Related to https://gitlab.com/gitlab-org/database-team/team-tasks/-/issues/218.
How to set up and validate locally
- In rails console execute the following
> usage_data = ServicePing::BuildPayloadService.new.execute > usage_data[:database]
- For standard PostgreSQL you should see
> {:adapter=>"postgresql", :version=>"12.9", :pg_system_id=>6976470454675971923, :flavor=>nil}
- To simulate Aurora first create the following function in your database
> CREATE OR REPLACE FUNCTION AURORA_VERSION() RETURNS TEXT LANGUAGE plpgsql AS $$ BEGIN RETURN '1.2.3'; END; $$;
> {:adapter=>"postgresql", :version=>"12.9", :pg_system_id=>6976470454675971923, :flavor=>"Amazon Aurora PostgreSQL"}
- To simulate Azure Database for PostgreSQL - Single Server create the following database
> CREATE DATABASE azure_maintenance;
> {:adapter=>"postgresql", :version=>"12.9", :pg_system_id=>6976470454675971923, :flavor=>"Azure Database for PostgreSQL - Single Server"}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Krasimir Angelov