@finos/legend-graph 22.3.0 → 23.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/lib/graph/BasicModel.d.ts +5 -5
  2. package/lib/graph/BasicModel.d.ts.map +1 -1
  3. package/lib/graph/BasicModel.js +8 -7
  4. package/lib/graph/BasicModel.js.map +1 -1
  5. package/lib/graph/DependencyManager.d.ts +3 -2
  6. package/lib/graph/DependencyManager.d.ts.map +1 -1
  7. package/lib/graph/DependencyManager.js +8 -4
  8. package/lib/graph/DependencyManager.js.map +1 -1
  9. package/lib/graphManager/AbstractPureGraphManager.d.ts +16 -16
  10. package/lib/graphManager/AbstractPureGraphManager.d.ts.map +1 -1
  11. package/lib/graphManager/AbstractPureGraphManager.js.map +1 -1
  12. package/lib/graphManager/GraphManagerEvent.d.ts +24 -21
  13. package/lib/graphManager/GraphManagerEvent.d.ts.map +1 -1
  14. package/lib/graphManager/GraphManagerEvent.js +26 -21
  15. package/lib/graphManager/GraphManagerEvent.js.map +1 -1
  16. package/lib/graphManager/{GraphBuilderReport.d.ts → GraphManagerMetrics.d.ts} +12 -9
  17. package/lib/graphManager/GraphManagerMetrics.d.ts.map +1 -0
  18. package/lib/graphManager/GraphManagerMetrics.js +66 -0
  19. package/lib/graphManager/GraphManagerMetrics.js.map +1 -0
  20. package/lib/graphManager/GraphManagerTelemetry.d.ts +8 -6
  21. package/lib/graphManager/GraphManagerTelemetry.d.ts.map +1 -1
  22. package/lib/graphManager/GraphManagerTelemetry.js +2 -2
  23. package/lib/graphManager/GraphManagerTelemetry.js.map +1 -1
  24. package/lib/graphManager/action/changeDetection/GraphObserverHelper.d.ts.map +1 -1
  25. package/lib/graphManager/action/changeDetection/GraphObserverHelper.js +2 -0
  26. package/lib/graphManager/action/changeDetection/GraphObserverHelper.js.map +1 -1
  27. package/lib/graphManager/protocol/pure/v1/V1_PureGraphManager.d.ts +21 -19
  28. package/lib/graphManager/protocol/pure/v1/V1_PureGraphManager.d.ts.map +1 -1
  29. package/lib/graphManager/protocol/pure/v1/V1_PureGraphManager.js +165 -82
  30. package/lib/graphManager/protocol/pure/v1/V1_PureGraphManager.js.map +1 -1
  31. package/lib/graphManager/protocol/pure/v1/engine/V1_Engine.d.ts +7 -5
  32. package/lib/graphManager/protocol/pure/v1/engine/V1_Engine.d.ts.map +1 -1
  33. package/lib/graphManager/protocol/pure/v1/engine/V1_Engine.js +18 -11
  34. package/lib/graphManager/protocol/pure/v1/engine/V1_Engine.js.map +1 -1
  35. package/lib/graphManager/protocol/pure/v1/engine/V1_EngineServerClient.d.ts +3 -3
  36. package/lib/graphManager/protocol/pure/v1/engine/V1_EngineServerClient.d.ts.map +1 -1
  37. package/lib/graphManager/protocol/pure/v1/engine/V1_EngineServerClient.js +1 -1
  38. package/lib/graphManager/protocol/pure/v1/engine/V1_EngineServerClient.js.map +1 -1
  39. package/lib/graphManager/protocol/pure/v1/engine/compilation/{V1_LambdaReturnTypeResult.d.ts → V1_LambdaReturnType.d.ts} +10 -1
  40. package/lib/graphManager/protocol/pure/v1/engine/compilation/V1_LambdaReturnType.d.ts.map +1 -0
  41. package/lib/graphManager/protocol/pure/v1/engine/compilation/V1_LambdaReturnType.js +32 -0
  42. package/lib/graphManager/protocol/pure/v1/engine/compilation/V1_LambdaReturnType.js.map +1 -0
  43. package/lib/graphManager/protocol/pure/v1/engine/test/V1_RunTestsInput.d.ts +2 -2
  44. package/lib/graphManager/protocol/pure/v1/engine/test/V1_RunTestsInput.d.ts.map +1 -1
  45. package/lib/graphManager/protocol/pure/v1/engine/test/V1_RunTestsInput.js +3 -3
  46. package/lib/graphManager/protocol/pure/v1/engine/test/V1_RunTestsInput.js.map +1 -1
  47. package/lib/graphManager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementThirdPassBuilder.js +2 -2
  48. package/lib/graphManager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementThirdPassBuilder.js.map +1 -1
  49. package/lib/graphManager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_MilestoneBuilderHelper.d.ts +1 -1
  50. package/lib/graphManager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_MilestoneBuilderHelper.d.ts.map +1 -1
  51. package/lib/graphManager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_MilestoneBuilderHelper.js +6 -6
  52. package/lib/graphManager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_MilestoneBuilderHelper.js.map +1 -1
  53. package/lib/index.d.ts +3 -2
  54. package/lib/index.d.ts.map +1 -1
  55. package/lib/index.js +3 -2
  56. package/lib/index.js.map +1 -1
  57. package/lib/package.json +2 -2
  58. package/package.json +5 -5
  59. package/src/graph/BasicModel.ts +9 -7
  60. package/src/graph/DependencyManager.ts +31 -12
  61. package/src/graphManager/AbstractPureGraphManager.ts +38 -24
  62. package/src/graphManager/GraphManagerEvent.ts +27 -21
  63. package/src/graphManager/GraphManagerMetrics.ts +93 -0
  64. package/src/graphManager/GraphManagerTelemetry.ts +13 -8
  65. package/src/graphManager/action/changeDetection/GraphObserverHelper.ts +3 -0
  66. package/src/graphManager/protocol/pure/v1/V1_PureGraphManager.ts +317 -146
  67. package/src/graphManager/protocol/pure/v1/engine/V1_Engine.ts +28 -20
  68. package/src/graphManager/protocol/pure/v1/engine/V1_EngineServerClient.ts +7 -5
  69. package/src/graphManager/protocol/pure/v1/engine/compilation/V1_LambdaReturnType.ts +43 -0
  70. package/src/graphManager/protocol/pure/v1/engine/test/V1_RunTestsInput.ts +5 -4
  71. package/src/graphManager/protocol/pure/v1/transformation/pureGraph/to/V1_ElementThirdPassBuilder.ts +2 -2
  72. package/src/graphManager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_MilestoneBuilderHelper.ts +6 -6
  73. package/src/index.ts +3 -2
  74. package/tsconfig.json +2 -2
  75. package/lib/graphManager/GraphBuilderReport.d.ts.map +0 -1
  76. package/lib/graphManager/GraphBuilderReport.js +0 -24
  77. package/lib/graphManager/GraphBuilderReport.js.map +0 -1
  78. package/lib/graphManager/protocol/pure/v1/engine/compilation/V1_LambdaReturnTypeResult.d.ts.map +0 -1
  79. package/lib/graphManager/protocol/pure/v1/engine/compilation/V1_LambdaReturnTypeResult.js +0 -17
  80. package/lib/graphManager/protocol/pure/v1/engine/compilation/V1_LambdaReturnTypeResult.js.map +0 -1
  81. package/src/graphManager/GraphBuilderReport.ts +0 -32
  82. package/src/graphManager/protocol/pure/v1/engine/compilation/V1_LambdaReturnTypeResult.ts +0 -19
