feat(coderd): return agent script timings (#14923)

Add the agent script timings into the
`/workspacebuilds/:workspacebuild/timings` response.

Close https://github.com/coder/coder/issues/14876
This commit is contained in:
Bruno Quaresma
2024-10-14 09:31:03 -03:00
committed by GitHub
parent 79d24d2101
commit 9c8ecb82a3
23 changed files with 982 additions and 296 deletions
+57
View File
@@ -991,6 +991,63 @@ curl -X GET http://coder-server:8080/api/v2/workspacebuilds/{workspacebuild}/sta
To perform this operation, you must be authenticated. [Learn more](authentication.md).
## Get workspace build timings by ID
### Code samples
```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/workspacebuilds/{workspacebuild}/timings \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
`GET /workspacebuilds/{workspacebuild}/timings`
### Parameters
| Name | In | Type | Required | Description |
| ---------------- | ---- | ------------ | -------- | ------------------ |
| `workspacebuild` | path | string(uuid) | true | Workspace build ID |
### Example responses
> 200 Response
```json
{
"agent_script_timings": [
{
"display_name": "string",
"ended_at": "2019-08-24T14:15:22Z",
"exit_code": 0,
"stage": "string",
"started_at": "2019-08-24T14:15:22Z",
"status": "string"
}
],
"provisioner_timings": [
{
"action": "string",
"ended_at": "2019-08-24T14:15:22Z",
"job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f",
"resource": "string",
"source": "string",
"stage": "string",
"started_at": "2019-08-24T14:15:22Z"
}
]
}
```
### Responses
| Status | Meaning | Description | Schema |
| ------ | ------------------------------------------------------- | ----------- | -------------------------------------------------------------------------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.WorkspaceBuildTimings](schemas.md#codersdkworkspacebuildtimings) |
To perform this operation, you must be authenticated. [Learn more](authentication.md).
## Get workspace builds by workspace ID
### Code samples
+59 -24
View File
@@ -349,6 +349,30 @@
| --------- | ------ | -------- | ------------ | ----------- |
| `license` | string | true | | |
## codersdk.AgentScriptTiming
```json
{
"display_name": "string",
"ended_at": "2019-08-24T14:15:22Z",
"exit_code": 0,
"stage": "string",
"started_at": "2019-08-24T14:15:22Z",
"status": "string"
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
| -------------- | ------- | -------- | ------------ | ----------- |
| `display_name` | string | false | | |
| `ended_at` | string | false | | |
| `exit_code` | integer | false | | |
| `stage` | string | false | | |
| `started_at` | string | false | | |
| `status` | string | false | | |
## codersdk.AgentSubsystem
```json
@@ -7348,6 +7372,41 @@ If the schedule is empty, the user will be updated to use the default schedule.|
| `name` | string | false | | |
| `value` | string | false | | |
## codersdk.WorkspaceBuildTimings
```json
{
"agent_script_timings": [
{
"display_name": "string",
"ended_at": "2019-08-24T14:15:22Z",
"exit_code": 0,
"stage": "string",
"started_at": "2019-08-24T14:15:22Z",
"status": "string"
}
],
"provisioner_timings": [
{
"action": "string",
"ended_at": "2019-08-24T14:15:22Z",
"job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f",
"resource": "string",
"source": "string",
"stage": "string",
"started_at": "2019-08-24T14:15:22Z"
}
]
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
| ---------------------- | ----------------------------------------------------------------- | -------- | ------------ | ----------- |
| `agent_script_timings` | array of [codersdk.AgentScriptTiming](#codersdkagentscripttiming) | false | | |
| `provisioner_timings` | array of [codersdk.ProvisionerTiming](#codersdkprovisionertiming) | false | | |
## codersdk.WorkspaceConnectionLatencyMS
```json
@@ -7675,30 +7734,6 @@ If the schedule is empty, the user will be updated to use the default schedule.|
| `deleting` |
| `deleted` |
## codersdk.WorkspaceTimings
```json
{
"provisioner_timings": [
{
"action": "string",
"ended_at": "2019-08-24T14:15:22Z",
"job_id": "453bd7d7-5355-4d6d-a38e-d9e7eb218c3f",
"resource": "string",
"source": "string",
"stage": "string",
"started_at": "2019-08-24T14:15:22Z"
}
]
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
| --------------------- | ----------------------------------------------------------------- | -------- | ------------ | ----------- |
| `provisioner_timings` | array of [codersdk.ProvisionerTiming](#codersdkprovisionertiming) | false | | |
## codersdk.WorkspaceTransition
```json
+13 -3
View File
@@ -1641,6 +1641,16 @@ curl -X GET http://coder-server:8080/api/v2/workspaces/{workspace}/timings \
```json
{
"agent_script_timings": [
{
"display_name": "string",
"ended_at": "2019-08-24T14:15:22Z",
"exit_code": 0,
"stage": "string",
"started_at": "2019-08-24T14:15:22Z",
"status": "string"
}
],
"provisioner_timings": [
{
"action": "string",
@@ -1657,9 +1667,9 @@ curl -X GET http://coder-server:8080/api/v2/workspaces/{workspace}/timings \
### Responses
| Status | Meaning | Description | Schema |
| ------ | ------------------------------------------------------- | ----------- | ---------------------------------------------------------------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.WorkspaceTimings](schemas.md#codersdkworkspacetimings) |
| Status | Meaning | Description | Schema |
| ------ | ------------------------------------------------------- | ----------- | -------------------------------------------------------------------------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.WorkspaceBuildTimings](schemas.md#codersdkworkspacebuildtimings) |
To perform this operation, you must be authenticated. [Learn more](authentication.md).