ConnectionPool gets or initializes the connection pool for this instance
()
| 936 | |
| 937 | // ConnectionPool gets or initializes the connection pool for this instance |
| 938 | func (instance *Instance) ConnectionPool() pool.Pooler { |
| 939 | const applicationName = "cnpg-instance-manager" |
| 940 | if instance.pool == nil { |
| 941 | socketDir := GetSocketDir() |
| 942 | dsn := fmt.Sprintf( |
| 943 | "host=%s port=%v user=%v sslmode=disable application_name=%v", |
| 944 | socketDir, |
| 945 | GetServerPort(), |
| 946 | "postgres", |
| 947 | applicationName, |
| 948 | ) |
| 949 | |
| 950 | instance.pool = pool.NewPostgresqlConnectionPool(dsn) |
| 951 | } |
| 952 | |
| 953 | return instance.pool |
| 954 | } |
| 955 | |
| 956 | // metricsConnectionPool gets or initializes the connection pool used by the metrics exporter. |
| 957 | func (instance *Instance) metricsConnectionPool() pool.Pooler { |
no test coverage detected