Skip to content

Commit 43feda8

Browse files
authored
Postgres: Set application_name to crates.io (#8794)
This makes queries from the application easier to recognize in the logs. see https://www.postgresql.org/docs/current/runtime-config-logging.html#GUC-APPLICATION-NAME
1 parent 9f986f0 commit 43feda8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/db.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ pub struct ConnectionConfig {
5252

5353
impl ConnectionConfig {
5454
fn apply(&self, conn: &mut PgConnection) -> QueryResult<()> {
55+
diesel::sql_query("SET application_name = 'crates.io'").execute(conn)?;
56+
5557
let statement_timeout = self.statement_timeout.as_millis();
5658
diesel::sql_query(format!("SET statement_timeout = {statement_timeout}")).execute(conn)?;
5759

0 commit comments

Comments
 (0)