Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion canary-checker/docs/concepts/request-chaining.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ When a check has dependencies, it can access the outputs from those checks using
| `outputs.<checkName>.json` | Parsed JSON response body |
| `outputs.<checkName>.code` | HTTP response code |
| `outputs.<checkName>.headers` | Response headers |
| `outputs.<checkName>.body` | Raw response body |
| `outputs.<checkName>.content` | Raw response body |

### Example: Using Previous Check Output

Expand Down
43 changes: 34 additions & 9 deletions canary-checker/docs/reference/1-http.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,39 @@ The above canary (`http-check.yaml`) is functionally equivalent to `http-check-e

## Template Body Variables

| Name | Scheme |
| ----------------------------- | ------------------- |
| `metadata.name` | string |
| `metadata.namespace` | _string_ |
| `metadata.labels` | _map[string]string_ |
| `{fields from []envVars}` | any |

Variables defined in `envVars` are available to template with the name that's configured on the spec.
Eg: In the following spec, the vars `my_secret_path` and `my_secret_var`, defined in `envVars`, are available during templating.
| Name | Description | Scheme |
| --------------------- | ------------------------------ | ------------------- |
| `canary.name` | Canary name | `string` |
| `canary.namespace` | Canary namespace | `string` |
| `canary.labels` | Canary labels | `map[string]string` |
| `canary.id` | Persisted Canary ID | `string` |
| `check.name` | Check name | `string` |
| `check.id` | Check ID | `string` |
| `check.description` | Check description | `string` |
| `check.labels` | Check labels | `map[string]string` |
| `check.endpoint` | Check endpoint/URL | `string` |
| `{envVar.name}` | Environment variables defined in `env` | `any` |

Variables defined in `env` are available to template with the name that's configured on the spec.
Eg: In the following spec, the var `db`, defined in `env`, is available as `{{.db}}` during templating.

### Dependency Output Variables

When an HTTP check has [`dependsOn`](../concepts/request-chaining) configured, the `outputs` variable is available for templating. It contains the results from all dependency checks that have completed successfully.

| Name | Description | Scheme |
|------|-------------|--------|
| `outputs.<checkName>.pass` | Whether the dependency check passed | `bool` |
| `outputs.<checkName>.message` | Result message from the dependency check | `string` |
| `outputs.<checkName>.duration` | Duration of the dependency check in milliseconds | `int64` |
| `outputs.<checkName>.code` | HTTP response code from the dependency check | `int` |
| `outputs.<checkName>.headers` | Response headers from the dependency check | `map[string]string` |
| `outputs.<checkName>.content` | Raw response body from the dependency check | `string` |
| `outputs.<checkName>.json` | Parsed JSON response from the dependency check (if `Content-Type=application/json`) | `JSON` |
| `outputs.<checkName>.elapsed` | HTTP request duration from the dependency check | `time.Duration` |
| `outputs.<checkName>.sslAge` | Time until SSL certificate expires from the dependency check | `time.Duration` |

See [Request Chaining](../concepts/request-chaining) for examples.

<details summary="Templating request body from env variables">

Expand All @@ -134,6 +158,7 @@ Eg: In the following spec, the vars `my_secret_path` and `my_secret_var`, define

See <CommonLink to="gotemplate" anchor="escaping">Escaping variables</CommonLink>


## Metrics

| **HTTP Check Metrics** | | |
Expand Down