@@ -52,11 +52,15 @@ import {
52
52
  type TracerService,
53
53
  } from '@finos/legend-shared';
54
54
  import type { LightQuery, Query, QueryInfo } from './action/query/Query.js';
55
- import type { Entity, LegendSDLC } from '@finos/legend-storage';
55
+ import type {
56
+ EntitiesWithOrigin,
57
+ Entity,
58
+ GraphDataOrigin,
59
+ } from '@finos/legend-storage';
56
60
  import type { QuerySearchSpecification } from './action/query/QuerySearchSpecification.js';
57
61
  import type { ExternalFormatDescription } from './action/externalFormat/ExternalFormatDescription.js';
58
62
  import type { ConfigurationProperty } from '../graph/metamodel/pure/packageableElements/fileGeneration/ConfigurationProperty.js';
59
- import type { GraphBuilderReport } from './GraphBuilderReport.js';
63
+ import type { GraphManagerOperationReport } from './GraphManagerMetrics.js';
60
64
  import type { RunTestsTestableInput } from '../graph/metamodel/pure/test/result/RunTestsTestableInput.js';
61
65
  import type { TestResult } from '../graph/metamodel/pure/test/result/TestResult.js';
62
66
  import type { GraphManagerPluginManager } from './GraphManagerPluginManager.js';
