Skip to content

Commit a3d87b8

Browse files
committed
Address most review comments
1 parent eb373d6 commit a3d87b8

File tree

6 files changed

+12
-15
lines changed

6 files changed

+12
-15
lines changed

coderd/database/migrations/000042_agent_stats.up.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
CREATE TABLE agent_stats (
2-
id uuid NOT NULL,
3-
PRIMARY KEY (id),
2+
id uuid NOT NULL,
3+
PRIMARY KEY (id),
44
created_at timestamptz NOT NULL,
55
user_id uuid NOT NULL,
66
agent_id uuid NOT NULL,
77
workspace_id uuid NOT NULL,
88
template_id uuid NOT NULL,
9-
payload jsonb NOT NULL
9+
payload jsonb NOT NULL
1010
);
1111

1212
-- We use created_at for DAU analysis and pruning.

codersdk/metrics.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ type AgentStatsReportRequest struct {
139139
// request by the agent.
140140
type AgentStatsReportResponse struct {
141141
NumConns int64 `json:"num_comms"`
142-
RxBytes int64 `json:"rx_bytes"`
143-
TxBytes int64 `json:"tx_bytes"`
142+
// RxBytes is the number of received bytes.
143+
RxBytes int64 `json:"rx_bytes"`
144+
// TxBytes is the number of received bytes.
145+
TxBytes int64 `json:"tx_bytes"`
144146
}

site/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@
4848
"history": "5.3.0",
4949
"i18next": "21.9.1",
5050
"just-debounce-it": "3.0.1",
51-
"moment": "^2.29.4",
5251
"react": "18.2.0",
5352
"react-chartjs-2": "^4.3.1",
5453
"react-dom": "18.2.0",
55-
"react-helmet-async": "^1.3.0",
54+
"react-helmet-async": "1.3.0",
5655
"react-i18next": "11.18.4",
5756
"react-markdown": "8.0.3",
5857
"react-router-dom": "^6.3.0",

site/src/pages/TemplatePage/DAUChart.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { DAUChart, Language } from "./DAUChart"
44
import { screen } from "@testing-library/react"
55
import { ResizeObserver } from "resize-observer"
66

7+
// The Chart performs dynamic resizes which fail in tests without this.
78
Object.defineProperty(window, "ResizeObserver", {
89
value: ResizeObserver,
910
})

site/src/pages/TemplatePage/DAUChart.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
import { Stack } from "components/Stack/Stack"
1818
import { HelpTooltip, HelpTooltipText, HelpTooltipTitle } from "components/Tooltips/HelpTooltip"
1919
import { WorkspaceSection } from "components/WorkspaceSection/WorkspaceSection"
20-
import moment from "moment"
20+
import dayjs from "dayjs"
2121
import { FC } from "react"
2222
import { Line } from "react-chartjs-2"
2323
import * as TypesGen from "../../api/typesGenerated"
@@ -55,7 +55,7 @@ export const DAUChart: FC<DAUChartProps> = ({ templateDAUs: templateMetricsData
5555
}
5656

5757
const labels = templateMetricsData.entries.map((val) => {
58-
return moment(val.date).format("l")
58+
return dayjs(val.date).format("YYYY-MM-DD")
5959
})
6060

6161
const data = templateMetricsData.entries.map((val) => {

site/yarn.lock

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10386,11 +10386,6 @@ mock-socket@^9.1.0:
1038610386
resolved "https://registry.yarnpkg.com/mock-socket/-/mock-socket-9.1.5.tgz#2c4e44922ad556843b6dfe09d14ed8041fa2cdeb"
1038710387
integrity sha512-3DeNIcsQixWHHKk6NdoBhWI4t1VMj5/HzfnI1rE/pLl5qKx7+gd4DNA07ehTaZ6MoUU053si6Hd+YtiM/tQZfg==
1038810388

10389-
moment@^2.29.4:
10390-
version "2.29.4"
10391-
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
10392-
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==
10393-
1039410389
moo-color@^1.0.2:
1039510390
version "1.0.3"
1039610391
resolved "https://registry.yarnpkg.com/moo-color/-/moo-color-1.0.3.tgz#d56435f8359c8284d83ac58016df7427febece74"
@@ -11899,7 +11894,7 @@ react-fast-compare@^3.0.1, react-fast-compare@^3.2.0:
1189911894
resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb"
1190011895
integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==
1190111896

11902-
react-helmet-async@^1.0.7, react-helmet-async@^1.3.0:
11897+
react-helmet-async@1.3.0, react-helmet-async@^1.0.7:
1190311898
version "1.3.0"
1190411899
resolved "https://registry.yarnpkg.com/react-helmet-async/-/react-helmet-async-1.3.0.tgz#7bd5bf8c5c69ea9f02f6083f14ce33ef545c222e"
1190511900
integrity sha512-9jZ57/dAn9t3q6hneQS0wukqC2ENOBgMNVEhb/ZG9ZSxUetzVIw4iAmEU38IaVg3QGYauQPhSeUTuIUtFglWpg==

0 commit comments

Comments
 (0)