Skip to content

Commit 6516216

Browse files
committed
API contract
1 parent c000f2e commit 6516216

File tree

4 files changed

+91
-14
lines changed

4 files changed

+91
-14
lines changed

coderd/apidoc/docs.go

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codersdk/agentsdk/agentsdk.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,15 @@ type Stats struct {
483483
// SessionCountSSH is the number of connections received by an agent
484484
// that are normal, non-tagged SSH sessions.
485485
SessionCountSSH int64 `json:"session_count_ssh"`
486+
487+
// Metrics collected by the agent
488+
Metrics []AgentMetric `json:"metrics"`
489+
}
490+
491+
type AgentMetric struct {
492+
Name string `json:"name"`
493+
Type string `json:"type"`
494+
Value float64 `json:"value"`
486495
}
487496

488497
type StatsResponse struct {

docs/api/schemas.md

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,24 @@
1616
| `document` | string | true | | |
1717
| `signature` | string | true | | |
1818

19+
## agentsdk.AgentMetric
20+
21+
```json
22+
{
23+
"name": "string",
24+
"type": "string",
25+
"value": 0
26+
}
27+
```
28+
29+
### Properties
30+
31+
| Name | Type | Required | Restrictions | Description |
32+
| ------- | ------ | -------- | ------------ | ----------- |
33+
| `name` | string | false | | |
34+
| `type` | string | false | | |
35+
| `value` | number | false | | |
36+
1937
## agentsdk.AuthenticateResponse
2038

2139
```json
@@ -326,6 +344,13 @@
326344
"property1": 0,
327345
"property2": 0
328346
},
347+
"metrics": [
348+
{
349+
"name": "string",
350+
"type": "string",
351+
"value": 0
352+
}
353+
],
329354
"rx_bytes": 0,
330355
"rx_packets": 0,
331356
"session_count_jetbrains": 0,
@@ -339,20 +364,21 @@
339364

340365
### Properties
341366

342-
| Name | Type | Required | Restrictions | Description |
343-
| -------------------------------- | ------- | -------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------- |
344-
| `connection_count` | integer | false | | Connection count is the number of connections received by an agent. |
345-
| `connection_median_latency_ms` | number | false | | Connection median latency ms is the median latency of all connections in milliseconds. |
346-
| `connections_by_proto` | object | false | | Connections by proto is a count of connections by protocol. |
347-
| » `[any property]` | integer | false | | |
348-
| `rx_bytes` | integer | false | | Rx bytes is the number of received bytes. |
349-
| `rx_packets` | integer | false | | Rx packets is the number of received packets. |
350-
| `session_count_jetbrains` | integer | false | | Session count jetbrains is the number of connections received by an agent that are from our JetBrains extension. |
351-
| `session_count_reconnecting_pty` | integer | false | | Session count reconnecting pty is the number of connections received by an agent that are from the reconnecting web terminal. |
352-
| `session_count_ssh` | integer | false | | Session count ssh is the number of connections received by an agent that are normal, non-tagged SSH sessions. |
353-
| `session_count_vscode` | integer | false | | Session count vscode is the number of connections received by an agent that are from our VS Code extension. |
354-
| `tx_bytes` | integer | false | | Tx bytes is the number of transmitted bytes. |
355-
| `tx_packets` | integer | false | | Tx packets is the number of transmitted bytes. |
367+
| Name | Type | Required | Restrictions | Description |
368+
| -------------------------------- | ----------------------------------------------------- | -------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------- |
369+
| `connection_count` | integer | false | | Connection count is the number of connections received by an agent. |
370+
| `connection_median_latency_ms` | number | false | | Connection median latency ms is the median latency of all connections in milliseconds. |
371+
| `connections_by_proto` | object | false | | Connections by proto is a count of connections by protocol. |
372+
| » `[any property]` | integer | false | | |
373+
| `metrics` | array of [agentsdk.AgentMetric](#agentsdkagentmetric) | false | | Metrics collected by the agent |
374+
| `rx_bytes` | integer | false | | Rx bytes is the number of received bytes. |
375+
| `rx_packets` | integer | false | | Rx packets is the number of received packets. |
376+
| `session_count_jetbrains` | integer | false | | Session count jetbrains is the number of connections received by an agent that are from our JetBrains extension. |
377+
| `session_count_reconnecting_pty` | integer | false | | Session count reconnecting pty is the number of connections received by an agent that are from the reconnecting web terminal. |
378+
| `session_count_ssh` | integer | false | | Session count ssh is the number of connections received by an agent that are normal, non-tagged SSH sessions. |
379+
| `session_count_vscode` | integer | false | | Session count vscode is the number of connections received by an agent that are from our VS Code extension. |
380+
| `tx_bytes` | integer | false | | Tx bytes is the number of transmitted bytes. |
381+
| `tx_packets` | integer | false | | Tx packets is the number of transmitted bytes. |
356382

357383
## agentsdk.StatsResponse
358384

0 commit comments

Comments
 (0)