Skip to content

Commit

Permalink
Add support for pgbouncer 1.16.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbub committed Aug 18, 2021
1 parent 7dc12b3 commit 000dacd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.11.0

* Add support for PgBouncer 1.16.
* Update to github.com/prometheus/common v0.30.0.

## 0.10.0

* Drop sqlx, use stdlib database.
Expand Down
16 changes: 8 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.7"

services:
postgres:
image: "postgres:12.3-alpine"
image: "postgres:12.4-alpine"
restart: always
ports:
- "5432:5432"
Expand All @@ -11,14 +11,14 @@ services:
POSTGRES_PASSWORD: "postgres"

pgbouncer:
image: "tophfr/pgbouncer:1.12.0"
image: "bitnami/pgbouncer:1.16.0"
restart: always
environment:
DEFAULT_HOST: "postgres"
AUTH__POSTGRES: "postgres"
CONF__PGBOUNCER__POOL_MODE: "transaction"
CONF__PGBOUNCER__STATS_USERS: "postgres"
CONF__PGBOUNCER__IGNORE_STARTUP_PARAMETERS: "extra_float_digits"
POSTGRESQL_HOST: "postgres"
POSTGRESQL_USERNAME: "postgres"
POSTGRESQL_PASSWORD: "postgres"
PGBOUNCER_AUTH_TYPE: "trust"
PGBOUNCER_IGNORE_STARTUP_PARAMETERS: "extra_float_digits"
depends_on:
- postgres

Expand All @@ -29,7 +29,7 @@ services:
ports:
- "9127:9127"
environment:
DATABASE_URL: "postgres://postgres:postgres@pgbouncer:5432/pgbouncer?sslmode=disable&binary_parameters=yes"
DATABASE_URL: "postgres://postgres:postgres@pgbouncer:6432/pgbouncer?sslmode=disable&binary_parameters=yes"
DEFAULT_LABELS: "instance=pg1 env=dev"
depends_on:
- pgbouncer
2 changes: 2 additions & 0 deletions internal/domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Pool struct {
User string
Active int64
Waiting int64
CancelReq int64
ServerActive int64
ServerIdle int64
ServerUsed int64
Expand All @@ -50,6 +51,7 @@ type Database struct {
Database string
ForceUser string
PoolSize int64
MinPoolSize int64
ReservePool int64
PoolMode string
MaxConnections int64
Expand Down
6 changes: 6 additions & 0 deletions internal/sqlstore/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type pool struct {
User string
Active int64
Waiting int64
CancelReq int64
ServerActive int64
ServerIdle int64
ServerUsed int64
Expand All @@ -30,6 +31,7 @@ type database struct {
Database string
ForceUser sql.NullString
PoolSize int64
MinPoolSize int64
ReservePool int64
PoolMode sql.NullString
MaxConnections int64
Expand Down Expand Up @@ -152,6 +154,8 @@ func (s *Store) GetPools(ctx context.Context) ([]domain.Pool, error) {
dest = append(dest, &row.Active)
case "cl_waiting":
dest = append(dest, &row.Waiting)
case "cl_cancel_req":
dest = append(dest, &row.CancelReq)
case "sv_active":
dest = append(dest, &row.ServerActive)
case "sv_idle":
Expand Down Expand Up @@ -238,6 +242,8 @@ func (s *Store) GetDatabases(ctx context.Context) ([]domain.Database, error) {
dest = append(dest, &row.ForceUser)
case "pool_size":
dest = append(dest, &row.PoolSize)
case "min_pool_size":
dest = append(dest, &row.MinPoolSize)
case "reserve_pool":
dest = append(dest, &row.ReservePool)
case "pool_mode":
Expand Down

0 comments on commit 000dacd

Please sign in to comment.