Skip to content

Commit 0328f85

Browse files
jjoyce0510John JoyceJohn JoyceJohn Joyce
authored
feat(): Adding supports for data incidents for datasets, dashboards, charts, data jobs, data flows (#9710)
Co-authored-by: John Joyce <[email protected]> Co-authored-by: John Joyce <[email protected]> Co-authored-by: John Joyce <[email protected]>
1 parent c08d6b9 commit 0328f85

File tree

95 files changed

+6015
-95
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+6015
-95
lines changed

datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/Constants.java

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ private Constants() {}
2121
public static final String LINEAGE_SCHEMA_FILE = "lineage.graphql";
2222
public static final String PROPERTIES_SCHEMA_FILE = "properties.graphql";
2323
public static final String FORMS_SCHEMA_FILE = "forms.graphql";
24+
public static final String INCIDENTS_SCHEMA_FILE = "incident.graphql";
2425
public static final String BROWSE_PATH_DELIMITER = "/";
2526
public static final String BROWSE_PATH_V2_DELIMITER = "␟";
2627
public static final String VERSION_STAMP_FIELD_NAME = "versionStamp";

datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/GmsGraphQLEngine.java

+87-9
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import com.linkedin.datahub.graphql.generated.GlossaryNode;
6464
import com.linkedin.datahub.graphql.generated.GlossaryTerm;
6565
import com.linkedin.datahub.graphql.generated.GlossaryTermAssociation;
66+
import com.linkedin.datahub.graphql.generated.IncidentSource;
6667
import com.linkedin.datahub.graphql.generated.IngestionSource;
6768
import com.linkedin.datahub.graphql.generated.InstitutionalMemoryMetadata;
6869
import com.linkedin.datahub.graphql.generated.LineageRelationship;
@@ -125,7 +126,6 @@
125126
import com.linkedin.datahub.graphql.resolvers.dataproduct.DeleteDataProductResolver;
126127
import com.linkedin.datahub.graphql.resolvers.dataproduct.ListDataProductAssetsResolver;
127128
import com.linkedin.datahub.graphql.resolvers.dataproduct.UpdateDataProductResolver;
128-
import com.linkedin.datahub.graphql.resolvers.dataset.DatasetHealthResolver;
129129
import com.linkedin.datahub.graphql.resolvers.dataset.DatasetStatsSummaryResolver;
130130
import com.linkedin.datahub.graphql.resolvers.dataset.DatasetUsageStatsResolver;
131131
import com.linkedin.datahub.graphql.resolvers.deprecation.UpdateDeprecationResolver;
@@ -158,6 +158,10 @@
158158
import com.linkedin.datahub.graphql.resolvers.group.ListGroupsResolver;
159159
import com.linkedin.datahub.graphql.resolvers.group.RemoveGroupMembersResolver;
160160
import com.linkedin.datahub.graphql.resolvers.group.RemoveGroupResolver;
161+
import com.linkedin.datahub.graphql.resolvers.health.EntityHealthResolver;
162+
import com.linkedin.datahub.graphql.resolvers.incident.EntityIncidentsResolver;
163+
import com.linkedin.datahub.graphql.resolvers.incident.RaiseIncidentResolver;
164+
import com.linkedin.datahub.graphql.resolvers.incident.UpdateIncidentStatusResolver;
161165
import com.linkedin.datahub.graphql.resolvers.ingest.execution.CancelIngestionExecutionRequestResolver;
162166
import com.linkedin.datahub.graphql.resolvers.ingest.execution.CreateIngestionExecutionRequestResolver;
163167
import com.linkedin.datahub.graphql.resolvers.ingest.execution.CreateTestConnectionRequestResolver;
@@ -305,6 +309,7 @@
305309
import com.linkedin.datahub.graphql.types.form.FormType;
306310
import com.linkedin.datahub.graphql.types.glossary.GlossaryNodeType;
307311
import com.linkedin.datahub.graphql.types.glossary.GlossaryTermType;
312+
import com.linkedin.datahub.graphql.types.incident.IncidentType;
308313
import com.linkedin.datahub.graphql.types.mlmodel.MLFeatureTableType;
309314
import com.linkedin.datahub.graphql.types.mlmodel.MLFeatureType;
310315
import com.linkedin.datahub.graphql.types.mlmodel.MLModelGroupType;
@@ -460,6 +465,7 @@ public class GmsGraphQLEngine {
460465
private final DataTypeType dataTypeType;
461466
private final EntityTypeType entityTypeType;
462467
private final FormType formType;
468+
private final IncidentType incidentType;
463469

464470
private final int graphQLQueryComplexityLimit;
465471
private final int graphQLQueryDepthLimit;
@@ -567,6 +573,7 @@ public GmsGraphQLEngine(final GmsGraphQLEngineArgs args) {
567573
this.dataTypeType = new DataTypeType(entityClient);
568574
this.entityTypeType = new EntityTypeType(entityClient);
569575
this.formType = new FormType(entityClient);
576+
this.incidentType = new IncidentType(entityClient);
570577

571578
this.graphQLQueryComplexityLimit = args.graphQLQueryComplexityLimit;
572579
this.graphQLQueryDepthLimit = args.graphQLQueryDepthLimit;
@@ -609,7 +616,8 @@ public GmsGraphQLEngine(final GmsGraphQLEngineArgs args) {
609616
structuredPropertyType,
610617
dataTypeType,
611618
entityTypeType,
612-
formType);
619+
formType,
620+
incidentType);
613621
this.loadableTypes = new ArrayList<>(entityTypes);
614622
// Extend loadable types with types from the plugins
615623
// This allows us to offer search and browse capabilities out of the box for those types
@@ -698,6 +706,7 @@ public void configureRuntimeWiring(final RuntimeWiring.Builder builder) {
698706
configurePluginResolvers(builder);
699707
configureStructuredPropertyResolvers(builder);
700708
configureFormResolvers(builder);
709+
configureIncidentResolvers(builder);
701710
}
702711

703712
private void configureOrganisationRoleResolvers(RuntimeWiring.Builder builder) {
@@ -747,7 +756,8 @@ public GraphQLEngine.Builder builder() {
747756
.addSchema(fileBasedSchema(STEPS_SCHEMA_FILE))
748757
.addSchema(fileBasedSchema(LINEAGE_SCHEMA_FILE))
749758
.addSchema(fileBasedSchema(PROPERTIES_SCHEMA_FILE))
750-
.addSchema(fileBasedSchema(FORMS_SCHEMA_FILE));
759+
.addSchema(fileBasedSchema(FORMS_SCHEMA_FILE))
760+
.addSchema(fileBasedSchema(INCIDENTS_SCHEMA_FILE));
751761

752762
for (GmsGraphQLPlugin plugin : this.graphQLPlugins) {
753763
List<String> pluginSchemaFiles = plugin.getSchemaFiles();
@@ -1202,7 +1212,11 @@ private void configureMutationResolvers(final RuntimeWiring.Builder builder) {
12021212
"createDynamicFormAssignment",
12031213
new CreateDynamicFormAssignmentResolver(this.formService))
12041214
.dataFetcher(
1205-
"verifyForm", new VerifyFormResolver(this.formService, this.groupService)));
1215+
"verifyForm", new VerifyFormResolver(this.formService, this.groupService))
1216+
.dataFetcher("raiseIncident", new RaiseIncidentResolver(this.entityClient))
1217+
.dataFetcher(
1218+
"updateIncidentStatus",
1219+
new UpdateIncidentStatusResolver(this.entityClient, this.entityService)));
12061220
}
12071221

12081222
private void configureGenericEntityResolvers(final RuntimeWiring.Builder builder) {
@@ -1485,7 +1499,12 @@ private void configureDatasetResolvers(final RuntimeWiring.Builder builder) {
14851499
.dataFetcher("usageStats", new DatasetUsageStatsResolver(this.usageClient))
14861500
.dataFetcher("statsSummary", new DatasetStatsSummaryResolver(this.usageClient))
14871501
.dataFetcher(
1488-
"health", new DatasetHealthResolver(graphClient, timeseriesAspectService))
1502+
"health",
1503+
new EntityHealthResolver(
1504+
entityClient,
1505+
graphClient,
1506+
timeseriesAspectService,
1507+
new EntityHealthResolver.Config(true, true)))
14891508
.dataFetcher("schemaMetadata", new AspectResolver())
14901509
.dataFetcher(
14911510
"assertions", new EntityAssertionsResolver(entityClient, graphClient))
@@ -1834,7 +1853,14 @@ private void configureDashboardResolvers(final RuntimeWiring.Builder builder) {
18341853
.dataFetcher(
18351854
"statsSummary", new DashboardStatsSummaryResolver(timeseriesAspectService))
18361855
.dataFetcher("privileges", new EntityPrivilegesResolver(entityClient))
1837-
.dataFetcher("exists", new EntityExistsResolver(entityService)));
1856+
.dataFetcher("exists", new EntityExistsResolver(entityService))
1857+
.dataFetcher(
1858+
"health",
1859+
new EntityHealthResolver(
1860+
entityClient,
1861+
graphClient,
1862+
timeseriesAspectService,
1863+
new EntityHealthResolver.Config(false, true))));
18381864
builder.type(
18391865
"DashboardInfo",
18401866
typeWiring ->
@@ -1951,7 +1977,14 @@ private void configureChartResolvers(final RuntimeWiring.Builder builder) {
19511977
.dataFetcher(
19521978
"statsSummary", new ChartStatsSummaryResolver(this.timeseriesAspectService))
19531979
.dataFetcher("privileges", new EntityPrivilegesResolver(entityClient))
1954-
.dataFetcher("exists", new EntityExistsResolver(entityService)));
1980+
.dataFetcher("exists", new EntityExistsResolver(entityService))
1981+
.dataFetcher(
1982+
"health",
1983+
new EntityHealthResolver(
1984+
entityClient,
1985+
graphClient,
1986+
timeseriesAspectService,
1987+
new EntityHealthResolver.Config(false, true))));
19551988
builder.type(
19561989
"ChartInfo",
19571990
typeWiring ->
@@ -2056,7 +2089,14 @@ private void configureDataJobResolvers(final RuntimeWiring.Builder builder) {
20562089
}))
20572090
.dataFetcher("runs", new DataJobRunsResolver(entityClient))
20582091
.dataFetcher("privileges", new EntityPrivilegesResolver(entityClient))
2059-
.dataFetcher("exists", new EntityExistsResolver(entityService)))
2092+
.dataFetcher("exists", new EntityExistsResolver(entityService))
2093+
.dataFetcher(
2094+
"health",
2095+
new EntityHealthResolver(
2096+
entityClient,
2097+
graphClient,
2098+
timeseriesAspectService,
2099+
new EntityHealthResolver.Config(false, true))))
20602100
.type(
20612101
"DataJobInputOutput",
20622102
typeWiring ->
@@ -2119,7 +2159,14 @@ private void configureDataFlowResolvers(final RuntimeWiring.Builder builder) {
21192159
return dataFlow.getDataPlatformInstance() != null
21202160
? dataFlow.getDataPlatformInstance().getUrn()
21212161
: null;
2122-
})));
2162+
}))
2163+
.dataFetcher(
2164+
"health",
2165+
new EntityHealthResolver(
2166+
entityClient,
2167+
graphClient,
2168+
timeseriesAspectService,
2169+
new EntityHealthResolver.Config(false, true))));
21232170
}
21242171

