Skip to content

Commit

Permalink
Devhawk/replay-debugger (#317)
Browse files Browse the repository at this point in the history
Replay Debugging Docs
  • Loading branch information
devhawk authored Mar 7, 2025
1 parent 4c1ec6e commit 4b3f762
Show file tree
Hide file tree
Showing 23 changed files with 370 additions and 429 deletions.
File renamed without changes
Binary file added docs/assets/ttdbg-login-cloud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/ttdbg-login-cmd-palette.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 57 additions & 5 deletions docs/cloud-tutorials/interactive-timetravel.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@ Interactive time travel is only available for DBOS Cloud applications using the

In this guide, you'll learn how to interactively time travel with DBOS Cloud: how to query your application's database as of any past point in time within the time travel [data retention period](https://www.dbos.dev/pricing) of your current plan.

### Preliminaries
## Preliminaries

Before following the steps in this guide, make sure you've [deployed an application to DBOS Cloud](application-management) with [time travel enabled](./cloud-cli#dbos-cloud-app-deploy).

In order to time travel, you need to locally install our time travel proxy.
Please follow our [time travel debugging tutorial](./timetravel-debugging) to install the proxy via VSCode or manually.
Then, start your proxy and connect it to your application database instance:
Time travel debugging uses [Visual Studio Code](https://code.visualstudio.com/) and the
[DBOS Debugger Extension](https://marketplace.visualstudio.com/items?itemName=dbos-inc.dbos-ttdbg).
The extension can be installed from the link above or by searching the
[Extension Marketplace](https://code.visualstudio.com/docs/editor/extension-marketplace)
inside VS Code for "DBOS"

![Installing the DBOS Time Travel Extension Screenshot](../assets/ttdbg-ext-install.png)

Once installed, the DBOS Time Travel Extension will automatically update as new releases are published to the VS Code Marketplace.


<Tabs groupId="environment" className="small-tabs">
<TabItem value="VSCode" label="VSCode">
Expand All @@ -41,7 +48,7 @@ The DBOS time travel proxy securely connects to the [provenance database](../exp
It uses the historical information in this database to run time-travelled queries without modifying your application database.
:::

### Running Time-Travelled Queries
## Running Time-Travelled Queries

In this tutorial, we interactively run time-travelled queries on your application database using [`psql`](https://www.postgresql.org/docs/current/app-psql.html).
First, connect `psql` to your local time travel proxy:
Expand Down Expand Up @@ -79,3 +86,48 @@ You can run any `SELECT` statement on the database to query its state as of the
Statements that modify schemas or data (`INSERT`, `UPDATE`, `DROP TABLE`, etc.) will not have any effect.
At any time, you can run `DBOS TS <timestamp>;` again to travel to a different time.
You can also run `DBOS SNAPSHOT RESET;` to return to the present time.

## Interactive Time Travel Command Reference

When interactively querying your DBOS Cloud database, the following additional commands can be invoked from the
[`psql`](https://www.postgresql.org/docs/current/app-psql.html) command prompt.
As is typical for SQL commands, the interactive time travel commands are case insensitive.

### DBOS TIMESTAMP

::::info
Can be shortened to `DBOS TS`
::::

Sets the time travel debugger to a specific point in time for time travel queries. The timestamp can be specified in
[RFC 3339 format](https://datatracker.ietf.org/doc/html/rfc3339) (example: `2024-04-22T14:56:56-07:00`)
or as an integer indicating the Unix epoch in milliseconds. RFC 3339 formatted timestamps
must be enclosed in quotes.

Examples:

* `DBOS TIMESTAMP "2024-04-22T14:56:56-07:00";`
* `DBOS TS "2024-04-22T14:56:56-07:00";`
* `DBOS TIMESTAMP 1234567890;`

### DBOS WORKFLOW

::::info
Can be shortened to `DBOS WF`
::::

Sets the time travel debugger to the specific point in time when a specified workflow started.
Workflows are identified by their workflow UUID, which can be found in the
[Monitoring Dashboard](../cloud-tutorials/monitoring-dashboard.md).
The workflow UUID must be enclosed in quotes when using this command.

Examples:

* `DBOS WORKFLOW "7eb0968a-fbf0-4af2-909f-51d8516e7351";`
* `DBOS WF "7eb0968a-fbf0-4af2-909f-51d8516e7351";`

### DBOS SNAPSHOT RESET

Resets the time travel snapshot to the current time. Example:

* `DBOS SNAPSHOT RESET;`
1 change: 0 additions & 1 deletion docs/cloud-tutorials/monitoring-dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ In the top-right corner of the Grafana dashboard, there are filtering selectors:
When turning on these filters, the time window filter also still applies. You may see more data for your selection if you "zoom out" in time.
:::

Clicking on a value in the Trace ID column will sets the filter for that trace. Clicking on a value in the Workflow UUID column runs that workflow in the Time Travel Debugger. Please see the [Time Travel Debugger Tutorial](./timetravel-debugging#debugging-from-the-monitoring-dashboard) for more information

When filtering the `Workflow UUID` use `_` to match any one character and `%` to match any string (SQL 'like' notation). This is useful for selecting groups of scheduled workflows. For example you can use a string like `sched%T19%` to match any scheduled workflows that ran at 7PM on any of the days in the selected time interval.

Expand Down
232 changes: 0 additions & 232 deletions docs/cloud-tutorials/timetravel-debugging.md

This file was deleted.

4 changes: 2 additions & 2 deletions docs/explanations/system-tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ Each entry represents a different event.
The provenance database is only available for DBOS Cloud applications using the **experimental** time travel feature. To enable experimental time travel for your application, please specify `--enable-timetravel` [during deploy](../cloud-tutorials/cloud-cli#dbos-cloud-app-deploy).
:::

DBOS Cloud maintains a provenance database for your application, which is an append-only versioned replica of your application database.
It is the key enabler of [Interactive Time Travel](../cloud-tutorials/interactive-timetravel.md) and [Time Travel Debugging](../cloud-tutorials/timetravel-debugging.md).
DBOS Cloud optionally maintains a provenance database for your application, which is an append-only versioned replica of your application database.
It is the key enabler of [Interactive Time Travel](../cloud-tutorials/interactive-timetravel.md).
The provenance database name is your application database suffixed with `_dbos_prov`.
For example, if your application database is named `hello`, then your provenance database is named `hello_dbos_prov`.
The provenance database contains the history (within the time travel [data retention period](https://www.dbos.dev/pricing)) of each of your database tables.
Expand Down
Loading

0 comments on commit 4b3f762

Please sign in to comment.