Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit568c16f

Browse files
committed
Fix response structure
1 parent3d70b2a commit568c16f

File tree

10 files changed

+138
-115
lines changed

10 files changed

+138
-115
lines changed

‎coderd/apidoc/docs.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/metricscache/metricscache.go

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -235,23 +235,26 @@ func (c *Cache) refreshDeploymentStats(ctx context.Context) error {
235235
c.deploymentStatsResponse.Store(&codersdk.DeploymentStats{
236236
AggregatedFrom:from,
237237
CollectedAt:database.Now(),
238-
RefreshingAt:database.Now().Add(c.intervals.DeploymentStats),
239-
WorkspaceConnectionLatencyMS: codersdk.WorkspaceConnectionLatencyMS{
240-
P50:agentStats.WorkspaceConnectionLatency50,
241-
P95:agentStats.WorkspaceConnectionLatency95,
238+
NextUpdateAt:database.Now().Add(c.intervals.DeploymentStats),
239+
Workspaces: codersdk.WorkspaceDeploymentStats{
240+
Pending:workspaceStats.PendingWorkspaces,
241+
Building:workspaceStats.BuildingWorkspaces,
242+
Running:workspaceStats.RunningWorkspaces,
243+
Failed:workspaceStats.FailedWorkspaces,
244+
Stopped:workspaceStats.StoppedWorkspaces,
245+
ConnectionLatencyMS: codersdk.WorkspaceConnectionLatencyMS{
246+
P50:agentStats.WorkspaceConnectionLatency50,
247+
P95:agentStats.WorkspaceConnectionLatency95,
248+
},
249+
RxBytes:agentStats.WorkspaceRxBytes,
250+
TxBytes:agentStats.WorkspaceTxBytes,
251+
},
252+
SessionCount: codersdk.SessionCountDeploymentStats{
253+
VSCode:agentStats.SessionCountVSCode,
254+
SSH:agentStats.SessionCountSSH,
255+
JetBrains:agentStats.SessionCountJetBrains,
256+
ReconnectingPTY:agentStats.SessionCountReconnectingPTY,
242257
},
243-
SessionCountVSCode:agentStats.SessionCountVSCode,
244-
SessionCountSSH:agentStats.SessionCountSSH,
245-
SessionCountJetBrains:agentStats.SessionCountJetBrains,
246-
SessionCountReconnectingPTY:agentStats.SessionCountReconnectingPTY,
247-
WorkspaceRxBytes:agentStats.WorkspaceRxBytes,
248-
WorkspaceTxBytes:agentStats.WorkspaceTxBytes,
249-
250-
PendingWorkspaces:workspaceStats.PendingWorkspaces,
251-
BuildingWorkspaces:workspaceStats.BuildingWorkspaces,
252-
RunningWorkspaces:workspaceStats.RunningWorkspaces,
253-
FailedWorkspaces:workspaceStats.FailedWorkspaces,
254-
StoppedWorkspaces:workspaceStats.StoppedWorkspaces,
255258
})
256259
returnnil
257260
}

‎coderd/metricscache/metricscache_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,5 +399,5 @@ func TestCache_DeploymentStats(t *testing.T) {
399399
stat,ok=cache.DeploymentStats()
400400
returnok
401401
},testutil.WaitLong,testutil.IntervalMedium)
402-
require.Equal(t,int64(1),stat.SessionCountVSCode)
402+
require.Equal(t,int64(1),stat.SessionCount.VSCode)
403403
}

‎codersdk/deployment.go

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,29 +1532,35 @@ type WorkspaceConnectionLatencyMS struct {
15321532
P95float64
15331533
}
15341534

