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

#4205: update to prepare for emitting potentially stale events #4239

Merged
merged 9 commits into from
Jul 17, 2023

Conversation

thomasheartman
Copy link
Contributor

@thomasheartman thomasheartman commented Jul 13, 2023

This PR adds updates the potentially stale status change events whenever the potentially stale update function is run.

No events are emitted yet. While the emission is only a few lines of code, I'd like to do that in a separate PR so that we can give it the attention it deserves in the form of tests, etc.

This PR also moves the potentially stale update functionality from the update method to only being done in the updatePotentiallyStaleFeatures method. This keeps all functionality related to marking potentiallyStale in one place.

The emission implementation was removed in 4fb7cbd

The update queries

While it would be possible to do the state updates in a single query instead of three separate ones, wrangling this into knex proved to be troublesome (and would also probably be harder to understand and reason about). The current solution uses three smaller queries (one select, two updates), as Jaanus suggested in a private slack thread.

Input is welcome if you have any.

@vercel
Copy link

vercel bot commented Jul 13, 2023

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, 2023 7:17am
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2023 7:17am

@sonatype-lift
Copy link

sonatype-lift bot commented Jul 13, 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

Because the predata can be inferred to be the opposite, this gives as
much information and renders more cleanly in the UI
This is probably better left for a later PR
@thomasheartman thomasheartman changed the title #4205: emit potentially stale events #4205: update to prepare for emitting potentially stale events Jul 13, 2023
Copy link
Contributor

@andreas-unleash andreas-unleash left a comment

Choose a reason for hiding this comment

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

LGTM!

@thomasheartman thomasheartman merged commit 333c0c0 into main Jul 17, 2023
17 checks passed
@thomasheartman thomasheartman deleted the #4205/emit-potentially-stale-events branch July 17, 2023 07:53
thomasheartman added a commit that referenced this pull request Jul 17, 2023
This PR activates the event emission that was prepared for in
#4239.

It emits events (behind a flag) when something is marked as potentially
stale or the opposite.
It takes the features returned from the store and creates events out of
them.

The events only contain data, no preData. This is because the preData
can easily be inferred and because it gives a nicer event in the event
log.

Here is an image of the difference. The top event uses only data, so it
shows the name of the feature and the new potentiallyStale status. The
bottom event uses both preData and data, so it only shows the new
potentiallyStale status and not the feature name (unless you show the
raw event):


![image](https://github.com/Unleash/unleash/assets/17786332/5ec0fbef-f4cf-4dc6-9af6-9203fca30e5d)


Should not be merged before #4239. Merge that and then rebase this off
main or cherry the commit.

## Discussion 


### `preData`

Should we also use preData or is it enough to use only data? It seems
unnecessary in this event, but I'm open to hearing your thoughts.

### event author: `createdBy`

I've set `unleash-system` as the `createdBy` property on these events
because they are generated by the system. I found the same string used
some other places. However, it may be that there we want to use a
different author.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants