Skip to content

Add metrics for users per community and user activity recency#8650

Merged
aapeliv merged 4 commits into
developfrom
claude/issue-8648-20260517-0328
May 18, 2026
Merged

Add metrics for users per community and user activity recency#8650
aapeliv merged 4 commits into
developfrom
claude/issue-8648-20260517-0328

Conversation

@aapeliv

@aapeliv aapeliv commented May 17, 2026

Copy link
Copy Markdown
Member

Adds two new Prometheus metrics:

  • couchers_users_per_community: number of users per community, labeled by community name, for communities at the region level and broader
  • couchers_active_users_by_recency: number of users bucketed by how recently they were last active (<1d, 1d-1w, 1w-1m, 1m-6m, 6m-12m, 12m-24m, 24m+)

Describe briefly what this PR is doing and why.

Testing

Explain how you tested this PR and give clear steps so the reviewer can replicate.

Backend checklist

  • Added tests for any new code or added a regression test if fixing a bug
  • Run the backend locally and it works
  • Added migrations if there are any database changes, rebased onto develop if necessary for linear migration history

Web frontend checklist

  • There are no console warnings when running the app
  • Added tests where relevant
  • Clicked around my changes running locally and it works
  • Checked Desktop, Mobile and Tablet screen sizes

For maintainers

  • Maintainers can push commits to my branch
  • Maintainers can merge this PR for me

Adds two new Prometheus metrics:
- couchers_users_per_community: number of users per community, labeled by
  community name, for communities at the region level and broader
- couchers_active_users_by_recency: number of users bucketed by how
  recently they were last active (<1d, 1d-1w, 1w-1m, 1m-6m, 6m-12m,
  12m-24m, 24m+)

Co-authored-by: Aapeli <aapeliv@users.noreply.github.com>
@vercel

vercel Bot commented May 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
couchers Ready Ready Preview May 18, 2026 9:50pm

Request Review

The test_metrics.py autouse fixture only depended on testconfig, not the
db fixture, so users accumulated across runs and made the active users
recency gauge test non-deterministic.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The metrics tests didn't request the db fixture, so tables were never
truncated and users accumulated across runs, making the active users
recency gauge test non-deterministic.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ity metric

Read the per-community user count from the cluster_subscription_counts
materialized view instead of joining ClusterSubscription/User live on
every scrape.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@aapeliv
aapeliv merged commit 697c464 into develop May 18, 2026
5 checks passed
@aapeliv
aapeliv deleted the claude/issue-8648-20260517-0328 branch May 18, 2026 23:21
@github-actions

Copy link
Copy Markdown
Contributor

📝 Release Notes

This PR does not need to be included in release notes.

Reason: This PR only adds internal Prometheus monitoring metrics for communities and user activity recency. It does not introduce any user-facing feature, noticeable UX change, important bug fix, safety feature, or major infrastructure improvement that end users would notice.

🤖 Bot Debug Information

Model: couchers.openai.gpt-5.4
Decision: exclude
Reasoning: This PR only adds internal Prometheus monitoring metrics for communities and user activity recency. It does not introduce any user-facing feature, noticeable UX change, important bug fix, safety feature, or major infrastructure improvement that end users would notice.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant