Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: db migration for integration events #7604

Merged
merged 3 commits into from
Jul 17, 2024

Conversation

nunogois
Copy link
Member

@nunogois nunogois commented Jul 16, 2024

https://linear.app/unleash/issue/2-2435/create-migration-for-a-new-integration-events-table

Adds a DB migration that creates the integration_events table:

  • id: Auto-incrementing primary key;
  • integration_id: The id of the respective integration (i.e. integration configuration);
  • created_at: Date of insertion;
  • state: Integration event state, as text. Can be anything we'd like, but I'm thinking this will be something like:
    • Success ✅
    • Failed ❌
    • SuccessWithErrors ⚠️
  • state_details: Expands on the previous column with more details, as text. Examples:
    • OK. Status code: 200
    • Status code: 429 - Rate limit reached
    • No access token provided
  • event: The whole event object, stored as a JSON blob;
  • details: JSON blob with details about the integration execution. Will depend on the integration itself, but for example:
    • Webhook: Request body
    • Slack App: Message text and an array with all the channels we're posting to

I think this gives us enough flexibility to cover all present and (possibly) future integrations, but I'd like to hear your thoughts.

I'm also really torn on what to call this table:

  • integration_events: Consistent with the feature name. Addons are now called integrations, so this would be consistent with the new thing;
  • addon_events: Consistent with the existing addons table.

@nunogois nunogois requested a review from chriswk July 16, 2024 14:25
Copy link

vercel bot commented Jul 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2024 8:47am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ⬜️ Ignored (Inspect) Visit Preview Jul 17, 2024 8:47am

Copy link
Contributor

github-actions bot commented Jul 16, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

`
CREATE TABLE IF NOT EXISTS integration_events
(
id SERIAL PRIMARY KEY NOT NULL,
Copy link
Member

@chriswk chriswk Jul 17, 2024

Choose a reason for hiding this comment

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

BIGSERIAL? we might be expecting more than 2B events here. Probably not, but moving to 8 bytes instead of 4 bytes here to never have to worry about it. Still going to give you a thumbsup, just something to consider.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, addressed in ed64b1f

Copy link
Member

@chriswk chriswk left a comment

Choose a reason for hiding this comment

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

Consider maybe using BIGSERIAL, but not a deal breaker for me. The rest of the table seems 👍

@nunogois nunogois force-pushed the chore-db-migration-integration-events branch from ed64b1f to 18c49cc Compare July 17, 2024 08:36
@nunogois nunogois merged commit 13d0268 into main Jul 17, 2024
11 checks passed
@nunogois nunogois deleted the chore-db-migration-integration-events branch July 17, 2024 09:02
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.

2 participants