diff --git a/datahub-graphql-core/src/main/resources/assertions.graphql b/datahub-graphql-core/src/main/resources/assertions.graphql index 0ed264b20fe27..3014289e51178 100644 --- a/datahub-graphql-core/src/main/resources/assertions.graphql +++ b/datahub-graphql-core/src/main/resources/assertions.graphql @@ -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 } """ diff --git a/datahub-graphql-core/src/main/resources/entity.graphql b/datahub-graphql-core/src/main/resources/entity.graphql index 98d47e2cd4626..316bdd7ef5279 100644 --- a/datahub-graphql-core/src/main/resources/entity.graphql +++ b/datahub-graphql-core/src/main/resources/entity.graphql @@ -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 """ @@ -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 diff --git a/metadata-models/src/main/pegasus/com/linkedin/assertion/FreshnessAssertionSchedule.pdl b/metadata-models/src/main/pegasus/com/linkedin/assertion/FreshnessAssertionSchedule.pdl index a87342ad4f5ed..1905cb114e08c 100644 --- a/metadata-models/src/main/pegasus/com/linkedin/assertion/FreshnessAssertionSchedule.pdl +++ b/metadata-models/src/main/pegasus/com/linkedin/assertion/FreshnessAssertionSchedule.pdl @@ -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 @@ -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 } /** diff --git a/metadata-models/src/main/pegasus/com/linkedin/common/CronSchedule.pdl b/metadata-models/src/main/pegasus/com/linkedin/common/CronSchedule.pdl new file mode 100644 index 0000000000000..e59ef345186be --- /dev/null +++ b/metadata-models/src/main/pegasus/com/linkedin/common/CronSchedule.pdl @@ -0,0 +1,16 @@ +namespace com.linkedin.common + +/** +* Attributes defining a CRON-formatted schedule. +*/ +record CronSchedule { + /** + * 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 +} \ No newline at end of file