You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Profiling helps you find slow queries, transaction contention, and unnecessary storage activity.
8
8
9
+
Collect [Prometheus metrics from each worker](/actors/self-host/workers/prometheus-metrics/) to use the queries below.
10
+
9
11
## Identify operations
10
12
11
13
### Transaction names
@@ -18,17 +20,29 @@ Without a name, RivetKit falls back to a fingerprint of the transaction's statem
18
20
19
21
### Statement fingerprints
20
22
21
-
RivetKit normalizes each SQL statement into a sanitized shape, then hashes that shape into a stable fingerprint. The fingerprint groups metrics without putting SQL text in a Prometheus label.
22
-
23
-
- Bound and inline literal values do not change the fingerprint.
24
-
- Whitespace, capitalization, and comments do not change the fingerprint.
25
-
- Keep query structure static and use `?` or named bindings for dynamic values.
23
+
RivetKit hashes each SQL statement exactly as provided. The fingerprint groups metrics without putting SQL text in a Prometheus label.
26
24
27
25
For example, repeated `SELECT * FROM orders WHERE id = ?` calls share one fingerprint regardless of the bound ID.
28
26
27
+
### Find the SQL for a fingerprint
28
+
29
+
RivetKit logs the SQL statement or transaction name for each tracked fingerprint.
30
+
31
+
For example, suppose a Prometheus result contains `fingerprint="select-a1b2c3d4e5f60718"`:
32
+
33
+
1. Copy the fingerprint: `select-a1b2c3d4e5f60718`.
34
+
2. Search the actor logs for `sqlite fingerprint catalog` and `select-a1b2c3d4e5f60718`.
35
+
3. Read `identity` from the matching log line:
36
+
37
+
```text
38
+
sqlite fingerprint catalog fingerprint="select-a1b2c3d4e5f60718" identity="SELECT value FROM items WHERE id = ?"
39
+
```
40
+
41
+
For a transaction fingerprint, `identity` contains its static transaction name.
42
+
29
43
## Find slow operations
30
44
31
-
**Slowest statements and transactions**
45
+
### Slowest statements and transactions
32
46
33
47
```promql
34
48
histogram_quantile(
@@ -39,25 +53,72 @@ histogram_quantile(
39
53
)
40
54
```
41
55
42
-
**Failed operations**
56
+
### Slowest latency phases
57
+
58
+
```promql
59
+
histogram_quantile(
60
+
0.95,
61
+
sum by (le, actor_name, type, fingerprint, phase) (
A sustained worker queue indicates SQLite work is arriving faster than the actor's native worker completes it. The average `worker_inflight` value is the fraction of sampled time that the worker was executing a command.
Compare `response_present` with `demand_requested` to see response amplification. `overflow_expansion_extra` shows pages added while resolving SQLite overflow chains, and `prefetch_requested` shows speculative reads.
@@ -91,18 +185,15 @@ High round-trip or page counts can indicate a missing index, a large scan, or in
91
185
92
186
RivetKit emits bounded structured diagnostics for operations that are slow, fail, show unusual storage amplification, or are selected by baseline sampling.
93
187
94
-
- Fingerprint catalog events map a fingerprint to its sanitized SQL shape or static transaction name.
95
-
- Operation events include latency phases, rows, bytes, page activity, and storage requests.
188
+
- Operation events include timing components, rows, bytes, page activity, and storage requests.
96
189
- Transaction events include statement count, application-held time, commit time, and terminal outcome.
97
190
- Event sampling, rate limits, and a bounded queue prevent diagnostics from blocking SQLite work.
98
191
99
-
Search actor logs for `sqlite fingerprint catalog` or `sampled SQLite operation profile` and match events using the `fingerprint` field.
100
-
101
-
Catalog events contain the sanitized SQL shape, never bound values or raw SQL. Continue binding dynamic values instead of constructing SQL strings.
192
+
Search actor logs for `sampled SQLite operation profile` to inspect one profiled statement execution. Transaction details use `sampled SQLite transaction profile`.
102
193
103
194
## Configure profiling
104
195
105
-
Profiling is enabled by default and most applications do not need to configure it. Set `profiling.slowOperationThresholdMs` or `profiling.baselineSampleRate` on the database provider when needed.
196
+
Profiling is enabled by default and most applications do not need to configure it. The entire profiling configuration surface is experimental and subject to change without notice. Set `profiling.slowOperationThresholdMs` or `profiling.baselineSampleRate` on the database provider when needed.
106
197
107
198
Increase fingerprint limits only when `other` is hiding frequently repeated operations. Prometheus series remain allocated for the life of the process after admission.
108
199
@@ -114,7 +205,7 @@ Fast statements initially appear under `other`, while overflow metrics show when
114
205
115
206
### Too many fingerprints
116
207
117
-
Fingerprints use normalized SQL shapes, so formatting, comments, and literal values do not create separate entries. Keep query structure static and pass dynamic values as bindings.
208
+
Statement fingerprints use the exact query text. Keep formattingand query structure static, and pass dynamic values as bindings instead of constructing SQL strings.
0 commit comments