Skip to content

Commit

Permalink
Capture sub-graph project metrics
Browse files Browse the repository at this point in the history
Co-authored-by: Ioannis Panagiotas <[email protected]>
  • Loading branch information
vnickolov and IoannisPanagiotas committed Nov 16, 2023
1 parent 5c56a05 commit 233774d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,19 @@ public GraphFilterResult subGraphProject(
rawConfiguration
);

return subGraphProjectApplication.project(
taskRegistryFactory,
userLogRegistryFactory,
configuration,
originGraphConfiguration.graphStore()
);
var subGraphMetric = projectionMetricsService.createSubGraph();
try(subGraphMetric) {
subGraphMetric.start();
return subGraphProjectApplication.project(
taskRegistryFactory,
userLogRegistryFactory,
configuration,
originGraphConfiguration.graphStore()
);
} catch (Exception e) {
subGraphMetric.failed();
throw e;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@ public ExecutionMetric createCypherV2() {
return metricRegistrar.create("cypherV2");
}

public ExecutionMetric createSubGraph() {
return metricRegistrar.create("subGraph");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ void shouldCreateCypherV2ProjectionMetric() {
verifyNoMoreInteractions(registrarMock);
}

@Test
void shouldCreateSubGraphProjectionMetric() {
// given
var registrarMock = Mockito.mock(ExecutionMetricRegistrar.class);
var metricsService = new ProjectionMetricsService(registrarMock);

// when
metricsService.createSubGraph();

// then
verify(registrarMock, times(1)).create("subGraph");
verifyNoMoreInteractions(registrarMock);
}

}

0 comments on commit 233774d

Please sign in to comment.