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

feat(observe) expose assertion runId and lastObservedMillis to graphql #10726

Merged
merged 1 commit into from
Jun 17, 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
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public com.linkedin.datahub.graphql.generated.AssertionRunEvent apply(
final com.linkedin.datahub.graphql.generated.AssertionRunEvent assertionRunEvent =
new com.linkedin.datahub.graphql.generated.AssertionRunEvent();

assertionRunEvent.setLastObservedMillis(envelopedAspect.getSystemMetadata().getLastObserved());
assertionRunEvent.setTimestampMillis(gmsAssertionRunEvent.getTimestampMillis());
assertionRunEvent.setAssertionUrn(gmsAssertionRunEvent.getAssertionUrn().toString());
assertionRunEvent.setAsserteeUrn(gmsAssertionRunEvent.getAsserteeUrn().toString());
Expand Down
7 changes: 6 additions & 1 deletion datahub-graphql-core/src/main/resources/entity.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7404,6 +7404,11 @@ type AssertionRunEvent implements TimeSeriesAspect {
"""
timestampMillis: Long!

"""
The time at which the run event was last observed by the DataHub system - ie, when it was reported by external systems
"""
lastObservedMillis: Long

"""
Urn of assertion which is evaluated
"""
Expand All @@ -7420,7 +7425,7 @@ type AssertionRunEvent implements TimeSeriesAspect {
runId: String!

"""
The status of the assertion run as per this timeseries event.
The status of the assertion run as per this timeseries event
"""
status: AssertionRunStatus!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.linkedin.metadata.aspect.EnvelopedAspect;
import com.linkedin.metadata.query.filter.Filter;
import com.linkedin.metadata.utils.GenericRecordUtils;
import com.linkedin.mxe.SystemMetadata;
import graphql.schema.DataFetchingEnvironment;
import org.mockito.Mockito;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -58,7 +59,9 @@ public void testGetSuccess() throws Exception {
null, AssertionRunStatus.COMPLETE.toString()))))
.thenReturn(
ImmutableList.of(
new EnvelopedAspect().setAspect(GenericRecordUtils.serializeAspect(gmsRunEvent))));
new EnvelopedAspect()
.setAspect(GenericRecordUtils.serializeAspect(gmsRunEvent))
.setSystemMetadata(new SystemMetadata().setLastObserved(12L))));

AssertionRunEventResolver resolver = new AssertionRunEventResolver(mockClient);

Expand Down Expand Up @@ -108,6 +111,7 @@ public void testGetSuccess() throws Exception {
graphqlRunEvent.getStatus(),
com.linkedin.datahub.graphql.generated.AssertionRunStatus.COMPLETE);
assertEquals((float) graphqlRunEvent.getTimestampMillis(), 12L);
assertEquals((float) graphqlRunEvent.getLastObservedMillis(), 12L);
assertEquals((float) graphqlRunEvent.getResult().getActualAggValue(), 10);
assertEquals((long) graphqlRunEvent.getResult().getMissingCount(), 0L);
assertEquals((long) graphqlRunEvent.getResult().getRowCount(), 1L);
Expand Down
2 changes: 2 additions & 0 deletions datahub-web-react/src/graphql/assertion.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ fragment assertionDetails on Assertion {

fragment assertionRunEventDetails on AssertionRunEvent {
timestampMillis
lastObservedMillis
assertionUrn
status
runId
runtimeContext {
key
value
Expand Down
Loading