1535+
typeWorkspaceDeploymentStatsstruct {
1536+
Pendingint64`json:"pending"`
1537+
Buildingint64`json:"building"`
1538+
Runningint64`json:"running"`
1539+
Failedint64`json:"failed"`
1540+
Stoppedint64`json:"stopped"`
1541+
1542+
ConnectionLatencyMSWorkspaceConnectionLatencyMS`json:"connection_latency_ms"`
1543+
RxBytesint64`json:"rx_bytes"`
1544+
TxBytesint64`json:"tx_bytes"`
1545+
}
1546+
1547+
typeSessionCountDeploymentStatsstruct {
1548+
VSCodeint64`json:"vscode"`
1549+
SSHint64`json:"ssh"`
1550+
JetBrainsint64`json:"jetbrains"`
1551+
ReconnectingPTYint64`json:"reconnecting_pty"`
1552+
}
1553+
15351554
typeDeploymentStatsstruct {
15361555
// AggregatedFrom is the time in which stats are aggregated from.
15371556
// This might be back in time a specific duration or interval.
1538-
AggregatedFrom time.Time`json:"aggregated_since" format:"date-time"`
1557+
AggregatedFrom time.Time`json:"aggregated_from" format:"date-time"`
15391558
// CollectedAt is the time in which stats are collected at.
15401559
CollectedAt time.Time`json:"collected_at" format:"date-time"`
1541-
// RefreshingAt is the time when the next batch of stats will
1542-
// be refreshed.
1543-
RefreshingAt time.Time`json:"refreshing_at" format:"date-time"`
1544-
1545-
PendingWorkspacesint64`json:"pending_workspaces"`
1546-
BuildingWorkspacesint64`json:"building_workspaces"`
1547-
RunningWorkspacesint64`json:"running_workspaces"`
1548-
FailedWorkspacesint64`json:"failed_workspaces"`
1549-
StoppedWorkspacesint64`json:"stopped_workspaces"`
1550-
1551-
WorkspaceConnectionLatencyMSWorkspaceConnectionLatencyMS`json:"workspace_connection_latency_ms"`
1552-
1553-
SessionCountVSCodeint64`json:"session_count_vscode"`
1554-
SessionCountSSHint64`json:"session_count_ssh"`
1555-
SessionCountJetBrainsint64`json:"session_count_jetbrains"`
1556-
SessionCountReconnectingPTYint64`json:"session_count_reconnecting_pty"`
1560+
// NextUpdateAt is the time when the next batch of stats will
1561+
// be updated.
1562+
NextUpdateAt time.Time`json:"next_update_at" format:"date-time"`
15571563

1558-
WorkspaceRxBytesint64`json:"workspace_rx_bytes"`
1559-
WorkspaceTxBytesint64`json:"workspace_tx_bytes"`
1564+
WorkspacesWorkspaceDeploymentStats`json:"workspaces"`
1565+
SessionCountSessionCountDeploymentStats`json:"session_count"`
15601566
}

