From 4d4ab69457c3367cf8138fb64e840cebe4024dd7 Mon Sep 17 00:00:00 2001 From: David May <49894298+wass3rw3rk@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:48:24 -0500 Subject: [PATCH] chore(db): add database logging flags (#414) Co-authored-by: Kelly Merrick --- .../installation/server/reference/_index.md | 48 +++++++++++++++++++ .../installation/server/reference/database.md | 24 ++++++---- 2 files changed, 62 insertions(+), 10 deletions(-) diff --git a/content/installation/server/reference/_index.md b/content/installation/server/reference/_index.md index fdf8967ee..4f5ba08cd 100644 --- a/content/installation/server/reference/_index.md +++ b/content/installation/server/reference/_index.md @@ -256,6 +256,54 @@ The variable can be provided as a `boolean`. This variable has a default value of `false`. {{% /alert %}} +### VELA_DATABASE_LOG_LEVEL + +This configuration variable is used by the [database component](/docs/installation/server/reference/database/) for the server. + +This variable controls the log level to use in the database system. This can be different than the log level for the rest of the application. + +The variable can be provided as a `string` (trace, debug, info, warn, error, fatal, panic). + +{{% alert title="Note:" color="primary" %}} +This variable has a default value of `warn`. +{{% /alert %}} + +### VELA_DATABASE_LOG_SHOW_SQL + +This configuration variable is used by the [database component](/docs/installation/server/reference/database/) for the server. + +This variable controls whether to show the SQL query in the logs for the database system. + +The variable can be provided as a `boolean`. + +{{% alert title="Note:" color="primary" %}} +This variable has a default value of `false`. +{{% /alert %}} + +### VELA_DATABASE_LOG_SKIP_NOTFOUND + +This configuration variable is used by the [database component](/docs/installation/server/reference/database/) for the server. + +This variable controls whether to skip showing record not found errors in the logs for the in the database system. + +The variable can be provided as a `boolean`. + +{{% alert title="Note:" color="primary" %}} +This variable has a default value of `true`. +{{% /alert %}} + +### VELA_DATABASE_LOG_SLOW_THRESHOLD + +This configuration variable is used by the [database component](/docs/installation/server/reference/database/) for the server. + +This variable controls the threshold that determines which queries are considered slow and logged in the database system. + +The variable can be provided as a `duration`. + +{{% alert title="Note:" color="primary" %}} +This variable has a default value of `200ms`. +{{% /alert %}} + ### VELA_DEFAULT_BUILD_LIMIT This variable sets the default amount of concurrent builds a repo is allowed to run. diff --git a/content/installation/server/reference/database.md b/content/installation/server/reference/database.md index d7d069f93..323862b64 100644 --- a/content/installation/server/reference/database.md +++ b/content/installation/server/reference/database.md @@ -19,16 +19,20 @@ Any sensitive data stored in the database will be encrypted using the [Advanced The following options are used to configure the component: -| Name | Description | Required | Default | Environment Variables | -| ---------------------------- | ---------------------------------------------------------------- | -------- | ------------- | ----------------------------------------------------------------- | -| `database.addr` | full connection string to the database | `true` | `sqlite3` | `DATABASE_ADDR`
`VELA_DATABASE_ADDR` | -| `database.driver` | type of client to control and operate the database | `true` | `vela.sqlite` | `DATABASE_DRIVER`
`VELA_DATABASE_DRIVER` | -| `database.compression.level` | level of compression for logs stored in the database | `true` | `3` | `DATABASE_COMPRESSION_LEVEL`
`VELA_DATABASE_COMPRESSION_LEVEL` | -| `database.connection.idle` | maximum number of idle connections to the database | `true` | `2` | `DATABASE_CONNECTION_IDLE`
`VELA_DATABASE_CONNECTION_IDLE` | -| `database.connection.life` | duration of time a connection is reusable | `true` | `30m` | `DATABASE_CONNECTION_LIFE`
`VELA_DATABASE_CONNECTION_LIFE` | -| `database.connection.open` | maximum number of open connections to the database | `true` | `0` | `DATABASE_CONNECTION_OPEN`
`VELA_DATABASE_CONNECTION_OPEN` | -| `database.encryption.key` | AES-256 key for encrypting/decrypting values in the database | `true` | `N/A` | `DATABASE_ENCRYPTION_KEY`
`VELA_DATABASE_ENCRYPTION_KEY` | -| `database.skip_creation` | skips the creation of tables and indexes in the database | `false` | `false` | `DATABASE_SKIP_CREATION`
`VELA_DATABASE_SKIP_CREATION` | +| Name | Description | Required | Default | Environment Variables | +| ----------------------------- | ---------------------------------------------------------------- | -------- | ------------- | --------------------------------------------------------------------- | +| `database.addr` | full connection string to the database | `true` | `sqlite3` | `DATABASE_ADDR`
`VELA_DATABASE_ADDR` | +| `database.driver` | type of client to control and operate the database | `true` | `vela.sqlite` | `DATABASE_DRIVER`
`VELA_DATABASE_DRIVER` | +| `database.compression.level` | level of compression for logs stored in the database | `true` | `3` | `DATABASE_COMPRESSION_LEVEL`
`VELA_DATABASE_COMPRESSION_LEVEL` | +| `database.connection.idle` | maximum number of idle connections to the database | `true` | `2` | `DATABASE_CONNECTION_IDLE`
`VELA_DATABASE_CONNECTION_IDLE` | +| `database.connection.life` | duration of time a connection is reusable | `true` | `30m` | `DATABASE_CONNECTION_LIFE`
`VELA_DATABASE_CONNECTION_LIFE` | +| `database.connection.open` | maximum number of open connections to the database | `true` | `0` | `DATABASE_CONNECTION_OPEN`
`VELA_DATABASE_CONNECTION_OPEN` | +| `database.encryption.key` | AES-256 key for encrypting/decrypting values in the database | `true` | `N/A` | `DATABASE_ENCRYPTION_KEY`
`VELA_DATABASE_ENCRYPTION_KEY` | +| `database.skip_creation` | skips the creation of tables and indexes in the database | `false` | `false` | `DATABASE_SKIP_CREATION`
`VELA_DATABASE_SKIP_CREATION` | +| `database.log.level` | log level for database | `false` | `warn` | `DATABASE_LOG_LEVEL`
`VELA_DATABASE_LOG_LEVEL` | +| `database.log.show_sql` | show sql query in logs | `false` | `false` | `DATABASE_LOG_SHOW_SQL`
`VELA_DATABASE_LOG_SHOW_SQL` | +| `database.log.skip_notfound` | skip logging not found errors | `false` | `true` | `DATABASE_LOG_SKIP_NOTFOUND`
`VELA_DATABASE_LOG_SKIP_NOTFOUND` | +| `database.log.slow_threshold` | queries higher than this value are considered slow and logged | `false` | `200ms` | `DATABASE_LOG_SLOW_THRESHOLD`
`VELA_DATABASE_LOG_SLOW_THRESHOLD` | {{% alert title="Note:" color="primary" %}} For more information on these configuration options, please see the [server reference](/docs/installation/server/reference/).