21252172
/**
@@ -2660,4 +2707,35 @@ private void configureIngestionSourceResolvers(final RuntimeWiring.Builder build
26602707
: null;
26612708
})));
26622709
}
2710+
2711+
private void configureIncidentResolvers(final RuntimeWiring.Builder builder) {
2712+
builder.type(
2713+
"Incident",
2714+
typeWiring ->
2715+
typeWiring.dataFetcher(
2716+
"relationships", new EntityRelationshipsResultResolver(graphClient)));
2717+
builder.type(
2718+
"IncidentSource",
2719+
typeWiring ->
2720+
typeWiring.dataFetcher(
2721+
"source",
2722+
new LoadableTypeResolver<>(
2723+
this.assertionType,
2724+
(env) -> {
2725+
final IncidentSource incidentSource = env.getSource();
2726+
return incidentSource.getSource() != null
2727+
? incidentSource.getSource().getUrn()
2728+
: null;
2729+
})));
2730+
2731+
// Add incidents attribute to all entities that support it
2732+
final List<String> entitiesWithIncidents =
2733+
ImmutableList.of("Dataset", "DataJob", "DataFlow", "Dashboard", "Chart");
2734+
for (String entity : entitiesWithIncidents) {
2735+
builder.type(
2736+
entity,
2737+
typeWiring ->
2738+
typeWiring.dataFetcher("incidents", new EntityIncidentsResolver(entityClient)));
2739+
}
2740+
}
26632741
}

0 commit comments

Comments
 (0)