‎docs/api/general.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,12 @@ curl -X GET http://coder-server:8080/api/v2/deployment/stats \
416416
417417
```json
418418
{
419-
"aggregated_since":"2019-08-24T14:15:22Z",
419+
"aggregated_from":"2019-08-24T14:15:22Z",
420420
"building_workspaces":0,
421421
"collected_at":"2019-08-24T14:15:22Z",
422422
"failed_workspaces":0,
423+
"next_update_at":"2019-08-24T14:15:22Z",
423424
"pending_workspaces":0,
424-
"refreshing_at":"2019-08-24T14:15:22Z",
425425
"running_workspaces":0,
426426
"session_count_jetbrains":0,
427427
"session_count_reconnecting_pty":0,

‎docs/api/schemas.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,12 +1951,12 @@ CreateParameterRequest is a structure used to create a new parameter value for a
19511951

19521952
```json
19531953
{
1954-
"aggregated_since":"2019-08-24T14:15:22Z",
1954+
"aggregated_from":"2019-08-24T14:15:22Z",
19551955
"building_workspaces":0,
19561956
"collected_at":"2019-08-24T14:15:22Z",
19571957
"failed_workspaces":0,
1958+
"next_update_at":"2019-08-24T14:15:22Z",
19581959
"pending_workspaces":0,
1959-
"refreshing_at":"2019-08-24T14:15:22Z",
19601960
"running_workspaces":0,
19611961
"session_count_jetbrains":0,
19621962
"session_count_reconnecting_pty":0,
@@ -1974,23 +1974,23 @@ CreateParameterRequest is a structure used to create a new parameter value for a
19741974

19751975
###Properties
19761976

1977-
| Name| Type| Required| Restrictions| Description|
1978-
| ---------------------------------| ------------------------------------------------------------------------------| --------| ------------| ----------------------------------------------------------------------------------------------------------------------------|
1979-
|`aggregated_since`| string| false|| Aggregatedsince is the time in which stats are aggregated from. This might be back in time a specific duration or interval.|
1980-
|`building_workspaces`| integer| false|||
1981-
|`collected_at`| string| false|| Collected at is the time in which stats are collected at.|
1982-
|`failed_workspaces`| integer| false|||
1983-
|`pending_workspaces`| integer| false|||
1984-
|`refreshing_at`| string| false|| Refreshing at is the time when the next batch of stats will be refreshed.|
1985-
|`running_workspaces`| integer| false|||
1986-
|`session_count_jetbrains`| integer| false|||
1987-
|`session_count_reconnecting_pty`| integer| false|||
1988-
|`session_count_ssh`| integer| false|||
1989-
|`session_count_vscode`| integer| false|||
1990-
|`stopped_workspaces`| integer| false|||
1991-
|`workspace_connection_latency_ms`|[codersdk.WorkspaceConnectionLatencyMS](#codersdkworkspaceconnectionlatencyms)| false|||
1992-
|`workspace_rx_bytes`| integer| false|||
1993-
|`workspace_tx_bytes`| integer| false|||
1977+
| Name| Type| Required| Restrictions| Description|
1978+
| ---------------------------------| ------------------------------------------------------------------------------| --------| ------------| ---------------------------------------------------------------------------------------------------------------------------|
1979+
|`aggregated_from`| string| false|| Aggregatedfrom is the time in which stats are aggregated from. This might be back in time a specific duration or interval.|
1980+
|`building_workspaces`| integer| false|||
1981+
|`collected_at`| string| false|| Collected at is the time in which stats are collected at.|
1982+
|`failed_workspaces`| integer| false|||
1983+
|`next_update_at`| string|false|| Next update at is the time when the next batch of stats will be updated.|
1984+
|`pending_workspaces`| integer| false|||
1985+
|`running_workspaces`| integer| false|||
1986+
|`session_count_jetbrains`| integer| false|||
1987+
|`session_count_reconnecting_pty`| integer| false|||
1988+
|`session_count_ssh`| integer| false|||
1989+
|`session_count_vscode`| integer| false|||
1990+
|`stopped_workspaces`| integer| false|||
1991+
|`workspace_connection_latency_ms`|[codersdk.WorkspaceConnectionLatencyMS](#codersdkworkspaceconnectionlatencyms)| false|||
1992+
|`workspace_rx_bytes`| integer| false|||
1993+
|`workspace_tx_bytes`| integer| false|||
19941994

19951995
##codersdk.DeploymentValues
19961996

‎site/src/api/typesGenerated.ts

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -314,21 +314,11 @@ export interface DeploymentDAUsResponse {
314314

315315
// From codersdk/deployment.go
316316
exportinterfaceDeploymentStats{
317-
readonlyaggregated_since:string
317+
readonlyaggregated_from:string
318318
readonlycollected_at:string
319-
readonlyrefreshing_at:string
320-
readonlypending_workspaces:number
321-
readonlybuilding_workspaces:number
322-
readonlyrunning_workspaces:number
323-
readonlyfailed_workspaces:number
324-
readonlystopped_workspaces:number
325-
readonlyworkspace_connection_latency_ms:WorkspaceConnectionLatencyMS
326-
readonlysession_count_vscode:number
327-
readonlysession_count_ssh:number
328-
readonlysession_count_jetbrains:number
329-
readonlysession_count_reconnecting_pty:number
330-
readonlyworkspace_rx_bytes:number
331-
readonlyworkspace_tx_bytes:number
319+
readonlynext_update_at:string
320+
readonlyworkspaces:WorkspaceDeploymentStats
321+
readonlysession_count:SessionCountDeploymentStats
332322
}
333323

334324
// From codersdk/deployment.go
@@ -753,6 +743,14 @@ export interface ServiceBannerConfig {
753743
readonlybackground_color?:string
754744
}
755745

746+
// From codersdk/deployment.go
747+
exportinterfaceSessionCountDeploymentStats{
748+
readonlyvscode:number
749+
readonlyssh:number
750+
readonlyjetbrains:number
751+
readonlyreconnecting_pty:number
752+
}
753+
756754
// From codersdk/deployment.go
757755
exportinterfaceSupportConfig{
758756
// Named type "github.com/coder/coder/cli/clibase.Struct[[]github.com/coder/coder/codersdk.LinkConfig]" unknown, using "any"
@@ -1169,6 +1167,18 @@ export interface WorkspaceConnectionLatencyMS {
11691167
readonlyP95:number
11701168
}
11711169

1170+
// From codersdk/deployment.go
1171+
exportinterfaceWorkspaceDeploymentStats{
1172+
readonlypending:number
1173+
readonlybuilding:number
1174+
readonlyrunning:number
1175+
readonlyfailed:number
1176+
readonlystopped:number
1177+
readonlyconnection_latency_ms:WorkspaceConnectionLatencyMS
1178+
readonlyrx_bytes:number
1179+
readonlytx_bytes:number
1180+
}
1181+
11721182
// From codersdk/workspaces.go
11731183
exportinterfaceWorkspaceFilter{
11741184
readonlyq?:string

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp