mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
chore: track the first time html is served in telemetry (#16334)
Addresses https://github.com/coder/nexus/issues/175. ## Changes - Adds the `telemetry_items` database table. It's a key value store for telemetry events that don't fit any other database tables. - Adds a telemetry report when HTML is served for the first time in `site.go`.
This commit is contained in:
@ -964,7 +964,7 @@ func TestServer(t *testing.T) {
|
||||
server := httptest.NewServer(r)
|
||||
defer server.Close()
|
||||
|
||||
inv, _ := clitest.New(t,
|
||||
inv, cfg := clitest.New(t,
|
||||
"server",
|
||||
"--in-memory",
|
||||
"--http-address", ":0",
|
||||
@ -977,6 +977,25 @@ func TestServer(t *testing.T) {
|
||||
|
||||
<-deployment
|
||||
<-snapshot
|
||||
|
||||
accessURL := waitAccessURL(t, cfg)
|
||||
|
||||
ctx := testutil.Context(t, testutil.WaitMedium)
|
||||
client := codersdk.New(accessURL)
|
||||
body, err := client.Request(ctx, http.MethodGet, "/", nil)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, body.Body.Close())
|
||||
|
||||
require.Eventually(t, func() bool {
|
||||
snap := <-snapshot
|
||||
htmlFirstServedFound := false
|
||||
for _, item := range snap.TelemetryItems {
|
||||
if item.Key == string(telemetry.TelemetryItemKeyHTMLFirstServedAt) {
|
||||
htmlFirstServedFound = true
|
||||
}
|
||||
}
|
||||
return htmlFirstServedFound
|
||||
}, testutil.WaitMedium, testutil.IntervalFast, "no html_first_served telemetry item")
|
||||
})
|
||||
t.Run("Prometheus", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
Reference in New Issue
Block a user