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

RHINENG-4700_and_5552: Use deletion for culling and rename attributes in custom staleness #1573

Merged

Conversation

thearifismail
Copy link
Contributor

Overview

This PR is being created to address RHINENG-4700 and RHINENG-5552 and replace the PR #1550

PR Checklist

  • Keep PR title short, ideally under 72 characters
  • Descriptive comments provided in complex code blocks
  • Tests: validate optimal/expected output
  • Tests: validate exceptions and failure scenarios
  • Tests: edge cases
  • Recovers or fails gracefully during potential resource outages (e.g. DB, Kafka)
  • Uses type hinting, if convenient
  • Documentation, if this PR changes the way other services interact with host inventory
  • Links to related PRs

Secure Coding Practices Documentation Reference

You can find documentation on this checklist here.

Secure Coding Checklist

  • Input Validation
  • Output Encoding
  • Authentication and Password Management
  • Session Management
  • Access Control
  • Cryptographic Practices
  • Error Handling and Logging
  • Data Protection
  • Communication Security
  • System Configuration
  • Database Security
  • File Management
  • Memory Management
  • General Coding Practices

Copy link
Contributor

@fellipeh fellipeh left a comment

Choose a reason for hiding this comment

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

How this will work with the current databases? I saw the changes on migrations folder only for the fields name creation..,

@thearifismail
Copy link
Contributor Author

How this will work with the current databases? I saw the changes on migrations folder only for the fields name creation..,

After making these changes, I successfully ran the make task make upgrade_db followed by pytest.

fellipeh
fellipeh previously approved these changes Dec 4, 2023
Copy link
Contributor

@fellipeh fellipeh left a comment

Choose a reason for hiding this comment

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

lgtm

@fstavela
Copy link
Contributor

fstavela commented Dec 5, 2023

How this will work with the current databases? I saw the changes on migrations folder only for the fields name creation..,

After making these changes, I successfully ran the make task make upgrade_db followed by pytest.

Did you run the DB upgrade on an already existing database or on a new one? This change to the DB migration is my only concern with this PR, I think the proper way would be to create a new migration instead of updating an existing one. I don't know if this approach will work on existing databases in Stage and Prod. But I've never done this, so correct me if I'm wrong.

Otherwise, the PR looks good.

@thearifismail
Copy link
Contributor Author

How this will work with the current databases? I saw the changes on migrations folder only for the fields name creation..,

After making these changes, I successfully ran the make task make upgrade_db followed by pytest.

Did you run the DB upgrade on an already existing database or on a new one? This change to the DB migration is my only concern with this PR, I think the proper way would be to create a new migration instead of updating an existing one. I don't know if this approach will work on existing databases in Stage and Prod. But I've never done this, so correct me if I'm wrong.

Otherwise, the PR looks good.

Thank you @fstavela; very good point. I ran it on a new DB but let me run against an older one, i.e. migration.

Copy link
Collaborator

@kruai kruai left a comment

Choose a reason for hiding this comment

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

+1 to the point about the migrations - you'll need to make a new migration rather than modify the existing ones.
Also, there are a few places where the field names haven't been updated, and it would make sense to update them all at once.

Comment on lines 41 to 46
"conventional_staleness_delta": config.conventional_staleness_seconds,
"conventional_stale_warning_delta": config.conventional_stale_warning_seconds,
"conventional_culling_delta": config.conventional_culling_seconds,
"immutable_staleness_delta": config.immutable_staleness_seconds,
"immutable_stale_warning_delta": config.immutable_stale_warning_seconds,
"immutable_culling_delta": config.immutable_culling_seconds,
"conventional_time_to_stale": config.conventional_staleness_seconds,
"conventional_time_to_stale_warning": config.conventional_stale_warning_seconds,
"conventional_time_to_delete": config.conventional_culling_seconds,
"immutable_time_to_stale": config.immutable_staleness_seconds,
"immutable_time_to_stale_warning": config.immutable_stale_warning_seconds,
"immutable_time_to_delete": config.immutable_culling_seconds,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might as well update the field names in the config file and environment variables too; it'll be confusing if we don't.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!!!

@thearifismail
Copy link
Contributor Author

thearifismail commented Dec 5, 2023

+1 to the point about the migrations - you'll need to make a new migration rather than modify the existing ones. Also, there are a few places where the field names haven't been updated, and it would make sense to update them all at once.

hmmm... I did bulk find and resplace. Let me look. Thanks.
oh you mean the config's attributes' names. like conventional_time_to_stale": config.conventional_staleness_seconds

Copy link
Contributor

@jpramos123 jpramos123 left a comment

Choose a reason for hiding this comment

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

LGTM!

Thanks for this PR.

the _time_to was a good approach to solve the variables naming we discussed!!

@thearifismail thearifismail merged commit e82471f into RedHatInsights:master Dec 6, 2023
4 of 5 checks passed
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.

6 participants