Skip to content

Daily Active User Metrics #3735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
502aa52
agent: add ConnStats
ammario Aug 29, 2022
3893045
agent: add StatsReporter
ammario Aug 29, 2022
c03ad90
Frontend tests pass
ammario Sep 1, 2022
1bd9cec
Split DAUChart into its own file
ammario Sep 1, 2022
e46329b
Get FE tests passing with real data!
ammario Sep 1, 2022
d472b13
Test frontend
ammario Sep 1, 2022
e0295e0
Fix compilation error
ammario Sep 1, 2022
2f1a423
Rename ConnStats to StatsConn
ammario Sep 1, 2022
0a50cc9
continues instead of returns
ammario Sep 1, 2022
7feab5e
Fix some test failures
ammario Sep 1, 2022
a4d2cf7
Redo tests
ammario Sep 1, 2022
52c9d10
Address review comments
ammario Sep 1, 2022
3f9901e
REVAMP — backend tests work
ammario Sep 1, 2022
7840509
Black triangle
ammario Sep 1, 2022
39170cf
Consolidate template state machines
ammario Sep 1, 2022
eb373d6
Move workspaceagent endpoint
ammario Sep 1, 2022
a3d87b8
Address most review comments
ammario Sep 1, 2022
31ba0c6
Improve contrast in chart
ammario Sep 1, 2022
5b906c1
Add more agent tests
ammario Sep 1, 2022
49d9386
Fix JS ci
ammario Sep 1, 2022
b14a077
A bunch of minor touch ups
ammario Sep 1, 2022
8da24c4
Stabilize protoc
ammario Sep 1, 2022
00ec953
Merge remote-tracking branch 'origin/main' into metrics
ammario Sep 1, 2022
4940319
Update lockfile
ammario Sep 1, 2022
22b2028
Address comments + attempt to fix protoc
ammario Sep 1, 2022
0157365
fixup! Address comments + attempt to fix protoc
ammario Sep 1, 2022
b166cdd
Try to fix protoc...
ammario Sep 1, 2022
4201998
PROTO!
ammario Sep 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test frontend
  • Loading branch information
ammario committed Sep 1, 2022
commit d472b13e51822ef397783c0840aeafc3b4d65527
34 changes: 34 additions & 0 deletions site/src/pages/UsersPage/DAUCharts.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { render } from "testHelpers/renderHelpers"
import { DAUChart, Language } from "./DAUCharts"

import { screen } from "@testing-library/react"
import { ResizeObserver } from "resize-observer"

Object.defineProperty(window, "ResizeObserver", {
value: ResizeObserver,
})

describe("DAUChart", () => {
it("renders a helpful paragraph on empty state", async () => {
render(
<DAUChart
userMetricsData={{
entries: [],
}}
/>,
)

await screen.findAllByText(Language.loadingText)
})
it("renders a graph", async () => {
render(
<DAUChart
userMetricsData={{
entries: [{ date: "2020-01-01", daus: 1 }],
}}
/>,
)

await screen.findAllByText(Language.chartTitle)
})
})
12 changes: 7 additions & 5 deletions site/src/pages/UsersPage/DAUCharts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@ ChartJS.register(CategoryScale, LinearScale, PointElement, LineElement, Title, T
export interface DAUChartProps {
userMetricsData: TypesGen.DAUsResponse
}
export const Language = {
loadingText: "DAU stats are loading. Check back later.",
chartTitle: "Daily Active Users",
}

export const DAUChart: FC<DAUChartProps> = ({ userMetricsData }) => {
const theme: Theme = useTheme()

if (userMetricsData.entries.length === 0) {
return (
<div style={{ marginTop: "-20px" }}>
<p>DAU stats are loading. Check back later.</p>
<p>{Language.loadingText}</p>
</div>
)
}
Expand Down Expand Up @@ -73,12 +77,10 @@ export const DAUChart: FC<DAUChartProps> = ({ userMetricsData }) => {
<>
<WorkspaceSection>
<Stack direction="row" spacing={1} alignItems="center">
<h3>Daily Active Users</h3>
<h3>{Language.chartTitle}</h3>
<HelpTooltip size="small">
<HelpTooltipTitle>How do we calculate DAUs?</HelpTooltipTitle>
<HelpTooltipText>
We use daily, unique workspace connection traffic to compute DAUs.
</HelpTooltipText>
<HelpTooltipText>We use workspace connection traffic to compute DAUs.</HelpTooltipText>
</HelpTooltip>
</Stack>
<Line
Expand Down