Skip to content

Commit bf8cee2

Browse files
authored
Merge pull request #215 from authzed/check-tracing
Add basic check tracing doc
2 parents 9666ef9 + 47ec4cb commit bf8cee2

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

pages/spicedb/modeling/validation-testing-debugging.mdx

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Callout } from 'nextra/components'
2-
import YouTube from 'react-youtube'
1+
import { Callout } from 'nextra/components';
2+
import YouTube from 'react-youtube';
33

44
# Validation, Testing, Debugging SpiceDB Schemas
55

@@ -35,11 +35,13 @@ To support this, SpiceDB's v1 CheckPermission API supports a debug header that w
3535
Instead, we recommend using [zed's explain flag] for this purpose.
3636

3737
[zed's explain flag]: #explain-flag
38+
3839
</Callout>
3940

4041
Configuring this header is done by setting the header `io.spicedb.requestdebuginfo` to the string `true`.
4142

4243
The response will include a trailer, `io.spicedb.respmeta.debuginfo`, with a JSON-encoded tree.
44+
4345
## Playground
4446

4547
### Assertions
@@ -62,7 +64,8 @@ This enables an even tighter feedback-loop when developing a schema.
6264
6365
Below is an example of configuring a Check Watch:
6466
65-
<br /><YouTube videoId="UmvGPU8iQ-0" />
67+
<br />
68+
<YouTube videoId="UmvGPU8iQ-0" />
6669
6770
### Expected Relations
6871
@@ -85,6 +88,19 @@ project:docs#admin:
8588
- "[user:rauchg] is <platform:vercel#admin>"
8689
```
8790
91+
## Check Tracing
92+
93+
SpiceDB supports tracing of check requests to view the path(s) taken to compute the result, as well as timing information.
94+
95+
Request tracing information by setting `with_tracing: true` in the request message and the information will be found in the response message.
96+
97+
<Callout type="warning">
98+
**Warning:**
99+
Versions older than v1.31.0
100+
101+
Request tracing information via a header and the information will be found in the response footer as JSON.
102+
</Callout>
103+
88104
## Zed
89105

90106
### Zed Validate
@@ -109,13 +125,13 @@ If you're interested in learning more about this functionality in SpiceDB, you c
109125

110126
Here's an example using `--explain`:
111127

112-
```ansi
128+
```ansi
113129
$ zed permission check --explain document:firstdoc view user:fred
114130
true
115131
✓ document:firstdoc view (66.333µs)
116132
├── ⨉ document:firstdoc writer (12.375µs)
117133
└── ✓ document:firstdoc reader (20.667µs)
118-
└── [38;5;99muser:fred [0m
134+
└── [38;5;99muser:fred [0m
119135
```
120136

121137
This command will also highlight which parts of the traversal were cached and if a cycle is detected.
@@ -142,8 +158,8 @@ steps:
142158
### [authzed/action-spicedb-validate](https://github.com/marketplace/actions/validate-spicedb-schema)
143159

144160
<Callout type="info">
145-
**Info:**
146-
This tool is highly recommended because it can prevent deployments of unverified changes.
161+
**Info:** This tool is highly recommended because it can prevent deployments
162+
of unverified changes.
147163
</Callout>
148164

149165
The Playground offers a variety of tools that are useful for validating a design, but running the playground isn't designed for operating within a typical CI/CD environment.

0 commit comments

Comments
 (0)