Skip to content

Conversation

@koxudaxi
Copy link
Collaborator

@koxudaxi koxudaxi commented Dec 9, 2025

TL;DR

Added database schema for traces and spans to support distributed tracing functionality.

What changed?

  • Created a new traces table to store trace information with fields for:

    • Trace identifiers
    • Service information (name, version)
    • Resource attributes
    • Organization/project/environment relationships
  • Created a new spans table to store span data with fields for:

    • Span identifiers and relationships (trace_id, span_id, parent_span_id)
    • Timing information (start/end times)
    • Span attributes, status, events, and links
    • Performance metadata (dropped counts)
  • Added appropriate foreign key constraints to maintain data integrity

  • Created indexes to optimize query performance for common access patterns

How to test?

  1. Apply the migration to a test database
  2. Verify the tables are created with the correct schema
  3. Test inserting trace and span data to ensure constraints work properly
  4. Verify the indexes are created and used in relevant queries

Why make this change?

This database schema is the foundation for implementing distributed tracing capabilities in our application. The tables will store OpenTelemetry-compatible trace and span data, allowing us to:

  • Track request flows across multiple services
  • Analyze performance bottlenecks
  • Troubleshoot errors in distributed systems
  • Provide observability into application behavior

Copy link
Collaborator Author

koxudaxi commented Dec 9, 2025

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 9, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
v2-docs f2e8bb0 Jan 05 2026, 02:16 PM

Copy link
Collaborator

@willbakst willbakst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The migration files here are wrong. I believe v2 base is at 0011 right now.

Also, this is missing the journal update as well? Did you clear the migrations and run bun run db:generate?

@koxudaxi koxudaxi force-pushed the 12-09-feat_db_add_migration_for_traces_and_spans_tables branch from 9cb1336 to 4e114b6 Compare December 25, 2025 02:10
@koxudaxi koxudaxi changed the base branch from 12-09-feat_db_add_traces_and_spans_schema to graphite-base/1605 December 25, 2025 08:10
@koxudaxi koxudaxi force-pushed the 12-09-feat_db_add_migration_for_traces_and_spans_tables branch from 4e114b6 to 67a043e Compare December 25, 2025 08:13
@graphite-app graphite-app bot changed the base branch from graphite-base/1605 to v2 December 25, 2025 08:13
@koxudaxi koxudaxi force-pushed the 12-09-feat_db_add_migration_for_traces_and_spans_tables branch 3 times, most recently from 10b80a6 to f3a1efe Compare December 25, 2025 08:54
Copy link
Collaborator

@willbakst willbakst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve merge conflicts

@koxudaxi koxudaxi force-pushed the 12-09-feat_db_add_migration_for_traces_and_spans_tables branch from f3a1efe to df030e4 Compare January 5, 2026 04:17
@koxudaxi koxudaxi force-pushed the 12-09-feat_db_add_migration_for_traces_and_spans_tables branch 2 times, most recently from 07a7264 to e336017 Compare January 5, 2026 06:46
@koxudaxi koxudaxi force-pushed the 12-09-feat_db_add_migration_for_traces_and_spans_tables branch from e336017 to f2e8bb0 Compare January 5, 2026 06:50
@koxudaxi koxudaxi requested a review from willbakst January 5, 2026 06:54
Copy link
Collaborator Author

koxudaxi commented Jan 5, 2026

Merge activity

  • Jan 5, 2:12 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jan 5, 2:12 PM UTC: @koxudaxi merged this pull request with Graphite.

@koxudaxi koxudaxi merged commit 2ad52ce into v2 Jan 5, 2026
12 checks passed
@koxudaxi koxudaxi deleted the 12-09-feat_db_add_migration_for_traces_and_spans_tables branch January 5, 2026 14:12
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.

3 participants