Skip to content

Commit 7076956

Browse files
committed
Rename to templateInsights.enable and improve description
1 parent 092cca4 commit 7076956

File tree

12 files changed

+109
-44
lines changed

12 files changed

+109
-44
lines changed

cli/testdata/coder_server_--help.golden

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,6 @@ Configure TLS for your SMTP server target.
223223
--email-tls-starttls bool, $CODER_EMAIL_TLS_STARTTLS
224224
Enable STARTTLS to upgrade insecure SMTP connections using TLS.
225225

226-
INTROSPECTION OPTIONS:
227-
Configure logging, tracing, and metrics exporting.
228-
229-
--disable-template-insights bool, $CODER_DISABLE_TEMPLATE_INSIGHTS (default: false)
230-
Disable storage and display of template insights.
231-
232226
INTROSPECTION / HEALTH CHECK OPTIONS:
233227
--health-check-refresh duration, $CODER_HEALTH_CHECK_REFRESH (default: 10m0s)
234228
Refresh interval for healthchecks.
@@ -275,6 +269,16 @@ INTROSPECTION / PROMETHEUS OPTIONS:
275269
--prometheus-enable bool, $CODER_PROMETHEUS_ENABLE
276270
Serve prometheus metrics on the address defined by prometheus address.
277271

272+
INTROSPECTION / TEMPLATE INSIGHTS OPTIONS:
273+
--template-insights-enable bool, $CODER_TEMPLATE_INSIGHTS_ENABLE (default: true)
274+
Enable the collection and display of template insights along with the
275+
associated API endpoints. This will also enable aggregating these
276+
insights into daily active users, application usage, and transmission
277+
rates for overall deployment stats. When disabled, these values will
278+
be zero, which will also affect what the bottom deployment overview
279+
bar displays. Disabling will also prevent Prometheus collection of
280+
these values.
281+
278282
INTROSPECTION / TRACING OPTIONS:
279283
--trace-logs bool, $CODER_TRACE_LOGS
280284
Enables capturing of logs as events in traces. This is useful for

cli/testdata/server-config.yaml.golden

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,16 @@ autobuildPollInterval: 1m0s
190190
# Interval to poll for hung and pending jobs and automatically terminate them.
191191
# (default: 1m0s, type: duration)
192192
jobHangDetectorInterval: 1m0s
193-
# Configure logging, tracing, and metrics exporting.
194193
introspection:
195-
# Disable storage and display of template insights.
196-
# (default: false, type: bool)
197-
disableTemplateInsights: false
194+
templateInsights:
195+
# Enable the collection and display of template insights along with the associated
196+
# API endpoints. This will also enable aggregating these insights into daily
197+
# active users, application usage, and transmission rates for overall deployment
198+
# stats. When disabled, these values will be zero, which will also affect what the
199+
# bottom deployment overview bar displays. Disabling will also prevent Prometheus
200+
# collection of these values.
201+
# (default: true, type: bool)
202+
enable: true
198203
prometheus:
199204
# Serve prometheus metrics on the address defined by prometheus address.
200205
# (default: <unset>, type: bool)

coderd/apidoc/docs.go

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/coderd.go

