|
63 | 63 | import com.linkedin.datahub.graphql.generated.GlossaryNode;
|
64 | 64 | import com.linkedin.datahub.graphql.generated.GlossaryTerm;
|
65 | 65 | import com.linkedin.datahub.graphql.generated.GlossaryTermAssociation;
|
| 66 | +import com.linkedin.datahub.graphql.generated.IncidentSource; |
66 | 67 | import com.linkedin.datahub.graphql.generated.IngestionSource;
|
67 | 68 | import com.linkedin.datahub.graphql.generated.InstitutionalMemoryMetadata;
|
68 | 69 | import com.linkedin.datahub.graphql.generated.LineageRelationship;
|
|
89 | 90 | import com.linkedin.datahub.graphql.generated.ParentDomainsResult;
|
90 | 91 | import com.linkedin.datahub.graphql.generated.PolicyMatchCriterionValue;
|
91 | 92 | import com.linkedin.datahub.graphql.generated.QueryEntity;
|
| 93 | +import com.linkedin.datahub.graphql.generated.QueryProperties; |
92 | 94 | import com.linkedin.datahub.graphql.generated.QuerySubject;
|
93 | 95 | import com.linkedin.datahub.graphql.generated.QuickFilter;
|
94 | 96 | import com.linkedin.datahub.graphql.generated.RecommendationContent;
|
|
125 | 127 | import com.linkedin.datahub.graphql.resolvers.dataproduct.DeleteDataProductResolver;
|
126 | 128 | import com.linkedin.datahub.graphql.resolvers.dataproduct.ListDataProductAssetsResolver;
|
127 | 129 | import com.linkedin.datahub.graphql.resolvers.dataproduct.UpdateDataProductResolver;
|
128 |
| -import com.linkedin.datahub.graphql.resolvers.dataset.DatasetHealthResolver; |
129 | 130 | import com.linkedin.datahub.graphql.resolvers.dataset.DatasetStatsSummaryResolver;
|
130 | 131 | import com.linkedin.datahub.graphql.resolvers.dataset.DatasetUsageStatsResolver;
|
131 | 132 | import com.linkedin.datahub.graphql.resolvers.deprecation.UpdateDeprecationResolver;
|
|
158 | 159 | import com.linkedin.datahub.graphql.resolvers.group.ListGroupsResolver;
|
159 | 160 | import com.linkedin.datahub.graphql.resolvers.group.RemoveGroupMembersResolver;
|
160 | 161 | import com.linkedin.datahub.graphql.resolvers.group.RemoveGroupResolver;
|
| 162 | +import com.linkedin.datahub.graphql.resolvers.health.EntityHealthResolver; |
| 163 | +import com.linkedin.datahub.graphql.resolvers.incident.EntityIncidentsResolver; |
| 164 | +import com.linkedin.datahub.graphql.resolvers.incident.RaiseIncidentResolver; |
| 165 | +import com.linkedin.datahub.graphql.resolvers.incident.UpdateIncidentStatusResolver; |
161 | 166 | import com.linkedin.datahub.graphql.resolvers.ingest.execution.CancelIngestionExecutionRequestResolver;
|
162 | 167 | import com.linkedin.datahub.graphql.resolvers.ingest.execution.CreateIngestionExecutionRequestResolver;
|
163 | 168 | import com.linkedin.datahub.graphql.resolvers.ingest.execution.CreateTestConnectionRequestResolver;
|
|
305 | 310 | import com.linkedin.datahub.graphql.types.form.FormType;
|
306 | 311 | import com.linkedin.datahub.graphql.types.glossary.GlossaryNodeType;
|
307 | 312 | import com.linkedin.datahub.graphql.types.glossary.GlossaryTermType;
|
| 313 | +import com.linkedin.datahub.graphql.types.incident.IncidentType; |
308 | 314 | import com.linkedin.datahub.graphql.types.mlmodel.MLFeatureTableType;
|
309 | 315 | import com.linkedin.datahub.graphql.types.mlmodel.MLFeatureType;
|
310 | 316 | import com.linkedin.datahub.graphql.types.mlmodel.MLModelGroupType;
|
@@ -460,6 +466,7 @@ public class GmsGraphQLEngine {
|
460 | 466 | private final DataTypeType dataTypeType;
|
461 | 467 | private final EntityTypeType entityTypeType;
|
462 | 468 | private final FormType formType;
|
| 469 | + private final IncidentType incidentType; |
463 | 470 |
|
464 | 471 | private final int graphQLQueryComplexityLimit;
|
465 | 472 | private final int graphQLQueryDepthLimit;
|
@@ -567,6 +574,7 @@ public GmsGraphQLEngine(final GmsGraphQLEngineArgs args) {
|
567 | 574 | this.dataTypeType = new DataTypeType(entityClient);
|
568 | 575 | this.entityTypeType = new EntityTypeType(entityClient);
|
569 | 576 | this.formType = new FormType(entityClient);
|
| 577 | + this.incidentType = new IncidentType(entityClient); |
570 | 578 |
|
571 | 579 | this.graphQLQueryComplexityLimit = args.graphQLQueryComplexityLimit;
|
572 | 580 | this.graphQLQueryDepthLimit = args.graphQLQueryDepthLimit;
|
@@ -609,7 +617,8 @@ public GmsGraphQLEngine(final GmsGraphQLEngineArgs args) {
|
609 | 617 | structuredPropertyType,
|
610 | 618 | dataTypeType,
|
611 | 619 | entityTypeType,
|
612 |
| - formType); |
| 620 | + formType, |
| 621 | + incidentType); |
613 | 622 | this.loadableTypes = new ArrayList<>(entityTypes);
|
614 | 623 | // Extend loadable types with types from the plugins
|
615 | 624 | // This allows us to offer search and browse capabilities out of the box for those types
|
@@ -698,6 +707,7 @@ public void configureRuntimeWiring(final RuntimeWiring.Builder builder) {
|
698 | 707 | configurePluginResolvers(builder);
|
699 | 708 | configureStructuredPropertyResolvers(builder);
|
700 | 709 | configureFormResolvers(builder);
|
| 710 | + configureIncidentResolvers(builder); |
701 | 711 | }
|
702 | 712 |
|
703 | 713 | private void configureOrganisationRoleResolvers(RuntimeWiring.Builder builder) {
|
@@ -747,7 +757,8 @@ public GraphQLEngine.Builder builder() {
|
747 | 757 | .addSchema(fileBasedSchema(STEPS_SCHEMA_FILE))
|
748 | 758 | .addSchema(fileBasedSchema(LINEAGE_SCHEMA_FILE))
|
749 | 759 | .addSchema(fileBasedSchema(PROPERTIES_SCHEMA_FILE))
|
750 |
| - .addSchema(fileBasedSchema(FORMS_SCHEMA_FILE)); |
| 760 | + .addSchema(fileBasedSchema(FORMS_SCHEMA_FILE)) |
| 761 | + .addSchema(fileBasedSchema(INCIDENTS_SCHEMA_FILE)); |
751 | 762 |
|
752 | 763 | for (GmsGraphQLPlugin plugin : this.graphQLPlugins) {
|
753 | 764 | List<String> pluginSchemaFiles = plugin.getSchemaFiles();
|
@@ -1202,7 +1213,11 @@ private void configureMutationResolvers(final RuntimeWiring.Builder builder) {
|
1202 | 1213 | "createDynamicFormAssignment",
|
1203 | 1214 | new CreateDynamicFormAssignmentResolver(this.formService))
|
1204 | 1215 | .dataFetcher(
|
1205 |
| - "verifyForm", new VerifyFormResolver(this.formService, this.groupService))); |
| 1216 | + "verifyForm", new VerifyFormResolver(this.formService, this.groupService)) |
| 1217 | + .dataFetcher("raiseIncident", new RaiseIncidentResolver(this.entityClient)) |
| 1218 | + .dataFetcher( |
| 1219 | + "updateIncidentStatus", |
| 1220 | + new UpdateIncidentStatusResolver(this.entityClient, this.entityService))); |
1206 | 1221 | }
|
1207 | 1222 |
|
1208 | 1223 | private void configureGenericEntityResolvers(final RuntimeWiring.Builder builder) {
|
@@ -1485,7 +1500,12 @@ private void configureDatasetResolvers(final RuntimeWiring.Builder builder) {
|
1485 | 1500 | .dataFetcher("usageStats", new DatasetUsageStatsResolver(this.usageClient))
|
1486 | 1501 | .dataFetcher("statsSummary", new DatasetStatsSummaryResolver(this.usageClient))
|
1487 | 1502 | .dataFetcher(
|
1488 |
| - "health", new DatasetHealthResolver(graphClient, timeseriesAspectService)) |
| 1503 | + "health", |
| 1504 | + new EntityHealthResolver( |
| 1505 | + entityClient, |
| 1506 | + graphClient, |
| 1507 | + timeseriesAspectService, |
| 1508 | + new EntityHealthResolver.Config(true, true))) |
1489 | 1509 | .dataFetcher("schemaMetadata", new AspectResolver())
|
1490 | 1510 | .dataFetcher(
|
1491 | 1511 | "assertions", new EntityAssertionsResolver(entityClient, graphClient))
|
@@ -1834,7 +1854,14 @@ private void configureDashboardResolvers(final RuntimeWiring.Builder builder) {
|
1834 | 1854 | .dataFetcher(
|
1835 | 1855 | "statsSummary", new DashboardStatsSummaryResolver(timeseriesAspectService))
|
1836 | 1856 | .dataFetcher("privileges", new EntityPrivilegesResolver(entityClient))
|
1837 |
| - .dataFetcher("exists", new EntityExistsResolver(entityService))); |
| 1857 | + .dataFetcher("exists", new EntityExistsResolver(entityService)) |
| 1858 | + .dataFetcher( |
| 1859 | + "health", |
| 1860 | + new EntityHealthResolver( |
| 1861 | + entityClient, |
| 1862 | + graphClient, |
| 1863 | + timeseriesAspectService, |
| 1864 | + new EntityHealthResolver.Config(false, true)))); |
1838 | 1865 | builder.type(
|
1839 | 1866 | "DashboardInfo",
|
1840 | 1867 | typeWiring ->
|
@@ -1951,7 +1978,14 @@ private void configureChartResolvers(final RuntimeWiring.Builder builder) {
|
1951 | 1978 | .dataFetcher(
|
1952 | 1979 | "statsSummary", new ChartStatsSummaryResolver(this.timeseriesAspectService))
|
1953 | 1980 | .dataFetcher("privileges", new EntityPrivilegesResolver(entityClient))
|
1954 |
| - .dataFetcher("exists", new EntityExistsResolver(entityService))); |
| 1981 | + .dataFetcher("exists", new EntityExistsResolver(entityService)) |
| 1982 | + .dataFetcher( |
| 1983 | + "health", |
| 1984 | + new EntityHealthResolver( |
| 1985 | + entityClient, |
| 1986 | + graphClient, |
| 1987 | + timeseriesAspectService, |
| 1988 | + new EntityHealthResolver.Config(false, true)))); |
1955 | 1989 | builder.type(
|
1956 | 1990 | "ChartInfo",
|
1957 | 1991 | typeWiring ->
|
@@ -2056,7 +2090,14 @@ private void configureDataJobResolvers(final RuntimeWiring.Builder builder) {
|
2056 | 2090 | }))
|
2057 | 2091 | .dataFetcher("runs", new DataJobRunsResolver(entityClient))
|
2058 | 2092 | .dataFetcher("privileges", new EntityPrivilegesResolver(entityClient))
|
2059 |
| - .dataFetcher("exists", new EntityExistsResolver(entityService))) |
| 2093 | + .dataFetcher("exists", new EntityExistsResolver(entityService)) |
| 2094 | + .dataFetcher( |
| 2095 | + "health", |
| 2096 | + new EntityHealthResolver( |
| 2097 | + entityClient, |
| 2098 | + graphClient, |
| 2099 | + timeseriesAspectService, |
| 2100 | + new EntityHealthResolver.Config(false, true)))) |
2060 | 2101 | .type(
|
2061 | 2102 | "DataJobInputOutput",
|
2062 | 2103 | typeWiring ->
|
@@ -2119,7 +2160,14 @@ private void configureDataFlowResolvers(final RuntimeWiring.Builder builder) {
|
2119 | 2160 | return dataFlow.getDataPlatformInstance() != null
|
2120 | 2161 | ? dataFlow.getDataPlatformInstance().getUrn()
|
2121 | 2162 | : null;
|
2122 |
| - }))); |
| 2163 | + })) |
| 2164 | + .dataFetcher( |
| 2165 | + "health", |
| 2166 | + new EntityHealthResolver( |
| 2167 | + entityClient, |
| 2168 | + graphClient, |
| 2169 | + timeseriesAspectService, |
| 2170 | + new EntityHealthResolver.Config(false, true)))); |
2123 | 2171 | }
|
2124 | 2172 |
|
2125 | 2173 | /**
|
@@ -2536,9 +2584,27 @@ private void configureQueryEntityResolvers(final RuntimeWiring.Builder builder)
|
2536 | 2584 | builder
|
2537 | 2585 | .type(
|
2538 | 2586 | "QueryEntity",
|
| 2587 | + typeWiring -> |
| 2588 | + typeWiring |
| 2589 | + .dataFetcher( |
| 2590 | + "relationships", new EntityRelationshipsResultResolver(graphClient)) |
| 2591 | + .dataFetcher( |
| 2592 | + "platform", |
| 2593 | + new LoadableTypeResolver<>( |
| 2594 | + dataPlatformType, |
| 2595 | + (env) -> { |
| 2596 | + final QueryEntity query = env.getSource(); |
| 2597 | + return query.getPlatform() != null |
| 2598 | + ? query.getPlatform().getUrn() |
| 2599 | + : null; |
| 2600 | + }))) |
| 2601 | + .type( |
| 2602 | + "QueryProperties", |
2539 | 2603 | typeWiring ->
|
2540 | 2604 | typeWiring.dataFetcher(
|
2541 |
| - "relationships", new EntityRelationshipsResultResolver(graphClient))) |
| 2605 | + "origin", |
| 2606 | + new EntityTypeResolver( |
| 2607 | + entityTypes, (env) -> ((QueryProperties) env.getSource()).getOrigin()))) |
2542 | 2608 | .type(
|
2543 | 2609 | "ListQueriesResult",
|
2544 | 2610 | typeWiring ->
|
@@ -2660,4 +2726,35 @@ private void configureIngestionSourceResolvers(final RuntimeWiring.Builder build
|
2660 | 2726 | : null;
|
2661 | 2727 | })));
|
2662 | 2728 | }
|
| 2729 | + |
| 2730 | + private void configureIncidentResolvers(final RuntimeWiring.Builder builder) { |
| 2731 | + builder.type( |
| 2732 | + "Incident", |
| 2733 | + typeWiring -> |
| 2734 | + typeWiring.dataFetcher( |
| 2735 | + "relationships", new EntityRelationshipsResultResolver(graphClient))); |
| 2736 | + builder.type( |
| 2737 | + "IncidentSource", |
| 2738 | + typeWiring -> |
| 2739 | + typeWiring.dataFetcher( |
| 2740 | + "source", |
| 2741 | + new LoadableTypeResolver<>( |
| 2742 | + this.assertionType, |
| 2743 | + (env) -> { |
| 2744 | + final IncidentSource incidentSource = env.getSource(); |
| 2745 | + return incidentSource.getSource() != null |
| 2746 | + ? incidentSource.getSource().getUrn() |
| 2747 | + : null; |
| 2748 | + }))); |
| 2749 | + |
| 2750 | + // Add incidents attribute to all entities that support it |
| 2751 | + final List<String> entitiesWithIncidents = |
| 2752 | + ImmutableList.of("Dataset", "DataJob", "DataFlow", "Dashboard", "Chart"); |
| 2753 | + for (String entity : entitiesWithIncidents) { |
| 2754 | + builder.type( |
| 2755 | + entity, |
| 2756 | + typeWiring -> |
| 2757 | + typeWiring.dataFetcher("incidents", new EntityIncidentsResolver(entityClient))); |
| 2758 | + } |
| 2759 | + } |
2663 | 2760 | }
|
0 commit comments