Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fbb2a6a

Browse files
refactor(coderd): add avatar URL to the users' latency endpoint (#8701)
1 parent 7004013 commit fbb2a6a

File tree

10 files changed

+28
-7
lines changed

10 files changed

+28
-7
lines changed

coderd/apidoc/docs.go

Lines changed: 4 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: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/dbfake/dbfake.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2369,6 +2369,7 @@ func (q *FakeQuerier) GetUserLatencyInsights(_ context.Context, arg database.Get
23692369
row := database.GetUserLatencyInsightsRow{
23702370
UserID: userID,
23712371
Username: user.Username,
2372+
AvatarURL: user.AvatarURL,
23722373
TemplateIDs: templateIDs,
23732374
WorkspaceConnectionLatency50: tryPercentile(latencies, 50),
23742375
WorkspaceConnectionLatency95: tryPercentile(latencies, 95),

coderd/database/queries.sql.go

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

coderd/database/queries/insights.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
SELECT
77
workspace_agent_stats.user_id,
88
users.username,
9+
users.avatar_url,
910
array_agg(DISTINCT template_id)::uuid[] AS template_ids,
1011
coalesce((PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY connection_median_latency_ms)), -1)::FLOAT AS workspace_connection_latency_50,
1112
coalesce((PERCENTILE_CONT(0.95) WITHIN GROUP (ORDER BY connection_median_latency_ms)), -1)::FLOAT AS workspace_connection_latency_95
@@ -17,7 +18,7 @@ WHERE
1718
AND workspace_agent_stats.connection_median_latency_ms > 0
1819
AND workspace_agent_stats.connection_count > 0
1920
AND CASE WHEN COALESCE(array_length(@template_ids::uuid[], 1), 0) > 0 THEN template_id = ANY(@template_ids::uuid[]) ELSE TRUE END
20-
GROUP BY workspace_agent_stats.user_id, users.username
21+
GROUP BY workspace_agent_stats.user_id, users.username, users.avatar_url
2122
ORDER BY user_id ASC;
2223

2324
-- name: GetTemplateInsights :one

coderd/insights.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ func (api *API) insightsUserLatency(rw http.ResponseWriter, r *http.Request) {
117117
TemplateIDs: row.TemplateIDs,
118118
UserID: row.UserID,
119119
Username: row.Username,
120+
AvatarURL: row.AvatarURL.String,
120121
LatencyMS: codersdk.ConnectionLatency{
121122
P50: row.WorkspaceConnectionLatency50,
122123
P95: row.WorkspaceConnectionLatency95,

codersdk/insights.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type UserLatency struct {
4444
TemplateIDs []uuid.UUID `json:"template_ids" format:"uuid"`
4545
UserID uuid.UUID `json:"user_id" format:"uuid"`
4646
Username string `json:"username"`
47+
AvatarURL string `json:"avatar_url" format:"uri"`
4748
LatencyMS ConnectionLatency `json:"latency_ms"`
4849
}
4950

docs/api/insights.md

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

docs/api/schemas.md

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

site/src/api/typesGenerated.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,7 @@ export interface UserLatency {
11761176
readonly template_ids: string[]
11771177
readonly user_id: string
11781178
readonly username: string
1179+
readonly avatar_url: string
11791180
readonly latency_ms: ConnectionLatency
11801181
}
11811182

0 commit comments

Comments
 (0)