Skip to content

Add project setup diagnostics and verification flow - #31

Merged
bashgeek merged 3 commits into
mainfrom
feat/project-setup-diagnostics
Sep 10, 2026
Merged

bashgeek merged 3 commits into
mainfrom
feat/project-setup-diagnostics

Conversation

@bashgeek

@bashgeek bashgeek commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a per-project "setup status" flow that tells users whether their SDK is sending events, transactions, and profiles correctly, and lets them verify source map resolution against a real event. This replaces the old global /metrics and /api/instance/ingestion endpoints, which only exposed aggregate buffer stats and offered no way to tell whether a specific project's integration actually works.

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Docs / config only

Changes

  • Add project_setup_checks, project_setup_receipts, and project_setup_observations tables (migrations/0021_project_setup.up.sql) to track setup checks, first/last received event kinds, and ingest rejection reasons per project.
  • Add internal/storage/setup.go with helpers to start a setup check, record/list receipts, and record/list observations.
  • Add internal/api/setup.go with new endpoints:
    • GET /api/setup-status — setup completion summary across projects.
    • GET /api/projects/{slug}/setup-status — receipts, observations, an in-flight check, recent examples (event/transaction/profile), and source map availability for a project.
    • POST /api/projects/{slug}/setup-checks — start a new setup check.
    • GET /api/projects/{slug}/setup-sourcemaps — verify source map resolution against a chosen event.
  • Instrument handleEnvelope (internal/api/ingest.go) to record a bounded per-kind/outcome observation (queued/rejected + reason) on every ingest, replacing ad hoc buffer drop-reason counters.
  • Add internal/sourcemaps/verify.go to resolve and validate stack frames against uploaded source maps for a given event.
  • Remove internal/api/ingestion_health.go (/metrics Prometheus endpoint and /api/instance/ingestion JSON stats) and its tests, along with the now-unused ingest queue/drop-reason plumbing (internal/ingest/queue.go, writer_test.go, related buffer stats).
  • Rework internal/ingest/buffer.go, logbuffer.go, profilebuffer.go, txbuffer.go, and add internal/ingest/setup.go to support the simplified accounting used by the new observations.
  • Fix graceful shutdown in cmd/tindra/main.go: buffers now share the server's root context instead of a separate writerCtx, removing a redundant cancel/drain path.
  • Add event_id query support to GetLatestEventGlobal/GetIssueTrace (internal/api/global.go, internal/storage/events.go) so setup diagnostics can fetch a specific example event.
  • Add web/src/components/ProjectSetup.vue and web/src/views/ProjectSetupView.vue plus web/src/api/setup.ts to surface setup status, live-checking, and source map verification in the UI; wire into web/src/router/index.ts and web/src/stores/projects.ts.
  • Remove web/e2e/navigation.test.ts and web/src/views/__tests__/QueryStates.test.ts in favor of web/e2e/setup.test.ts and updated per-view tests.
  • Drop STATS_API_KEY-gated /metrics references from .env.example, docker-compose.yml, and install.sh, and remove the now-unneeded stop_grace_period (shutdown no longer needs the extra drain time).

Test plan

  • internal/api/setup_test.go, setup_ingest_internal_test.go, setup_failures_internal_test.go cover setup-status/check/sourcemap endpoints, envelope rejection reasons, and partial-database-failure handling.
  • internal/storage/setup_test.go and internal/ingest/setup_internal_test.go cover the new storage and ingest helpers.
  • internal/sourcemaps/verify_test.go / verify_internal_test.go cover source map verification, including malformed maps and unresolved frames.
  • web/src/components/__tests__/ProjectSetup.test.ts and web/src/views/__tests__/ProjectSetupView.test.ts cover the new UI flow; web/e2e/setup.test.ts covers the end-to-end setup journey.
  • Verified go test ./... and the web test suite pass locally.

Checklist

  • Tests added or updated
  • No new dependencies introduced (or justified in the PR description)
  • I assign copyright in this contribution to Blendbyte GmbH, as required by the
    Contributor License Agreement

@bashgeek
bashgeek force-pushed the feat/project-setup-diagnostics branch from ce6cc72 to c9b4b39 Compare September 9, 2026 23:37
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

- Add setup checks, receipts, and observations to track when events, transactions, and profiles first arrive for a project
- Record per-envelope-item outcomes (queued/rejected) with reasons for setup diagnostics
- Add sourcemap verification endpoint to confirm source maps resolve real stack frames
- Support looking up an exact event by id for global latest-event and issue-trace endpoints
- Add ProjectSetup UI components and ProjectSetupView with e2e coverage
- Add migration 0021 for project setup tables
@bashgeek
bashgeek force-pushed the feat/project-setup-diagnostics branch from c9b4b39 to f7ae977 Compare September 10, 2026 01:08
- Add a query tracer to count INSERT calls against project_setup_observations
- Verify recordSetupWriteFailure writes exactly one observation per distinct project ID in a batch, even with duplicates
- Assert rejected/storage_failed observations are recorded and no setup receipts are created on failure
- Cover source map verification failing on a database error instead of claiming a missing map
- Cover exact event lookup for an issue, including cross-issue scoping and cancellation
- Cover setup check project scoping and setup receipts surviving event retention deletes
- Cover ProjectSetup UI handling of transaction/profile linking, stale saved checks, processing events, and unavailable source map storage
@bashgeek
bashgeek merged commit 30941bc into main Sep 10, 2026
8 checks passed
@bashgeek
bashgeek deleted the feat/project-setup-diagnostics branch September 10, 2026 01:45
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