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

Convert Rule label/annotation storage to JsonField #427

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

kfdm
Copy link
Collaborator

@kfdm kfdm commented Jul 13, 2023

When Promgen was written, there was not a default JsonField, so labels and annotations were implemented as a class. Now that JsonField has been in Django since 3.1, it's a good time to change the implementation.

Previously, our audit log did not store change to labels/annotations (because they were separate objects), so one benefit of this migration is that those changes now show up in the edit log.

We also expect some queries to be a bit faster now that we do not need to query the other table relations for labels/annotations.

There may be some bits that could use better comments so feel free to point out the lines where the current explanation is insufficient.

When Promgen was written, there was not a default JsonField, so labels
and annotations were implemented as a class. Now that JsonField has been
in Django since 3.1, it's a good time to change the implementation.

Previously, our audit log did *not* store change to labels/annotations
(because they were separate objects), so one benefit of this migration
is that those changes now show up in the edit log.

We also expect some queries to be a bit faster now that we do not need
to query the other table relations for labels/annotations.
@kfdm kfdm requested a review from a team as a code owner July 13, 2023 05:22
@kfdm kfdm self-assigned this Jul 13, 2023
Copy link
Contributor

@vincent-olivert-riera vincent-olivert-riera left a comment

Choose a reason for hiding this comment

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

That was a lot of code and a long review. I didn't see anything suspicious of being broken, but sorry if I have missed it. To me, it looks good 👍🏻

@kfdm kfdm merged commit 1454ed0 into line:master Jul 18, 2023
5 checks passed
@kfdm kfdm deleted the rule-label-annotations branch July 18, 2023 05:42
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