@@ -101,7 +105,7 @@ export interface GraphBuilderOptions {
101
105
  /**
102
106
  * This ties a graph to an sdlc pointer. Meaning the graph is immutable and tied to a specific `versioned` SDLC.
103
107
  */
104
- sdlc?: LegendSDLC | undefined;
108
+ origin?: GraphDataOrigin | undefined;
105
109
  }
106
110
 
107
111
  export interface ExecutionOptions {
@@ -187,7 +191,8 @@ export abstract class AbstractPureGraphManager {
187
191
  systemModel: SystemModel,
188
192
  buildState: ActionState,
189
193
  options?: GraphBuilderOptions,
190
- ): Promise<GraphBuilderReport>;
194
+ report?: GraphManagerOperationReport,
195
+ ): Promise<void>;
191
196
 
192
197
  /**
193
198
  * Build immutable models which holds dependencies.
@@ -201,10 +206,11 @@ export abstract class AbstractPureGraphManager {
201
206
  coreModel: CoreModel,
202
207
  systemModel: SystemModel,
203
208
  dependencyManager: DependencyManager,
204
- dependencyEntitiesIndex: Map<string, Entity[]>,
209
+ dependencyEntitiesIndex: Map<string, EntitiesWithOrigin>,
205
210
  buildState: ActionState,
206
211
  options?: GraphBuilderOptions,
207
- ): Promise<GraphBuilderReport>;
212
+ report?: GraphManagerOperationReport,
213
+ ): Promise<void>;
208
214
 
209
215
  /**
210
216
  * Process entities and build the main graph.
@@ -214,7 +220,8 @@ export abstract class AbstractPureGraphManager {
214
220
  entities: Entity[],
215
221
  buildState: ActionState,
216
222
  options?: GraphBuilderOptions,
217
- ): Promise<GraphBuilderReport>;
223
+ report?: GraphManagerOperationReport,
224
+ ): Promise<void>;
218
225
 
219
226
  /**
220
227
  * Process entities and build the light graph.
@@ -224,14 +231,16 @@ export abstract class AbstractPureGraphManager {
224
231
  entities: Entity[],
225
232
  buildState: ActionState,
226
233
  options?: GraphBuilderOptions,
227
- ): Promise<GraphBuilderReport>;
234
+ report?: GraphManagerOperationReport,
235
+ ): Promise<void>;
228
236
 
229
237
  abstract buildGenerations(
230
238
  graph: PureModel,
231
239
  generationEntities: Map<string, Entity[]>,
232
240
  buildState: ActionState,
233
241
  options?: GraphBuilderOptions,
234
- ): Promise<GraphBuilderReport>;
242
+ report?: GraphManagerOperationReport,
243
+ ): Promise<void>;
235
244
 
236
245
  // ------------------------------------------- Grammar -------------------------------------------
237
246
 
@@ -278,11 +287,13 @@ export abstract class AbstractPureGraphManager {
278
287
  onError?: () => void;
279
288
  keepSourceInformation?: boolean;
280
289
  },
290
+ report?: GraphManagerOperationReport,
281
291
  ): Promise<CompilationResult>;
282
292
  abstract compileText(
283
293
  graphGrammar: string,
284
294
  graph: PureModel,
285
295
  options?: { onError?: () => void },
296
+ report?: GraphManagerOperationReport,
286
297
  ): Promise<TextCompilationResult>;
287
298
  abstract getLambdaReturnType(
288
299
  lambda: RawLambda,
@@ -290,7 +301,7 @@ export abstract class AbstractPureGraphManager {
290
301
  options?: { keepSourceInformation?: boolean },
291
302
  ): Promise<string>;
292
303
 
293
- // ------------------------------------------- Test -------------------------------------------
304
+ // ------------------------------------------- Test -------------------------------------------
294
305
 
295
306
  abstract runTests(
296
307
  inputs: RunTestsTestableInput[],
@@ -304,7 +315,7 @@ export abstract class AbstractPureGraphManager {
304
315
  graph: PureModel,
305
316
  ): Promise<AssertFail>;
306
317
 
307
- // ------------------------------------------- Value Specification -------------------------------------------
318
+ // ------------------------------------------- Value Specification -------------------------------------------
308
319
 
309
320
  abstract buildValueSpecification(
310
321
  json: PlainObject,
@@ -351,14 +362,12 @@ export abstract class AbstractPureGraphManager {
351
362
  abstract getAvailableExternalFormatsDescriptions(): Promise<
352
363
  ExternalFormatDescription[]
353
364
  >;
354
-
355
365
  abstract generateModelFromExternalFormat(
356
366
  schemaSet: SchemaSet,
357
367
  targetBinding: string | undefined,
358
368
  configs: ConfigurationProperty[],
359
369
  graph: PureModel,
360
370
  ): Promise<string>;
361
-
362
371
  abstract generateSchemaFromExternalFormatConfig(
363
372
  modelUnit: ModelUnit,
364
373
  targetBinding: string | undefined,
@@ -367,6 +376,7 @@ export abstract class AbstractPureGraphManager {
367
376
  ): Promise<SchemaSet[]>;
368
377
 
369
378
  // ------------------------------------------- Import -------------------------------------------
379
+
370
380
  abstract getExamplePureProtocolText(): string;
371
381
  abstract getExampleExternalFormatImportText(): string;
372
382
  abstract entitiesToPureProtocolText(entities: Entity[]): Promise<string>;
@@ -380,6 +390,7 @@ export abstract class AbstractPureGraphManager {
380
390
  runtime: Runtime | undefined,
381
391
  graph: PureModel,
382
392
  options?: ExecutionOptions,
393
+ report?: GraphManagerOperationReport,
383
394
  ): Promise<ExecutionResult>;
384
395
 
385
396
  abstract generateExecutionPlan(
@@ -387,6 +398,7 @@ export abstract class AbstractPureGraphManager {
387
398
  mapping: Mapping | undefined,
388
399
  runtime: Runtime | undefined,
389
400
  graph: PureModel,
401
+ report?: GraphManagerOperationReport,
390
402
  ): Promise<RawExecutionPlan>;
391
403
 
392
404
  abstract debugExecutionPlanGeneration(
@@ -394,19 +406,9 @@ export abstract class AbstractPureGraphManager {
394
406
  mapping: Mapping | undefined,
395
407
  runtime: Runtime | undefined,
396
408
  graph: PureModel,
409
+ report?: GraphManagerOperationReport,
397
410
  ): Promise<{ plan: RawExecutionPlan; debug: string }>;
398
411
 
399
- abstract buildExecutionPlan(
400
- executionPlanJson: RawExecutionPlan,
401
- graph: PureModel,
402
- ): ExecutionPlan;
403
-
404
- abstract serializeExecutionPlan(
405
- executionPlan: ExecutionPlan,
406
- ): RawExecutionPlan;
407
-
408
- abstract serializeExecutionNode(executionNode: ExecutionNode): object;
409
-
410
412
  abstract generateExecuteTestData(
411
413
  lambda: RawLambda,
412
414
  parameters: (string | number | boolean)[],
@@ -417,8 +419,20 @@ export abstract class AbstractPureGraphManager {
417
419
  // Anonymizes data by hashing any string values in the generated data
418
420
  anonymizeGeneratedData?: boolean;
419
421
  },
422
+ report?: GraphManagerOperationReport,
420
423
  ): Promise<string>;
421
424
 
425
+ abstract buildExecutionPlan(
426
+ executionPlanJson: RawExecutionPlan,
427
+ graph: PureModel,
428
+ ): ExecutionPlan;
429
+
430
+ abstract serializeExecutionPlan(
431
+ executionPlan: ExecutionPlan,
432
+ ): RawExecutionPlan;
433
+
434
+ abstract serializeExecutionNode(executionNode: ExecutionNode): object;
435
+
422
436
  // ------------------------------------------- Service -------------------------------------------
423
437
  /**
424
438
  * @modularize
@@ -15,29 +15,35 @@
15
15
  */
