Skip to content

Commit

Permalink
chore(db): add database logging flags (#414)
Browse files Browse the repository at this point in the history
Co-authored-by: Kelly Merrick <[email protected]>
  • Loading branch information
wass3rw3rk and KellyMerrick authored Jun 24, 2024
1 parent 06db65a commit 4d4ab69
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 10 deletions.
48 changes: 48 additions & 0 deletions content/installation/server/reference/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
24 changes: 14 additions & 10 deletions content/installation/server/reference/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`<br>`VELA_DATABASE_ADDR` |
| `database.driver` | type of client to control and operate the database | `true` | `vela.sqlite` | `DATABASE_DRIVER`<br>`VELA_DATABASE_DRIVER` |
| `database.compression.level` | level of compression for logs stored in the database | `true` | `3` | `DATABASE_COMPRESSION_LEVEL`<br>`VELA_DATABASE_COMPRESSION_LEVEL` |
| `database.connection.idle` | maximum number of idle connections to the database | `true` | `2` | `DATABASE_CONNECTION_IDLE`<br>`VELA_DATABASE_CONNECTION_IDLE` |
| `database.connection.life` | duration of time a connection is reusable | `true` | `30m` | `DATABASE_CONNECTION_LIFE`<br>`VELA_DATABASE_CONNECTION_LIFE` |
| `database.connection.open` | maximum number of open connections to the database | `true` | `0` | `DATABASE_CONNECTION_OPEN`<br>`VELA_DATABASE_CONNECTION_OPEN` |
| `database.encryption.key` | AES-256 key for encrypting/decrypting values in the database | `true` | `N/A` | `DATABASE_ENCRYPTION_KEY`<br>`VELA_DATABASE_ENCRYPTION_KEY` |
| `database.skip_creation` | skips the creation of tables and indexes in the database | `false` | `false` | `DATABASE_SKIP_CREATION`<br>`VELA_DATABASE_SKIP_CREATION` |
| Name | Description | Required | Default | Environment Variables |
| ----------------------------- | ---------------------------------------------------------------- | -------- | ------------- | --------------------------------------------------------------------- |
| `database.addr` | full connection string to the database | `true` | `sqlite3` | `DATABASE_ADDR`<br>`VELA_DATABASE_ADDR` |
| `database.driver` | type of client to control and operate the database | `true` | `vela.sqlite` | `DATABASE_DRIVER`<br>`VELA_DATABASE_DRIVER` |
| `database.compression.level` | level of compression for logs stored in the database | `true` | `3` | `DATABASE_COMPRESSION_LEVEL`<br>`VELA_DATABASE_COMPRESSION_LEVEL` |
| `database.connection.idle` | maximum number of idle connections to the database | `true` | `2` | `DATABASE_CONNECTION_IDLE`<br>`VELA_DATABASE_CONNECTION_IDLE` |
| `database.connection.life` | duration of time a connection is reusable | `true` | `30m` | `DATABASE_CONNECTION_LIFE`<br>`VELA_DATABASE_CONNECTION_LIFE` |
| `database.connection.open` | maximum number of open connections to the database | `true` | `0` | `DATABASE_CONNECTION_OPEN`<br>`VELA_DATABASE_CONNECTION_OPEN` |
| `database.encryption.key` | AES-256 key for encrypting/decrypting values in the database | `true` | `N/A` | `DATABASE_ENCRYPTION_KEY`<br>`VELA_DATABASE_ENCRYPTION_KEY` |
| `database.skip_creation` | skips the creation of tables and indexes in the database | `false` | `false` | `DATABASE_SKIP_CREATION`<br>`VELA_DATABASE_SKIP_CREATION` |
| `database.log.level` | log level for database | `false` | `warn` | `DATABASE_LOG_LEVEL` <br> `VELA_DATABASE_LOG_LEVEL` |
| `database.log.show_sql` | show sql query in logs | `false` | `false` | `DATABASE_LOG_SHOW_SQL` <br> `VELA_DATABASE_LOG_SHOW_SQL` |
| `database.log.skip_notfound` | skip logging not found errors | `false` | `true` | `DATABASE_LOG_SKIP_NOTFOUND` <br> `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` <br> `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/).
Expand Down

0 comments on commit 4d4ab69

Please sign in to comment.