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

fix: missing events in the event store #4335

Merged
merged 1 commit into from
Jul 24, 2023
Merged

Conversation

gastonfournier
Copy link
Contributor

@gastonfournier gastonfournier commented Jul 24, 2023

About the changes

We are losing some events because of not having "created by" which is required by a constraint in the DB. One scenario where this can happen is with the default user admin, because it doesn't have a username or an email (unless configured by the administrator).

Our code makes assumptions on the existence of one of these 2 attributes (e.g.

private getCreatedBy(updatedBy: User = systemUser) {
return updatedBy.username || updatedBy.email;
}
).

Event lost metrics:
Screenshot from 2023-07-24 14-17-20

Discussion points

The solution proposed here is falling back to a default value. I've chosen "admin" because it covers one of the use cases, but it can also be "system" mimicking

const systemUser = new User({ id: -1, username: 'system' });
which is used as a default, or "unknown" which is sometimes used as a default:
const getCreatedBy = (user: IUser) => user.email || user.username || 'unknown';

Anyway, I believe it's better not to lose the event rather than be accurate with the "created by" that can be fixed later

@sonatype-lift
Copy link

sonatype-lift bot commented Jul 24, 2023

Sonatype Lift is retiring

Sonatype Lift will be retiring on Sep 12, 2023, with its analysis stopping on Aug 12, 2023. We understand that this news may come as a disappointment, and Sonatype is committed to helping you transition off it seamlessly. If you’d like to retain your data, please export your issues from the web console.
We are extremely grateful and thank you for your support over the years.

📖 Read about the impacts and timeline

@vercel
Copy link

vercel bot commented Jul 24, 2023

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

2 Ignored Deployments
Name Status Preview Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Jul 24, 2023 0:24am
unleash-monorepo-frontend ⬜️ Ignored (Inspect) Jul 24, 2023 0:24am

Copy link
Contributor

@kwasniew kwasniew left a comment

Choose a reason for hiding this comment

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

good idea

@gastonfournier gastonfournier merged commit ed5a796 into main Jul 24, 2023
12 checks passed
@gastonfournier gastonfournier deleted the fix/missing-events branch July 24, 2023 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants