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

monitor config model updates #4888

Merged
merged 11 commits into from
May 17, 2024
Merged

Conversation

adamsachs
Copy link
Contributor

@adamsachs adamsachs commented May 13, 2024

Along with associated plus PR, closes PROD-2075 PROD-2043

Description Of Changes

Model-level updates to support the following monitor configurations:

  • scheduling (repeated) monitor execution on daily/weekly/monthly cadence
  • API to list monitor configurations (filtering by associated connection config) and delete monitor configurations
  • scoping monitors to specific databases (e.g. bigquery projects)

Also some general cleanup of detection/discovery related functionality along the way.

Code Changes

  • add monitor_execution_trigger JSON column to store serialized cron trigger params for APScheduler
    • model-level property functions and helper functions (some of which are invoked on create and update overrides) to help with translating the monitor_execution_trigger param JSON to and from API schema fields related to monitor scheduling
  • add databases string array column to store the monitor config's scoped databases
  • add connection_config_key property function to the model to support automatic serialization to the API schemal
  • ensure dataset field on the bigquery connection config secrets is properly marked as optional so as to make it not required

Steps to Confirm

  • see associated plus PR

Pre-Merge Checklist

Copy link

vercel bot commented May 13, 2024

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

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
fides-plus-nightly ⬜️ Ignored (Inspect) Visit Preview May 15, 2024 1:54pm

Copy link

cypress bot commented May 13, 2024

Passing run #7742 ↗︎

0 4 0 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

Merge c2de55b into 0f9acea...
Project: fides Commit: 454578f8d9 ℹ️
Status: Passed Duration: 00:38 💡
Started: May 15, 2024 2:06 PM Ended: May 15, 2024 2:07 PM

Review all test suite changes for PR #4888 ↗︎

Copy link

codecov bot commented May 13, 2024

Codecov Report

Attention: Patch coverage is 91.07143% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 86.76%. Comparing base (0f9acea) to head (c2de55b).

Files Patch % Lines
src/fides/api/models/detection_discovery.py 89.79% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4888   +/-   ##
=======================================
  Coverage   86.76%   86.76%           
=======================================
  Files         347      347           
  Lines       20927    20967   +40     
  Branches     2736     2740    +4     
=======================================
+ Hits        18157    18192   +35     
- Misses       2294     2297    +3     
- Partials      476      478    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adamsachs adamsachs changed the title [DRAFT] monitor config model updates monitor config model updates May 15, 2024
@adamsachs adamsachs marked this pull request as ready for review May 15, 2024 11:26
@adamsachs adamsachs requested review from pattisdr and galvana May 15, 2024 14:52
Copy link
Contributor

@pattisdr pattisdr left a comment

Choose a reason for hiding this comment

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

nice one

Comment on lines +72 to +73
unique=False,
nullable=True,
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't matter, but we don't really have to specify this nullable=True default or unique=False default - in some models we were only specifying non-default attributes. Existing classify_parms already has this though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah i always go a bit back and forth - to your point, maybe i'll lean more toward not specifying, sometimes specifying can be confusing in its own right! i guess i just usually forget whether nullable is True or False by default 😬

(hence the back and forth 😆)

@@ -65,28 +65,15 @@ def mask_sensitive_fields(
if connection_secrets is None:
return connection_secrets
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah the return type of this is Optional then

@@ -12,6 +12,8 @@
class ConnectionConfigSecretsSchema(BaseModel, abc.ABC):
"""Abstract Base Schema for updating Connection Configuration Secrets"""

# NOTE: any fields not listed in `_required_components` must also have an
# annotated Optional type, in order to be treated effectively as optional fields
_required_components: List[str]
Copy link
Contributor

Choose a reason for hiding this comment

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

ah these _required_components is confusing at this point, thanks for improving with the docstring, This was the original intent: https://github.com/ethyca/solon/blame/085ace7d88ceee0e1de3a4b2105ce68e54e5e431/src/fidesops/schemas/connection_configuration/connection_secrets.py#L28

Comment on lines +145 to +152
For example, an `execution_start_date` of "2024-05-14 12:00:00+00:00":
- with an `execution_frequency` of "daily", it will result in daily
execution at 12:00:00+00:00;
- with an `execution_frequency` of "weekly", it will result in weekly
execution at 12:00:00+00:00 on every Tuesday, since 2024-05-14 is
a Tuesday.
- with an `execution_frequency` of "monthly", it will result in monthly
execution at 12:00:00+00:00 on the 14th day of every month.
Copy link
Contributor

Choose a reason for hiding this comment

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

Wonderful docstring

@adamsachs adamsachs merged commit ecab24e into main May 17, 2024
41 of 42 checks passed
@adamsachs adamsachs deleted the asachs/monitor-config-model-updates branch May 17, 2024 12:53
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