Skip to content

1c: Add transactions + transaction_spans DB tables and queries #237

Description

@ajianaz

Parent: #231 · Blocked by: #235

Scope

Add database schema and query functions for storing and retrieving transactions.

New Tables

transactions

Column Type Notes
id TEXT PK event_id
project_id TEXT FK→projects
name TEXT "POST /api/feedback"
release TEXT nullable
environment TEXT nullable
duration_ms REAL timestamp - start_timestamp × 1000
status TEXT "ok", "deadline_exceeded", etc
data TEXT full JSON payload
received_at TEXT ISO timestamp

transaction_spans

Column Type Notes
id TEXT PK
transaction_id TEXT FK→transactions
span_id TEXT
trace_id TEXT
parent_span_id TEXT nullable
op TEXT "db.sql.select", "http.client"
description TEXT nullable
start_offset_ms REAL relative to transaction start
duration_ms REAL
status TEXT nullable
data TEXT JSON

Tasks

  • SQLite migration file: 003_transactions.sql
  • Postgres migration file: 003_transactions.sql (Postgres dialect)
  • Add insert_transaction(project_id, transaction) -> Result<String>
  • Add list_transactions(project_id, page, per_page, sort) -> Result<(Vec<TransactionRow>, i64)>
  • Add get_transaction(id) -> Result<TransactionDetail> (with spans)
  • Add get_slowest_transactions(project_id, limit) -> Result<Vec<TransactionRow>>
  • Add tests: insert + retrieve round-trip
  • Add tests: list with pagination

Effort: ~3 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestscope:dbDatabase schema / migrationtype:envelopeSentry envelope item type expansion

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions