Log Stacktrace of current Python Interpreter via PostgreSQL trigger

From: Thomas Güttler <guettliml(at)thomas-guettler(dot)de>
To: psycopg(at)postgresql(dot)org
Subject: Log Stacktrace of current Python Interpreter via PostgreSQL trigger
Date: 2019-05-20 07:43:48
Message-ID: 46505a4b-517b-0967-c2f9-1364a794ecef@thomas-guettler.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

I am hunting a non reproducible in a production environment.

I can detect the buggy change in a postgres trigger.

Since it is production code I must no raise an exception. I can
only use logging.

If I could see the stacktrace of the python interpreter, I could
see which codes the change which I am hunting.

But how to get this interpreter stacktrace, if the condition is
detect in the db trigger?

https://stackoverflow.com/questions/51873708/log-stacktrace-of-python-in-postgresql-trigger

Maybe there is a psycopg2 feature which I don't know up to now.

I guess LISTEN+NOTIFY could get used.
Or setting a connection variable which I check after each SQL statement.

Ideas welcome,

Thomas Güttler

--
Thomas Guettler http://www.thomas-guettler.de/
I am looking for feedback: https://github.com/guettli/programming-guidelines

Responses

Browse psycopg by date

  From Date Subject
Next Message Daniele Varrazzo 2019-05-20 10:19:24 Re: Log Stacktrace of current Python Interpreter via PostgreSQL trigger
Previous Message Karsten Hilbert 2019-04-14 18:39:49 Re: Psycopg 2.8.1, 2.8.2 released