|
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;
|
|
125 | 126 | import com.linkedin.datahub.graphql.resolvers.dataproduct.DeleteDataProductResolver;
|
126 | 127 | import com.linkedin.datahub.graphql.resolvers.dataproduct.ListDataProductAssetsResolver;
|
127 | 128 | import com.linkedin.datahub.graphql.resolvers.dataproduct.UpdateDataProductResolver;
|
128 |
| -import com.linkedin.datahub.graphql.resolvers.dataset.DatasetHealthResolver; |
129 | 129 | import com.linkedin.datahub.graphql.resolvers.dataset.DatasetStatsSummaryResolver;
|
130 | 130 | import com.linkedin.datahub.graphql.resolvers.dataset.DatasetUsageStatsResolver;
|
131 | 131 | import com.linkedin.datahub.graphql.resolvers.deprecation.UpdateDeprecationResolver;
|
|
158 | 158 | import com.linkedin.datahub.graphql.resolvers.group.ListGroupsResolver;
|
159 | 159 | import com.linkedin.datahub.graphql.resolvers.group.RemoveGroupMembersResolver;
|
160 | 160 | 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; |
161 | 165 | import com.linkedin.datahub.graphql.resolvers.ingest.execution.CancelIngestionExecutionRequestResolver;
|
162 | 166 | import com.linkedin.datahub.graphql.resolvers.ingest.execution.CreateIngestionExecutionRequestResolver;
|
163 | 167 | import com.linkedin.datahub.graphql.resolvers.ingest.execution.CreateTestConnectionRequestResolver;
|
|
305 | 309 | import com.linkedin.datahub.graphql.types.form.FormType;
|
306 | 310 | import com.linkedin.datahub.graphql.types.glossary.GlossaryNodeType;
|
307 | 311 | import com.linkedin.datahub.graphql.types.glossary.GlossaryTermType;
|
| 312 | +import com.linkedin.datahub.graphql.types.incident.IncidentType; |
308 | 313 | import com.linkedin.datahub.graphql.types.mlmodel.MLFeatureTableType;
|
309 | 314 | import com.linkedin.datahub.graphql.types.mlmodel.MLFeatureType;
|
310 | 315 | import com.linkedin.datahub.graphql.types.mlmodel.MLModelGroupType;
|
@@ -460,6 +465,7 @@ public class GmsGraphQLEngine {
|
460 | 465 | private final DataTypeType dataTypeType;
|
461 | 466 | private final EntityTypeType entityTypeType;
|
462 | 467 | private final FormType formType;
|
| 468 | + private final IncidentType incidentType; |
463 | 469 |
|
464 | 470 | private final int graphQLQueryComplexityLimit;
|
465 | 471 | private final int graphQLQueryDepthLimit;
|
@@ -567,6 +573,7 @@ public GmsGraphQLEngine(final GmsGraphQLEngineArgs args) {
|
567 | 573 | this.dataTypeType = new DataTypeType(entityClient);
|
568 | 574 | this.entityTypeType = new EntityTypeType(entityClient);
|
569 | 575 | this.formType = new FormType(entityClient);
|
| 576 | + this.incidentType = new IncidentType(entityClient); |
570 | 577 |
|
571 | 578 | this.graphQLQueryComplexityLimit = args.graphQLQueryComplexityLimit;
|
572 | 579 | this.graphQLQueryDepthLimit = args.graphQLQueryDepthLimit;
|
@@ -609,7 +616,8 @@ public GmsGraphQLEngine(final GmsGraphQLEngineArgs args) {
|
609 | 616 | structuredPropertyType,
|
610 | 617 | dataTypeType,
|
611 | 618 | entityTypeType,
|
612 |
| - formType); |
| 619 | + formType, |
| 620 | + incidentType); |
613 | 621 | this.loadableTypes = new ArrayList<>(entityTypes);
|
614 | 622 | // Extend loadable types with types from the plugins
|
615 | 623 | // 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) {
|
698 | 706 | configurePluginResolvers(builder);
|
699 | 707 | configureStructuredPropertyResolvers(builder);
|
700 | 708 | configureFormResolvers(builder);
|
| 709 | + configureIncidentResolvers(builder); |
701 | 710 | }
|
702 | 711 |
|
703 | 712 | private void configureOrganisationRoleResolvers(RuntimeWiring.Builder builder) {
|
@@ -747,7 +756,8 @@ public GraphQLEngine.Builder builder() {
|
747 | 756 | .addSchema(fileBasedSchema(STEPS_SCHEMA_FILE))
|
748 | 757 | .addSchema(fileBasedSchema(LINEAGE_SCHEMA_FILE))
|
749 | 758 | .addSchema(fileBasedSchema(PROPERTIES_SCHEMA_FILE))
|
750 |
| - .addSchema(fileBasedSchema(FORMS_SCHEMA_FILE)); |
| 759 | + .addSchema(fileBasedSchema(FORMS_SCHEMA_FILE)) |
| 760 | + .addSchema(fileBasedSchema(INCIDENTS_SCHEMA_FILE)); |
751 | 761 |
|
752 | 762 | for (GmsGraphQLPlugin plugin : this.graphQLPlugins) {
|
753 | 763 | List<String> pluginSchemaFiles = plugin.getSchemaFiles();
|
@@ -1202,7 +1212,11 @@ private void configureMutationResolvers(final RuntimeWiring.Builder builder) {
|
1202 | 1212 | "createDynamicFormAssignment",
|
1203 | 1213 | new CreateDynamicFormAssignmentResolver(this.formService))
|
1204 | 1214 | .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))); |
1206 | 1220 | }
|
1207 | 1221 |
|
1208 | 1222 | private void configureGenericEntityResolvers(final RuntimeWiring.Builder builder) {
|
@@ -1485,7 +1499,12 @@ private void configureDatasetResolvers(final RuntimeWiring.Builder builder) {
|
1485 | 1499 | .dataFetcher("usageStats", new DatasetUsageStatsResolver(this.usageClient))
|
1486 | 1500 | .dataFetcher("statsSummary", new DatasetStatsSummaryResolver(this.usageClient))
|
1487 | 1501 | .dataFetcher(
|
1488 |
| - "health", new DatasetHealthResolver(graphClient, timeseriesAspectService)) |
| 1502 | + "health", |
| 1503 | + new EntityHealthResolver( |
| 1504 | + entityClient, |
| 1505 | + graphClient, |
| 1506 | + timeseriesAspectService, |
| 1507 | + new EntityHealthResolver.Config(true, true))) |
1489 | 1508 | .dataFetcher("schemaMetadata", new AspectResolver())
|
1490 | 1509 | .dataFetcher(
|
1491 | 1510 | "assertions", new EntityAssertionsResolver(entityClient, graphClient))
|
@@ -1834,7 +1853,14 @@ private void configureDashboardResolvers(final RuntimeWiring.Builder builder) {
|
1834 | 1853 | .dataFetcher(
|
1835 | 1854 | "statsSummary", new DashboardStatsSummaryResolver(timeseriesAspectService))
|
1836 | 1855 | .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)))); |
1838 | 1864 | builder.type(
|
1839 | 1865 | "DashboardInfo",
|
1840 | 1866 | typeWiring ->
|
@@ -1951,7 +1977,14 @@ private void configureChartResolvers(final RuntimeWiring.Builder builder) {
|
1951 | 1977 | .dataFetcher(
|
1952 | 1978 | "statsSummary", new ChartStatsSummaryResolver(this.timeseriesAspectService))
|
1953 | 1979 | .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)))); |
1955 | 1988 | builder.type(
|
1956 | 1989 | "ChartInfo",
|
1957 | 1990 | typeWiring ->
|
@@ -2056,7 +2089,14 @@ private void configureDataJobResolvers(final RuntimeWiring.Builder builder) {
|
2056 | 2089 | }))
|
2057 | 2090 | .dataFetcher("runs", new DataJobRunsResolver(entityClient))
|
2058 | 2091 | .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)))) |
2060 | 2100 | .type(
|
2061 | 2101 | "DataJobInputOutput",
|
2062 | 2102 | typeWiring ->
|
@@ -2119,7 +2159,14 @@ private void configureDataFlowResolvers(final RuntimeWiring.Builder builder) {
|
2119 | 2159 | return dataFlow.getDataPlatformInstance() != null
|
2120 | 2160 | ? dataFlow.getDataPlatformInstance().getUrn()
|
2121 | 2161 | : null;
|
2122 |
| - }))); |
| 2162 | + })) |
| 2163 | + .dataFetcher( |
| 2164 | + "health", |
| 2165 | + new EntityHealthResolver( |
| 2166 | + entityClient, |
| 2167 | + graphClient, |
| 2168 | + timeseriesAspectService, |
| 2169 | + new EntityHealthResolver.Config(false, true)))); |
2123 | 2170 | }
|
2124 | 2171 |
|
2125 | 2172 | /**
|
@@ -2660,4 +2707,35 @@ private void configureIngestionSourceResolvers(final RuntimeWiring.Builder build
|
2660 | 2707 | : null;
|
2661 | 2708 | })));
|
2662 | 2709 | }
|
| 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 | + } |
2663 | 2741 | }
|
0 commit comments