Add analytics page #41
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a complete workflow for collecting and deploying analytics for Coder workspaces and templates, including cloud storage integration and deployment automation. The main changes are the addition of two GitHub Actions workflows for scheduled data collection and automated deployment, a new analytics collection script, and supporting configuration updates for the analytics service.
New GitHub Actions workflows:
.github/workflows/collect-coder-analytics.ymlto automate collection of Coder workspace and template analytics every 6 hours and on manual trigger, with results uploaded to a Google Cloud Storage bucket and a summary generated in the workflow output..github/workflows/deploy-analytics.ymlto build, test, and deploy the analytics dashboard to Google Cloud Run on pushes and pull requests affecting the analytics service, including health checks and deployment summaries.Analytics collection and storage:
scripts/collect_coder_analytics.py, a Python script that uses the Coder CLI to fetch workspace and template data, creates a timestamped JSON snapshot, and uploads it to a GCS bucket with lifecycle management.pyproject.tomlto addgoogle-cloud-storageas a dependency for GCS integration in the analytics collection script.Configuration and environment updates:
.env.examplefor local development and deployment, detailing required environment variables and GitHub secrets for GCP, OAuth, and Coder API integration..dockerignoreto exclude unnecessary files from analytics service Docker builds..eslintrc.jsonto configure ESLint for the Next.js analytics service.Coder service configuration:
coder/deploy/startup.shto setCODER_MAX_TOKEN_LIFETIME=8760h, allowing longer-lived tokens for API access.