Skip to content

Commit be20e54

Browse files
committed
s/DisableDatabaseStorage/DisableDatabaseInserts
1 parent aa07160 commit be20e54

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

coderd/agentapi/stats_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ func TestUpdateStats(t *testing.T) {
617617
}, labels)
618618
assert.Equal(t, req.Stats.Metrics, metrics)
619619
},
620-
DisableDatabaseStorage: true,
620+
DisableDatabaseInserts: true,
621621
}),
622622
AgentStatsRefreshInterval: 10 * time.Second,
623623
TimeNowFn: func() time.Time {

coderd/coderd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ func New(options *Options) *API {
776776
UsageTracker: options.WorkspaceUsageTracker,
777777
UpdateAgentMetricsFn: options.UpdateAgentMetrics,
778778
AppStatBatchSize: workspaceapps.DefaultStatsDBReporterBatchSize,
779-
DisableDatabaseStorage: !options.DeploymentValues.TemplateInsights.Enable.Value(),
779+
DisableDatabaseInserts: !options.DeploymentValues.TemplateInsights.Enable.Value(),
780780
})
781781
workspaceAppsLogger := options.Logger.Named("workspaceapps")
782782
if options.WorkspaceAppsStatsCollectorOptions.Logger == nil {

coderd/insights_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ func TestTemplateInsights_Golden(t *testing.T) {
754754
reporter := workspacestats.NewReporter(workspacestats.ReporterOptions{
755755
Database: db,
756756
AppStatBatchSize: workspaceapps.DefaultStatsDBReporterBatchSize,
757-
DisableDatabaseStorage: disableStorage,
757+
DisableDatabaseInserts: disableStorage,
758758
})
759759
err = reporter.ReportAppStats(dbauthz.AsSystemRestricted(ctx), stats)
760760
require.NoError(t, err, "want no error inserting app stats")
@@ -1665,7 +1665,7 @@ func TestUserActivityInsights_Golden(t *testing.T) {
16651665
reporter := workspacestats.NewReporter(workspacestats.ReporterOptions{
16661666
Database: db,
16671667
AppStatBatchSize: workspaceapps.DefaultStatsDBReporterBatchSize,
1668-
DisableDatabaseStorage: disableStorage,
1668+
DisableDatabaseInserts: disableStorage,
16691669
})
16701670
err = reporter.ReportAppStats(dbauthz.AsSystemRestricted(ctx), stats)
16711671
require.NoError(t, err, "want no error inserting app stats")

coderd/workspacestats/reporter.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ type ReporterOptions struct {
4848
UsageTracker *UsageTracker
4949
UpdateAgentMetricsFn func(ctx context.Context, labels prometheusmetrics.AgentMetricLabels, metrics []*agentproto.Stats_Metric)
5050

51-
// DisableDatabaseStorage prevents storing stats in the database. The
51+
// DisableDatabaseInserts prevents inserting stats in the database. The
5252
// reporter will still call UpdateAgentMetricsFn and bump workspace activity.
53-
DisableDatabaseStorage bool
53+
DisableDatabaseInserts bool
5454

5555
AppStatBatchSize int
5656
}
@@ -114,7 +114,7 @@ func (r *Reporter) ReportAppStats(ctx context.Context, stats []workspaceapps.Sta
114114
return nil
115115
}
116116

117-
if !r.opts.DisableDatabaseStorage {
117+
if !r.opts.DisableDatabaseInserts {
118118
if err := tx.InsertWorkspaceAppStats(ctx, batch); err != nil {
119119
return err
120120
}
@@ -140,7 +140,7 @@ func (r *Reporter) ReportAppStats(ctx context.Context, stats []workspaceapps.Sta
140140
// nolint:revive // usage is a control flag while we have the experiment
141141
func (r *Reporter) ReportAgentStats(ctx context.Context, now time.Time, workspace database.WorkspaceIdentity, workspaceAgent database.WorkspaceAgent, stats *agentproto.Stats, usage bool) error {
142142
// update agent stats
143-
if !r.opts.DisableDatabaseStorage {
143+
if !r.opts.DisableDatabaseInserts {
144144
r.opts.StatsBatcher.Add(now, workspaceAgent.ID, workspace.TemplateID, workspace.OwnerID, workspace.ID, stats, usage)
145145
}
146146

0 commit comments

Comments
 (0)