plone / guillotina

Python AsyncIO data API to manage billions of resources
https://guillotina.readthedocs.io/en/latest/
Other
187 stars 51 forks source link

Pass 'server_settings' in 'connection_options' to asyncpg pool #1000

Closed masipcat closed 4 years ago

masipcat commented 4 years ago

Close https://github.com/vinissimus/product/issues/2938

With this change I can define the following config:

  db:
    storage: postgresql
    dsn: postgresql://...
    server_settings:
      application_name: api

and see the application_name of the process/connection in pg_stat_activity:

SELECT                              
  pid,
  application_name, 
  state
FROM pg_stat_activity

This was proposed by @jordic

codecov-commenter commented 4 years ago

Codecov Report

Merging #1000 into master will decrease coverage by 0.1%. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #1000     +/-   ##
========================================
- Coverage    94.6%   94.6%   -0.0%     
========================================
  Files         316     316             
  Lines       28049   28049             
========================================
- Hits        26534   26528      -6     
- Misses       1515    1521      +6     
Impacted Files Coverage Δ
guillotina/db/factory.py 93.0% <ø> (ø)
guillotina/contrib/redis/driver.py 83.1% <0.0%> (-2.6%) :arrow_down:
guillotina/contrib/pubsub/utility.py 84.8% <0.0%> (-2.1%) :arrow_down:
guillotina/db/storages/pg.py 89.1% <0.0%> (-0.1%) :arrow_down: