Skip to content

Commit

Permalink
Update about tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
k1LoW committed Oct 26, 2023
1 parent 4427cf3 commit 5dce055
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,16 @@ Force all steps to run.
force: true
```

### `trace:`

Add tokens for tracing to headers and queries by default.

Currently, HTTP runner, gRPC runner and DB runner are supported.

``` yaml
trace: true
```

### `loop:`

Loop setting for runbook.
Expand Down Expand Up @@ -656,6 +666,7 @@ steps:
application/json: # Content-Type specification. In this case, it is "Content-Type: application/json"
username: alice
password: passw0rd
trace: false # add `X-Runn-Trace` header to HTTP request for tracing
test: | # test for current step
current.res.status == 201
```
Expand Down Expand Up @@ -752,6 +763,15 @@ runners:
# skipVerify: false
```

#### Add `X-Runn-Trace` header to HTTP request for tracing

``` yaml
runners:
myapi:
endpoint: https://api.github.com
trace: true
```

### gRPC Runner: Do gRPC request

Use `grpc://` scheme to specify gRPC Runner.
Expand All @@ -772,6 +792,7 @@ steps:
name: alice
num: 3
request_time: 2022-06-25T05:24:43.861872Z
trace: false # add `x-runn-trace` header to gRPC request for tracing
-
desc: Request using Server streaming RPC
greq:
Expand Down Expand Up @@ -877,6 +898,15 @@ are recorded with the following structure.
num: 32 # current.res.messages[0].num
```
#### Add `x-runn-trace` header to gRPC request for tracing

``` yaml
runners:
greq:
addr: grpc.example.com:8080
trace: true
```

### DB Runner: Query a database

Use dsn (Data Source Name) to specify DB Runner.
Expand All @@ -891,6 +921,7 @@ steps:
desc: Select users # description of step
db: # key to identify the runner. In this case, it is DB Runner.
query: SELECT * FROM users; # query to execute
trace: false # add comment with trace token to query for tracing
```

See [testdata/book/db.yml](testdata/book/db.yml).
Expand Down Expand Up @@ -924,6 +955,15 @@ otherwise it records `last_insert_id` and `rows_affected` .
rows_affected: 1 # current.rows_affected
```
#### Add comment with trace token to query for tracing
``` yaml
runners:
db:
dsn: mysql://dbuser:dbpass@hostname:3306/dbname
trace: true
``

This comment has been minimized.

Copy link
@masaru-b-cl

masaru-b-cl Feb 27, 2024

@k1LoW
'`' が一つ抜けているようで、以後の「#### Support Databases」あたりの表示がおかしくなっていました

This comment has been minimized.

Copy link
@k1LoW

k1LoW Feb 27, 2024

Author Owner

Thank you!!!!!! ありがとうございます!


#### Support Databases

**PostgreSQL:**
Expand Down
2 changes: 1 addition & 1 deletion option.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ func Force(enable bool) Option {
}
}

// Trace - Trace all steps by default.
// Trace - Add tokens for tracing to headers and queries by default.
func Trace(enable bool) Option {
return func(bk *book) error {
if !bk.trace {
Expand Down

0 comments on commit 5dce055

Please sign in to comment.