Skip to content

Conversation

@code-asher
Copy link
Member

@code-asher code-asher commented Dec 19, 2025

Because this affects more than just the template insights page (specifically it also affects the deployment stats endpoint which is shown on bottom bar and Prometheus), the group is being renamed generically to just "stats". In the future if we need to affect all stats or the other stats we can put those options here.

Then, because this flag only affects a portion of stats, specifically usage stats like connection and application time, bytes sent, etc, add a new sub-group called "usage".

Then finally add back the "enable" flag. This also gives us a place to one day place an "anonymize" flag if we need to go that route.


What do y'all think? One unfortunate thing about this name is that --stats-usage-enable kind of sounds like "enable the usage of stats" rather than "enable the collection of usage stats". But if I flip it around like usage-stats-enable then there is no longer a section that can affect all stats, not just usage stats, if we need that one day (but maybe we will never need that):

usageStats:
  enable: boolean

We could maybe do something like have two vars that separately control the agent and app stat tables, but although that lines up nicely code-wise, not sure it would make sense to a user unless they know what the database schema looks like (of course the descriptions would help though):

stats:
  agent:
    enable: boolean
  app:
    enable: boolean

Because this affects more than just the template insights
page (specifically it also affects the deployment stats endpoint which
is shown on bottom bar and Prometheus), the group is being renamed
generically to just "stats".  In the future if we need to affect the
other stats we can put those options here.

Then, because this change only affects a portion of stats, specifically
usage stats like connection and application time, bytes sent, etc, add a
new sub-group called "usage".

Then finally add back the "enable" flag.  This also gives us a place to
one day place an "anonymize" flag if we need to go that route.
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are fine, but I'd be happy if we could improve the name a bit. WDYT about my suggestion?

(I agree that splitting them up is not better for the user, and ultimately results in weird UX since some stats are there and others are not.)

bar displays. Disabling will also prevent Prometheus collection of
these values.
INTROSPECTION / STATS / USAGE OPTIONS:
--stats-usage-enable bool, $CODER_STATS_USAGE_ENABLE (default: true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth introducing a bit of repetition here, --stats-usage-stats-enable. Might short-circuit a brain but at least it gives you a better hint in the end.

Or even wordier: --stats-collect-usage-stats-enable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or what about --stats-collection-enable

Copy link
Member

@aslilac aslilac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants