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(metadata-models) bridge gaps between graphql and pegasus models #10692

Merged
merged 3 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions datahub-graphql-core/src/main/resources/assertions.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ enum FreshnessAssertionScheduleType {
A scheduled based on a recurring fixed schedule which is used to compute the expected operation window. E.g. "every 24 hours".
"""
FIXED_INTERVAL

"""
A schedule computed based on when the assertion was last evaluated, to the current moment in time.
"""
SINCE_THE_LAST_CHECK
}

"""
Expand Down
14 changes: 12 additions & 2 deletions datahub-graphql-core/src/main/resources/entity.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7658,6 +7658,16 @@ enum AssertionStdOperator {
"""
EQUAL_TO

"""
Value being asserted is not equal to value
"""
NOT_EQUAL_TO

"""
Value being asserted is null
"""
NULL

"""
Value being asserted is not null
"""
Expand Down Expand Up @@ -7694,12 +7704,12 @@ enum AssertionStdOperator {
NOT_IN

"""
Value being asserted is true.
Value being asserted is true
"""
IS_TRUE

"""
Value being asserted is false.
Value being asserted is false
"""
IS_FALSE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ record FreshnessAssertionSchedule {
*/
type: enum FreshnessAssertionScheduleType {
/**
* An highly configurable recurring schedule which describes the times of events described
* A highly configurable recurring schedule which describes the times of events described
* by a CRON schedule, with the evaluation schedule assuming to be matching the cron schedule.
*
* In a CRON schedule type, we compute the look-back window to be the time between the last scheduled event
Expand Down Expand Up @@ -45,12 +45,31 @@ record FreshnessAssertionSchedule {
* to be evaluated each hour, we'd compute the result as follows:
*
* 1. Subtract the fixed interval from the current time (Evaluation time) to compute the bounds of a fixed look-back window.
* 2. Verify that the target event has occurred within the CRON-interval window.
* 2. Verify that the target event has occurred within the look-back window.
* 3. If the target event has occurred within the time window, then assertion passes.
* 4. If the target event has not occurred within the time window, then the assertion fails.
*
*/
FIXED_INTERVAL
/**
* A stateful check that takes the last time this check ran to determine the look-back window.
*
* To compute the valid look-back- window, we start at the time the monitor last evaluated this assertion,
* and we end at the point in time the check is currently running.
*
* For example, let's say a Freshness assertion is of type SINCE_THE_LAST_CHECK, and the monitor is configured to
* run every day at 12:00am. Let's assume this assertion was last evaluated yesterday at 12:04am. We'd compute
* the result as follows:
*
* 1. Get the timestamp for the last run of the monitor on this assertion.
* 2. look_back_window_start_time = latest_monitor_run.timestampMillis [ie. 12:04a yesterday]
* 3. look_back_window_end_time = nowMillis [ie. 12:02a today]
* 4. If the target event has occurred within the window [ie. 12:04a yday to 12:02a today],
* then the assertion passes.
* 5. If the target event has not occurred within the window, then the assertion fails.
*
*/
SINCE_THE_LAST_CHECK
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace com.linkedin.common

/**
* Attributes defining a CRON-formatted schedule.
*/
record CronSchedule {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this used anywhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The front end uses it for typing in a handful of places and it's used in SaaS for the backend in AssertionEvaluationSpec. I thought it'd be better to pull this model in for future uses too than try to refactor frontend on both OSS/SaaS to map CronSchedule from the backend type to a new frontend CronSchedule type.

Copy link
Collaborator

Choose a reason for hiding this comment

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

makes sense

/**
* A cron-formatted execution interval, as a cron string, e.g. 1 * * * *
*/
cron: string

/**
* Timezone in which the cron interval applies, e.g. America/Los Angeles
*/
timezone: string
}
Loading