16
16
 
17
17
  export enum GRAPH_MANAGER_EVENT {
18
- GRAPH_BUILDER_ELEMENTS_DESERIALIZED = 'graph-manager.graph-builder.deserialization.success',
19
- GRAPH_BUILDER_ELEMENTS_INDEXED = 'graph-manager.graph-builder.indexing.success',
20
- GRAPH_BUILDER_SECTION_INDICES_BUILT = 'graph-manager.graph-builder.build-section-indices.success',
21
- GRAPH_BUILDER_DOMAIN_MODELS_BUILT = 'graph-manager.graph-builder.build-domain-models.success',
22
- GRAPH_BUILDER_STORES_BUILT = 'graph-manager.graph-builder.build-store.success',
23
- GRAPH_BUILDER_MAPPINGS_BUILT = 'graph-manager.graph-builder.build-mappings.success',
24
- GRAPH_BUILDER_CONNECTIONS_AND_RUNTIMES_BUILT = 'graph-manager.graph-builder.build-connections-and-runtimes.success',
25
- GRAPH_BUILDER_SERVICES_BUILT = 'graph-manager.graph-builder.build-services.success',
26
- GRAPH_BUILDER_DATA_ELEMENTS_BUILT = 'graph-manager.graph-builder.build-data.success',
27
- GRAPH_BUILDER_OTHER_ELEMENTS_BUILT = 'graph-manager.graph-builder.build-other-elements.success',
28
- GRAPH_BUILDER_COMPLETED = 'graph-manager.graph-builder.success',
18
+ GRAPH_BUILDER_DESERIALIZE_ELEMENTS__SUCCESS = 'graph-manager.graph-builder.deserialization.success',
19
+ GRAPH_BUILDER_INDEX_ELEMENTS__SUCCESS = 'graph-manager.graph-builder.indexing.success',
20
+ GRAPH_BUILDER_BUILD_SECTION_INDICES__SUCCESS = 'graph-manager.graph-builder.build-section-indices.success',
21
+ GRAPH_BUILDER_BUILD_DOMAIN_MODELS__SUCCESS = 'graph-manager.graph-builder.build-domain-models.success',
22
+ GRAPH_BUILDER_BUILD_STORES__SUCCESS = 'graph-manager.graph-builder.build-store.success',
23
+ GRAPH_BUILDER_BUILD_MAPPINGS__SUCCESS = 'graph-manager.graph-builder.build-mappings.success',
24
+ GRAPH_BUILDER_BUILD_CONNECTIONS_AND_RUNTIMES__SUCCESS = 'graph-manager.graph-builder.build-connections-and-runtimes.success',
25
+ GRAPH_BUILDER_BUILD_SERVICES__SUCCESS = 'graph-manager.graph-builder.build-services.success',
26
+ GRAPH_BUILDER_BUILD_DATA_ELEMENTS__SUCCESS = 'graph-manager.graph-builder.build-data.success',
27
+ GRAPH_BUILDER_BUILD_OTHER_ELEMENTS__SUCCESS = 'graph-manager.graph-builder.build-other-elements.success',
28
+ GRAPH_BUILDER_BUILD_GRAPH__SUCCESS = 'graph-manager.graph-builder.success',
29
29
 
30
- GRAPH_SYSTEM_INITIALIZED = 'graph-manager.system-initialization.success',
31
- GRAPH_INITIALIZED = 'graph-manager.graph-initialization.success',
32
- GRAPH_DEPENDENCIES_FETCHED = 'graph-manager.fetch-dependencies.success',
33
- GRAPH_ENTITIES_FETCHED = 'graph-manager.entities-dependencies.success',
34
- GRAPH_UPDATED_AND_REBUILT = 'graph-manager.rebuild.success',
35
- GRAPH_MODEL_TO_GRAMMAR_TRANSFORMED = 'graph-manager.grammar.composing.success',
36
- GRAPH_GRAMMAR_TO_MODEL_TRANSFORMED = 'graph-manager.grammar.parsing.success',
37
- GRAPH_META_MODEL_TO_PROTOCOL_TRANSFORMED = 'graph-manager.transformation.success',
38
- GRAPH_COMPILE_CONTEXT_COLLECTED = 'graph-manager.build-graph-compile-context.success',
39
- GRAPH_PROTOCOL_SERIALIZED = 'graph-manager.graph-serialization.success',
30
+ INITIALIZE_GRAPH__SUCCESS = 'graph-manager.graph-initialization.success',
31
+ INITIALIZE_GRAPH_SYSTEM__SUCCESS = 'graph-manager.system-initialization.success',
32
+ FETCH_GRAPH_DEPENDENCIES__SUCCESS = 'graph-manager.fetch-dependencies.success',
33
+ FETCH_GRAPH_ENTITIES__SUCCESS = 'graph-manager.entities-dependencies.success',
34
+ TRANSFORM_GRAPH_META_MODEL_TO_PROTOCOL__SUCCESS = 'graph-manager.transformation.success',
35
+ COLLECT_GRAPH_COMPILE_CONTEXT__SUCCESS = 'graph-manager.build-graph-compile-context.success',
36
+ SERIALIZE_GRAPH_PROTOCOL__SUCCESS = 'graph-manager.graph-serialization.success',
37
+ SERIALIZE_GRAPH_CONTEXT_PROTOCOL__SUCCESS = 'graph-manager.graph-context-serialization.success',
38
+ UPDATE_AND_REBUILD_GRAPH__SUCCESS = 'graph-manager.rebuild.success',
39
+ TRANSFORM_GRAPH_META_MODEL_TO_GRAMMAR__SUCCESS = 'graph-manager.grammar.composing.success',
40
+ TRANSOFMR_GRAPH_GRAMMAR_TO_META_MODEL__SUCCESS = 'graph-manager.grammar.parsing.success',
40
41
 
42
+ V1_ENGINE_OPERATION_SERVER_CALL__SUCCESS = 'graph-manager.v1.engine-operation.server-call.success',
43
+ V1_ENGINE_OPERATION_INPUT__SUCCESS = 'graph-manager.v1.engine-operation.graph.collect-input.success',
44
+
45
+ // FAILURE
46
+ // TODO: consider to spliting all of these generic errors into more specific events
41
47
  GRAPH_BUILDER_FAILURE = 'graph-manager.graph-builder.failure',
42
48
  EXECUTION_FAILURE = 'graph-manager.execution.failure',
43
49
  COMPILATION_FAILURE = 'graph-manager.compilation.failure',
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { isNonNullable } from '@finos/legend-shared';
18
+ import type { PureModel } from '../graph/PureModel.js';
19
+ import { GRAPH_MANAGER_EVENT } from './GraphManagerEvent.js';
20
+
21
+ export type GraphManagerOperationReport = {
22
+ timings: {
23
+ total: number;
24
+ [key: string]: number;
25
+ };
26
+ elementCount: {
27
+ total: number | undefined;
28
+ [key: string]: number | undefined;
29
+ };
30
+ };
31
+
32
+ export const createGraphManagerOperationReport =
33
+ (): GraphManagerOperationReport => ({
34
+ timings: { total: 0 },
35
+ elementCount: { total: undefined },
36
+ });
37
+
38
+ export const createGraphBuilderReport = (): GraphManagerOperationReport => ({
39
+ timings: {
40
+ total: 0,
41
+ [GRAPH_MANAGER_EVENT.GRAPH_BUILDER_BUILD_GRAPH__SUCCESS]: 0,
42
+ },
43
+ elementCount: { total: undefined },
44
+ });
45
+
46
+ export const reportGraphAnalytics = (
47
+ graph: PureModel,
48
+ ): GraphManagerOperationReport & {
49
+ dependenciesCount: number;
50
+ } => {
51
+ const report = createGraphManagerOperationReport();
52
+
53
+ report.elementCount.sectionIndex =
54
+ (report.elementCount.sectionIndex ?? 0) + graph.sectionIndices.length;
55
+
56
+ report.elementCount.association =
57
+ (report.elementCount.association ?? 0) + graph.associations.length;
58
+ report.elementCount.class =
59
+ (report.elementCount.class ?? 0) + graph.classes.length;
60
+ report.elementCount.enumeration =
61
+ (report.elementCount.enumeration ?? 0) + graph.enumerations.length;
62
+ report.elementCount.function =
63
+ (report.elementCount.function ?? 0) + graph.functions.length;
64
+ report.elementCount.profile =
65
+ (report.elementCount.profile ?? 0) + graph.profiles.length;
66
+ report.elementCount.measure =
67
+ (report.elementCount.measure ?? 0) + graph.measures.length;
68
+
69
+ report.elementCount.store =
70
+ (report.elementCount.store ?? 0) + graph.stores.length;
71
+ report.elementCount.mapping =
72
+ (report.elementCount.mapping ?? 0) + graph.mappings.length;
73
+ report.elementCount.connection =
74
+ (report.elementCount.connection ?? 0) + graph.connections.length;
75
+ report.elementCount.runtime =
76
+ (report.elementCount.runtime ?? 0) + graph.runtimes.length;
77
+
78
+ report.elementCount.service =
79
+ (report.elementCount.service ?? 0) + graph.services.length;
80
+
81
+ const counted = Object.values(report.elementCount)
82
+ .filter(isNonNullable)
83
+ .reduce((a, b) => a + b, 0);
84
+
85
+ report.elementCount.total =
86
+ (report.elementCount.total ?? 0) + graph.allElements.length;
87
+ report.elementCount.other = report.elementCount.total - counted;
88
+
89
+ return {
90
+ ...report,
91
+ dependenciesCount: graph.dependencyManager.numberOfDependencies,
92
+ };
93
+ };
@@ -15,21 +15,26 @@
15
15
  */
16
16
 
17
17
  import type { TelemetryService } from '@finos/legend-shared';
18
- import type { GraphBuilderReport } from './GraphBuilderReport.js';
18
+ import type { GraphManagerOperationReport } from './GraphManagerMetrics.js';
19
19
  import { GRAPH_MANAGER_EVENT } from './GraphManagerEvent.js';
20
20
 
21
- type GraphBuilt_TelemetryData = {
21
+ type GraphInitialized_TelemetryData = {
22
22
  timings: Record<string, number>;
23
- dependencies: GraphBuilderReport;
24
- graph: GraphBuilderReport;
25
- generations?: GraphBuilderReport;
23
+ dependencies: GraphManagerOperationReport;
24
+ dependenciesCount: number;
25
+ graph: GraphManagerOperationReport;
26
+ generations?: GraphManagerOperationReport;
27
+ generationCount?: number;
26
28
  };
27
29
 
28
30
  export class GraphManagerTelemetry {
29
- static logEvent_GraphInitialized(
31
+ static logEvent_GraphInitializationSucceeded(
30
32
  telemetryService: TelemetryService,
31
- data: GraphBuilt_TelemetryData,
33
+ data: GraphInitialized_TelemetryData,
32
34
  ): void {
33
- telemetryService.logEvent(GRAPH_MANAGER_EVENT.GRAPH_INITIALIZED, data);
35
+ telemetryService.logEvent(
36
+ GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS,
37
+ data,
38
+ );
34
39
  }
35
40
  }
@@ -99,7 +99,10 @@ export const observe_DependencyManager = skipObserved(
99
99
  roots: observable,
100
100
  projectDependencyModelsIndex: observable,
101
101
 
102
+ numberOfDependencies: computed,
103
+ hasDependencies: computed,
102
104
  dependencyGraphs: computed,
105
+
103
106
  sectionIndices: computed,
104
107
  profiles: computed,
105
108
  enumerations: computed,