Skip to content

feat: report user secrets adoption summary in telemetry#24854

Merged
zedkipp merged 3 commits into
mainfrom
zedkipp/user-secrets-telemetry
May 5, 2026
Merged

feat: report user secrets adoption summary in telemetry#24854
zedkipp merged 3 commits into
mainfrom
zedkipp/user-secrets-telemetry

Conversation

@zedkipp
Copy link
Copy Markdown
Contributor

@zedkipp zedkipp commented Apr 30, 2026

Add a deployment-wide user secrets summary to the telemetry snapshot so we can track adoption of user secrets
The summary reports:

  • A breakdown of secrets by which injection fields are populated: EnvNameOnly, FilePathOnly, Both, Neither
  • The distribution of secrets per user (max, p25, p50, p75, p90)

All metrics are scoped to active non-system users. Soft-deleted users are excluded. The percentile distribution is computed across the entire active non-system user base, including users with zero secrets, so the percentiles reflect deployment-wide adoption.

Assisted by Coder Agents.

Corresponding coder-telemetry-server PR: https://github.com/coder/coder-telemetry-server/pull/40

@zedkipp zedkipp force-pushed the zedkipp/user-secrets-telemetry branch 2 times, most recently from 6a36732 to b575a43 Compare May 1, 2026 21:02
Add a deployment-wide user secrets summary to the telemetry snapshot so
we can track adoption of user secrets
The summary reports:

- A breakdown of secrets by which injection fields are populated:
  EnvNameOnly, FilePathOnly, Both, Neither
- The distribution of secrets per user (max, p25, p50, p75, p90)

All metrics are scoped to active non-system users. Soft-deleted users
are excluded. The percentile distribution is computed across the entire
active non-system user base, including users with zero secrets, so the
percentiles reflect deployment-wide adoption.

Assisted by Coder Agents.
@zedkipp zedkipp force-pushed the zedkipp/user-secrets-telemetry branch from b575a43 to eeff31b Compare May 1, 2026 21:13
@zedkipp zedkipp marked this pull request as ready for review May 1, 2026 22:59
Copy link
Copy Markdown
Contributor

@hugodutka hugodutka left a comment

Choose a reason for hiding this comment

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

Approving, pending the 2 issues pointed out in the review.

Comment thread coderd/database/queries/user_secrets.sql Outdated
Comment thread coderd/telemetry/telemetry.go Outdated
Copy link
Copy Markdown
Contributor

@hugodutka hugodutka left a comment

Choose a reason for hiding this comment

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

One more thing: we could use a field on the summary struct to indicate the period it's summarizing. Similar issue as in the past: https://github.com/coder/coder-telemetry-server/pull/36#issuecomment-3816970252

-- distribution is active non-system users. Soft-deleted users are
-- excluded because Coder soft-deletes by flipping users.deleted
-- rather than removing rows, so their secrets persist in user_secrets
-- but are no longer reachable. System users (is_system = true) cover
Copy link
Copy Markdown
Contributor

@dylanhuff-at-coder dylanhuff-at-coder May 4, 2026

Choose a reason for hiding this comment

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

Out of scope for this work, but this comment has me wondering if there should be cleanup specifically for user secrets when users.deleted is flipped. I see that it's unreachable so doesn't seem urgent, but I think best practice here would be to have secrets be deleted during that flip so that we store as little sensitive information as possible

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

@dylanhuff-at-coder dylanhuff-at-coder left a comment

Choose a reason for hiding this comment

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

Two small comments, otherwise looks good

@zedkipp
Copy link
Copy Markdown
Contributor Author

zedkipp commented May 4, 2026

One more thing: we could use a field on the summary struct to indicate the period it's summarizing. Similar issue as in the past: coder/coder-telemetry-server#36 (comment)

I didn't bother with the timestamps/window mainly because the data represents "feature usage right now" rather than over some interval. Using the telemetry server receive time to know what feature usage is at a rough point in time seems sufficient for our purposes.

@zedkipp zedkipp merged commit 1b2a1af into main May 5, 2026
26 checks passed
@zedkipp zedkipp deleted the zedkipp/user-secrets-telemetry branch May 5, 2026 16:56
@github-actions github-actions Bot locked and limited conversation to collaborators May 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants