Skip to content

Commit

Permalink
Conditionally register algorithm metrics
Browse files Browse the repository at this point in the history
Co-authored-by: Ioannis Panagiotas <ioannis.panagiotas@neotechnology.com>
  • Loading branch information
vnickolov and IoannisPanagiotas committed Nov 15, 2023
1 parent 11b99b1 commit 759750d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.neo4j.gds.algorithms.community.MutateNodePropertyService;
import org.neo4j.gds.algorithms.community.WriteNodePropertyService;
import org.neo4j.gds.algorithms.metrics.AlgorithmMetricsService;
import org.neo4j.gds.algorithms.metrics.PassthroughAlgorithmMetricRegistrar;
import org.neo4j.gds.api.DatabaseId;
import org.neo4j.gds.api.GraphLoaderContext;
import org.neo4j.gds.api.ImmutableGraphLoaderContext;
Expand Down Expand Up @@ -75,6 +74,7 @@ public class CommunityProcedureProvider {
private final TerminationFlagService terminationFlagService;
private final UserLogServices userLogServices;
private final UserAccessor userAccessor;
private final AlgorithmMetricsService algorithmMetricsService;

public CommunityProcedureProvider(
Log log,
Expand All @@ -87,7 +87,8 @@ public CommunityProcedureProvider(
TaskRegistryFactoryService taskRegistryFactoryService,
TerminationFlagService terminationFlagService,
UserLogServices userLogServices,
UserAccessor userAccessor
UserAccessor userAccessor,
AlgorithmMetricsService algorithmMetricsService
) {
this.log = log;
this.graphStoreCatalogService = graphStoreCatalogService;
Expand All @@ -101,6 +102,7 @@ public CommunityProcedureProvider(
this.terminationFlagService = terminationFlagService;
this.userLogServices = userLogServices;
this.userAccessor = userAccessor;
this.algorithmMetricsService = algorithmMetricsService;
}

public CommunityProcedureFacade createCommunityProcedureFacade(Context context) throws ProcedureException {
Expand Down Expand Up @@ -129,7 +131,7 @@ public CommunityProcedureFacade createCommunityProcedureFacade(Context context)
taskRegistryFactory,
userLogRegistryFactory,
algorithmMemoryValidationService,
new AlgorithmMetricsService(new PassthroughAlgorithmMetricRegistrar()),
algorithmMetricsService,
log
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public ThrowingFunction<Context, GraphDataScience, ProcedureException> gdsProvid
businessFacadeDecorator
);

var communityProcedureProvider = createCommunityProcedureProvider(exporterBuildersProviderService);
var communityProcedureProvider = createCommunityProcedureProvider(exporterBuildersProviderService, algorithmMetricsService);

return new GraphDataScienceProvider(log, catalogFacadeProvider, communityProcedureProvider);
}
Expand All @@ -226,7 +226,9 @@ private CatalogFacadeProvider createCatalogFacadeProvider(
);
}

private CommunityProcedureProvider createCommunityProcedureProvider(ExporterBuildersProviderService exporterBuildersProviderService) {
private CommunityProcedureProvider createCommunityProcedureProvider(ExporterBuildersProviderService exporterBuildersProviderService,
AlgorithmMetricsService algorithmMetricsService
) {
var algorithmMetaDataSetterService = new AlgorithmMetaDataSetterService();

return new CommunityProcedureProvider(
Expand All @@ -240,7 +242,8 @@ private CommunityProcedureProvider createCommunityProcedureProvider(ExporterBuil
taskRegistryFactoryService,
terminationFlagService,
userLogServices,
userAccessor
userAccessor,
algorithmMetricsService
);
}
}

0 comments on commit 759750d

Please sign in to comment.