-
Notifications
You must be signed in to change notification settings - Fork 881
chore: track the first time html is served in telemetry #16334
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
Conversation
24b1f2a
to
63246e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM
Nothing major that needs fixing
cli/server_test.go
Outdated
|
||
accessURL := waitAccessURL(t, cfg) | ||
|
||
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitMedium) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitMedium) | |
ctx := testutil.Context(t, testutil.WaitMedium) |
coderd/telemetry/telemetry.go
Outdated
@@ -1536,6 +1557,20 @@ type Organization struct { | |||
CreatedAt time.Time `json:"created_at"` | |||
} | |||
|
|||
//revive:disable:exported | |||
type TelemetryItemKey string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why this has to be exported; can you elaborate pls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a habit that when I export enum values, I export their type too. It's not strictly necessary here.
// The purpose is to track the first time the first user opens the site. | ||
func (h *Handler) reportHTMLFirstServedAt() { | ||
// nolint:gocritic // Manipulating telemetry items is system-restricted. | ||
ctx := dbauthz.AsSystemRestricted(context.Background()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a TODO to add a telemetry context in RBAC at some point.
site/site.go
Outdated
@@ -183,6 +187,8 @@ type Handler struct { | |||
|
|||
Entitlements *entitlements.Set | |||
Experiments atomic.Pointer[codersdk.Experiments] | |||
|
|||
TelemetryHTMLServedOnce sync.Once |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this exported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't need to be - thanks for catching it.
Addresses https://github.com/coder/nexus/issues/175.
Changes
telemetry_items
database table. It's a key value store for telemetry events that don't fit any other database tables.site.go
.