Skip to content
Merged
Show file tree
Hide file tree
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
Next Next commit
remove GetHTMLFirstServedAt and SetHTMLFirstServedAt
  • Loading branch information
hugodutka committed Jan 30, 2025
commit a6a984f67441d1a40c22592d60c06134f1e181c7
14 changes: 0 additions & 14 deletions coderd/database/dbauthz/dbauthz.go
Original file line number Diff line number Diff line change
Expand Up @@ -2096,13 +2096,6 @@ func (q *querier) GetTailnetTunnelPeerIDs(ctx context.Context, srcID uuid.UUID)
return q.db.GetTailnetTunnelPeerIDs(ctx, srcID)
}

func (q *querier) GetTelemetryHTMLFirstServedAt(ctx context.Context) (string, error) {
if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceSystem); err != nil {
return "", err
}
return q.db.GetTelemetryHTMLFirstServedAt(ctx)
}

func (q *querier) GetTelemetryItem(ctx context.Context, key string) (database.TelemetryItem, error) {
if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceSystem); err != nil {
return database.TelemetryItem{}, err
Expand Down Expand Up @@ -3456,13 +3449,6 @@ func (q *querier) RevokeDBCryptKey(ctx context.Context, activeKeyDigest string)
return q.db.RevokeDBCryptKey(ctx, activeKeyDigest)
}

func (q *querier) SetTelemetryHTMLFirstServedAt(ctx context.Context, value string) error {
if err := q.authorizeContext(ctx, policy.ActionUpdate, rbac.ResourceSystem); err != nil {
return err
}
return q.db.SetTelemetryHTMLFirstServedAt(ctx, value)
}

func (q *querier) TryAcquireLock(ctx context.Context, id int64) (bool, error) {
return q.db.TryAcquireLock(ctx, id)
}
Expand Down
6 changes: 0 additions & 6 deletions coderd/database/dbauthz/dbauthz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4224,12 +4224,6 @@ func (s *MethodTestSuite) TestSystemFunctions() {
s.Run("GetWorkspaceModulesCreatedAfter", s.Subtest(func(db database.Store, check *expects) {
check.Args(dbtime.Now()).Asserts(rbac.ResourceSystem, policy.ActionRead)
}))
s.Run("GetTelemetryHTMLFirstServedAt", s.Subtest(func(db database.Store, check *expects) {
check.Args().Asserts(rbac.ResourceSystem, policy.ActionRead).Errors(sql.ErrNoRows)
}))
s.Run("SetTelemetryHTMLFirstServedAt", s.Subtest(func(db database.Store, check *expects) {
check.Args(time.Now().Format(time.RFC3339)).Asserts(rbac.ResourceSystem, policy.ActionUpdate)
}))
s.Run("GetTelemetryItem", s.Subtest(func(db database.Store, check *expects) {
check.Args("test").Asserts(rbac.ResourceSystem, policy.ActionRead).Errors(sql.ErrNoRows)
}))
Expand Down
20 changes: 0 additions & 20 deletions coderd/database/dbmem/dbmem.go
Original file line number Diff line number Diff line change
Expand Up @@ -4333,16 +4333,6 @@ func (*FakeQuerier) GetTailnetTunnelPeerIDs(context.Context, uuid.UUID) ([]datab
return nil, ErrUnimplemented
}

func (q *FakeQuerier) GetTelemetryHTMLFirstServedAt(ctx context.Context) (string, error) {
q.mutex.RLock()
defer q.mutex.RUnlock()
if q.htmlFirstServedAt == "" {
return "", sql.ErrNoRows
}

return q.htmlFirstServedAt, nil
}

func (q *FakeQuerier) GetTelemetryItem(_ context.Context, key string) (database.TelemetryItem, error) {
q.mutex.RLock()
defer q.mutex.RUnlock()
Expand Down Expand Up @@ -9177,16 +9167,6 @@ func (q *FakeQuerier) RevokeDBCryptKey(_ context.Context, activeKeyDigest string
return sql.ErrNoRows
}

func (q *FakeQuerier) SetTelemetryHTMLFirstServedAt(ctx context.Context, value string) error {
q.mutex.Lock()
defer q.mutex.Unlock()
if q.htmlFirstServedAt != "" {
return nil
}
q.htmlFirstServedAt = value
return nil
}

func (*FakeQuerier) TryAcquireLock(_ context.Context, _ int64) (bool, error) {
return false, xerrors.New("TryAcquireLock must only be called within a transaction")
}
Expand Down
14 changes: 0 additions & 14 deletions coderd/database/dbmetrics/querymetrics.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 0 additions & 29 deletions coderd/database/dbmock/dbmock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions coderd/database/querier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions coderd/database/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions coderd/database/queries/siteconfig.sql
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,3 @@ ON CONFLICT (key) DO UPDATE SET value = $2 WHERE site_configs.key = $1;
-- name: DeleteRuntimeConfig :exec
DELETE FROM site_configs
WHERE site_configs.key = $1;

-- name: SetTelemetryHTMLFirstServedAt :exec
INSERT INTO site_configs (key, value)
VALUES ('telemetry_html_first_served_at', $1)
ON CONFLICT (key) DO NOTHING;

-- name: GetTelemetryHTMLFirstServedAt :one
SELECT value FROM site_configs WHERE key = 'telemetry_html_first_served_at';
12 changes: 0 additions & 12 deletions coderd/telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,18 +330,6 @@ func checkIDPOrgSync(ctx context.Context, db database.Store, values *codersdk.De
return syncConfig.Field != "", nil
}

func getHTMLFirstServedAt(ctx context.Context, db database.Store) (*time.Time, error) {
htmlFirstServedAtStr, err := db.GetTelemetryHTMLFirstServedAt(ctx)
if err != nil {
return nil, xerrors.Errorf("get telemetry html first served at: %w", err)
}
t, err := time.Parse(time.RFC3339, htmlFirstServedAtStr)
if err != nil {
return nil, xerrors.Errorf("parse telemetry html first served at: %w", err)
}
return &t, nil
}

// createSnapshot collects a full snapshot from the database.
func (r *remoteReporter) createSnapshot() (*Snapshot, error) {
var (
Expand Down
Loading