Skip to content

Track codespace create/start events#15

Merged
sis0k0 merged 1 commit into
mainfrom
track-codespace-usage
Jul 24, 2026
Merged

Track codespace create/start events#15
sis0k0 merged 1 commit into
mainfrom
track-codespace-usage

Conversation

@sis0k0

@sis0k0 sis0k0 commented Jul 24, 2026

Copy link
Copy Markdown
Member

What

Adds lightweight telemetry that records every time a Codespace is created or started/resumed from this repo.

How

  • New .devcontainer/track.sh: a best-effort curl (5s timeout, silent) that POSTs {event, codespace, user, repository} to an HTTP Google Cloud Function.
  • devcontainer.json: fires track.sh created from postCreateCommand and track.sh started from postStartCommand. Both use || true, so telemetry can never break the dev environment.

Backend (already deployed)

  • Gen2 HTTP function trackCodespace in GCP project project-learning-fuel (us-central1), Node 22.
  • Inserts into githubtraffic.codespaceEvents on MongoDB Atlas.
  • Atlas URI read from Secret Manager (mongodb_uri); runtime SA granted secretmanager.secretAccessor.
  • Verified end-to-end: test POST returns HTTP 204 and writes a document.

Add .devcontainer/track.sh, a best-effort curl that POSTs a codespace
lifecycle event to an HTTP Google Cloud Function which logs it to MongoDB
Atlas. Wire it into postCreateCommand (created) and postStartCommand
(started); both use || true so telemetry never breaks the environment.
@sis0k0
sis0k0 merged commit 685f7ac into main Jul 24, 2026
3 checks passed
@sis0k0
sis0k0 deleted the track-codespace-usage branch July 25, 2026 07:52
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.

1 participant