Skip to content

feat: add telemetry to user-scoped tailnet API call #17065

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
Changes from 1 commit
Commits
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
fix lint, simplify fakeTelemetry
  • Loading branch information
spikecurtis committed Mar 24, 2025
commit ade1a654f44fb32c0d0a819ba9be5dd23c04d470
14 changes: 4 additions & 10 deletions coderd/workspaceagents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2137,6 +2137,7 @@ func TestOwnedWorkspacesCoordinate(t *testing.T) {
logger := testutil.Logger(t)

fTelemetry := newFakeTelemetryReporter(ctx, t, 200)
fTelemetry.enabled = false
firstClient, _, api := coderdtest.NewWithAPI(t, &coderdtest.Options{
Coordinator: tailnet.NewCoordinator(logger),
TelemetryReporter: fTelemetry,
Expand All @@ -2147,10 +2148,8 @@ func TestOwnedWorkspacesCoordinate(t *testing.T) {
// Create a workspace with an agent
firstWorkspace := buildWorkspaceWithAgent(t, member, firstUser.OrganizationID, memberUser.ID, api.Database, api.Pubsub)

// clean out telemetry snapshots from the setup; we don't care about them for this test
for len(fTelemetry.snapshots) != 0 {
<-fTelemetry.snapshots
}
// enable telemetry now that workspace is built; we don't care about snapshots before this.
fTelemetry.enabled = true

u, err := member.URL.Parse("/api/v2/tailnet")
require.NoError(t, err)
Expand Down Expand Up @@ -2413,10 +2412,5 @@ func (f *fakeTelemetryReporter) Enabled() bool {
return f.enabled
}

// SetEnabled allows controlling whether the reporter is enabled.
func (f *fakeTelemetryReporter) SetEnabled(enabled bool) {
f.enabled = enabled
}

// Close implements the telemetry.Reporter interface.
func (f *fakeTelemetryReporter) Close() {}
func (*fakeTelemetryReporter) Close() {}
Loading