Lines changed: 2 additions & 2 deletions
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.DisableTemplateInsights.Value(),
779+
DisableDatabaseStorage: !options.DeploymentValues.TemplateInsights.Enable.Value(),
780780
})
781781
workspaceAppsLogger := options.Logger.Named("workspaceapps")
782782
if options.WorkspaceAppsStatsCollectorOptions.Logger == nil {
@@ -1533,7 +1533,7 @@ func New(options *Options) *API {
15331533
r.Use(
15341534
func(next http.Handler) http.Handler {
15351535
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
1536-
if options.DeploymentValues.DisableTemplateInsights.Value() {
1536+
if !options.DeploymentValues.TemplateInsights.Enable.Value() {
15371537
httpapi.Write(context.Background(), rw, http.StatusForbidden, codersdk.Response{
15381538
Message: "Forbidden.",
15391539
Detail: "Template insights are disabled.",

coderd/insights_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2407,7 +2407,9 @@ func TestGenericInsights_Disabled(t *testing.T) {
24072407
dbrollup.WithInterval(time.Millisecond*100),
24082408
),
24092409
DeploymentValues: coderdtest.DeploymentValues(t, func(dv *codersdk.DeploymentValues) {
2410-
dv.DisableTemplateInsights = true
2410+
dv.TemplateInsights = codersdk.TemplateInsightsConfig{
2411+
Enable: false,
2412+
}
24112413
}),
24122414
})
24132415
user := coderdtest.CreateFirstUser(t, client)

codersdk/deployment.go

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ type DeploymentValues struct {
511511
Prebuilds PrebuildsConfig `json:"workspace_prebuilds,omitempty" typescript:",notnull"`
512512
HideAITasks serpent.Bool `json:"hide_ai_tasks,omitempty" typescript:",notnull"`
513513
AI AIConfig `json:"ai,omitempty"`
514-
DisableTemplateInsights serpent.Bool `json:"disable_template_insights,omitempty" typescript:",notnull"`
514+
TemplateInsights TemplateInsightsConfig `json:"template_insights,omitempty" typescript:",notnull"`
515515

516516
Config serpent.YAMLConfigPath `json:"config,omitempty" typescript:",notnull"`
517517
WriteConfig serpent.Bool `json:"write_config,omitempty" typescript:",notnull"`
@@ -611,6 +611,10 @@ type DERPConfig struct {
611611
Path serpent.String `json:"path" typescript:",notnull"`
612612
}
613613

614+
type TemplateInsightsConfig struct {
615+
Enable serpent.Bool `json:"enable" typescript:",notnull"`
616+
}
617+
614618
type PrometheusConfig struct {
615619
Enable serpent.Bool `json:"enable" typescript:",notnull"`
616620
Address serpent.HostPort `json:"address" typescript:",notnull"`
@@ -1081,6 +1085,11 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
10811085
Name: "pprof",
10821086
YAML: "pprof",
10831087
}
1088+
deploymentGroupIntrospectionTemplateInsights = serpent.Group{
1089+
Parent: &deploymentGroupIntrospection,
1090+
Name: "Template Insights",
1091+
YAML: "templateInsights",
1092+
}
10841093
deploymentGroupIntrospectionPrometheus = serpent.Group{
10851094
Parent: &deploymentGroupIntrospection,
10861095
Name: "Prometheus",
@@ -1703,14 +1712,14 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
17031712
YAML: "configPath",
17041713
},
17051714
{
1706-
Name: "Disable Template Insights",
1707-
Description: "Disable storage and display of template insights.",
1708-
Flag: "disable-template-insights",
1709-
Env: "CODER_DISABLE_TEMPLATE_INSIGHTS",
1710-
Default: "false",
1711-
Value: &c.DisableTemplateInsights,
1712-
Group: &deploymentGroupIntrospection,
1713-
YAML: "disableTemplateInsights",
1715+
Name: "Enable Template Insights",
1716+
Description: "Enable the collection and display of template insights along with the associated API endpoints. This will also enable aggregating these insights into daily active users, application usage, and transmission rates for overall deployment stats. When disabled, these values will be zero, which will also affect what the bottom deployment overview bar displays. Disabling will also prevent Prometheus collection of these values.",
1717+
Flag: "template-insights-enable",
1718+
Env: "CODER_TEMPLATE_INSIGHTS_ENABLE",
1719+
Default: "true",
1720+
Value: &c.TemplateInsights.Enable,
1721+
Group: &deploymentGroupIntrospectionTemplateInsights,
1722+
YAML: "enable",
17141723
},
17151724
// TODO: support Git Auth settings.
17161725
// Prometheus settings

docs/reference/api/general.md

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/schemas.md

Lines changed: 21 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/cli/server.md

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)