Looking at the output of select * from pg_stat_activity;
, I see a column called application_name
, described here.
I see psql sets this value correctly (to psql
...), but my application code (psycopg2/SQLAlchemy) leaves it blank.
I'd like to set this to something useful, like web.1
, web.2
, etc, so I could later on correlate what I see in pg_stat_activity
with what I see in my application logs.
I couldn't find how to set this field using SQLAlchemy (and if push comes to shove - even with raw sql; I'm using PostgresSQL 9.1.7 on Heroku, if that matters).
Am I missing something obvious?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…