Skip to content

Commit

Permalink
Restate SQL introspection reference
Browse files Browse the repository at this point in the history
  • Loading branch information
gvdongen authored and tillrohrmann committed Aug 8, 2023
1 parent 6bd5a40 commit bcf4126
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions docs/references/restate-sql-introspection.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
sidebar_position: 3
description: "API reference for inspecting the invocation status and service state."
---

# Restate SQL Introspection API

Restate exposes two tables that can be queried via `psql`.
The schema of these tables is described in the following.

## Table: `state`

| Column name | type | description | example |
| ----------------- | ------ |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------------------------------------------------------------------------------------- |
| `partition_key` | `UInt32` | Internal column that is used for partitioning the services invocations. Can be ignored. | |
| `service` | `utf8` | The name of the invoked service | `foo.bar.Greeter` |
| `service_key_utf8` | `utf8` | Only contains meaningful values when a service uses a `utf8` Restate key | `bob` |
| `service_key_int32` | `Int32` | Only contains meaningful values when a service uses an `int32` Restate key | `1337` |
| `service_key_uuid` | `utf8` | Only contains meaningful values for unkeyed Restate services | `0189bab3b3397d828e979e2548980fa6` |
| `key` | `utf8` | The `utf8` user-supplied state key | A snippet like `ctx.set(“seen”, 1);` Will produce a value like: `seen` |
| `value_utf8` | `utf8` | Only contains meaningful values when a service stores state as `utf8`. This is the case for Typescript services since the Typescript SDK serializes values as JSON. | `1` |
| `value` | | | |

## Table: `sys_status`

| Column name | type | description | example |
| ------------------ | ------ |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------|
| `partition_key` | `UInt32` | Internal column that is used for partitioning the services invocations. Can be ignored. | |
| `service` | `utf8` | The name for the invoked service | `foo.bar.Greeter` |
| `method` | `utf8` | The invoked RPC method | `greet` |
| `service_key_utf8` | `utf8` | Only contains meaningful values when a service uses a `utf8` Restate key | `bob` |
| `service_key_int32` | `Int32` | Only contains meaningful values when a service uses an `int32` Restate key | `1337` |
| `service_key_uuid` | `utf8` | Only contains meaningful values for unkeyed Restate services | `0189bab3b3397d828e979e2548980fa6` |
| `status` | `utf8` | Enum value: `invoked` or `suspended` | |
| `invocation_id` | `utf8` | Restate-generated invocation ID | `0189baba86ea76b2a0efc37db88ea9a5` |
| `sid` | `utf8` | Service invocation ID, an opaque token that can be used to cancel an invocation of a service with the [admin API](/references/admin-api) | |
| `invoked_by` | `utf8` | Enum describing the invoker of this service: `ingress` = invoked externally / `service` = invoked by a service | |
| `invoked_by_service` | `utf8` | The name of the invoking service. Or `null` if invoked via the ingress. | `com.example.Greeter` |
| `invoked_by_sid` | `utf8` | The service invocation ID of the service that triggered this invocation. Or `null` if invoked via the ingress. | |
| `trace_id` | `utf8` | The ID of the trace that is assigned to this invocation. Only relevant when tracing is enabled. | |
| `journal_size` | `uint32` | The number of journal entries durably logged for this invocation | |
| `created_at` | `date64` | Timestamp indicating the start of this invocation. | |
| `modified_at` | `date64` | Timestamp indicating the last state transition. For example, last time the status changed from `invoked` to `suspended`. | |

0 comments on commit bcf4126

Please sign in to comment.