config = Map.of(
"maxIterations", 20,
diff --git a/proc/test/src/main/java/org/neo4j/gds/ProcedureRunner.java b/proc/test/src/main/java/org/neo4j/gds/ProcedureRunner.java
index 7e9596b7fc..6e8ce0f755 100644
--- a/proc/test/src/main/java/org/neo4j/gds/ProcedureRunner.java
+++ b/proc/test/src/main/java/org/neo4j/gds/ProcedureRunner.java
@@ -24,8 +24,7 @@
import org.neo4j.gds.core.utils.progress.TaskRegistryFactory;
import org.neo4j.gds.core.utils.warnings.EmptyUserLogRegistryFactory;
import org.neo4j.gds.core.utils.warnings.UserLogRegistryFactory;
-import org.neo4j.gds.metrics.algorithms.AlgorithmMetricsService;
-import org.neo4j.gds.metrics.PassthroughExecutionMetricRegistrar;
+import org.neo4j.gds.metrics.MetricsFacade;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Transaction;
import org.neo4j.internal.kernel.api.procs.ProcedureCallContext;
@@ -46,7 +45,7 @@ public static P instantiateProcedure(
UserLogRegistryFactory userLogRegistryFactory,
Transaction tx,
Username username,
- AlgorithmMetricsService algorithmMetricsService
+ MetricsFacade metricsFacade
) {
P proc;
try {
@@ -64,7 +63,7 @@ public static
P instantiateProcedure(
proc.userLogRegistryFactory = userLogRegistryFactory;
proc.username = username;
- proc.algorithmMetricsService = algorithmMetricsService;
+ proc.metricsFacade = metricsFacade;
return proc;
}
@@ -88,7 +87,7 @@ public static
P applyOnProcedure(
EmptyUserLogRegistryFactory.INSTANCE,
tx,
username,
- new AlgorithmMetricsService(new PassthroughExecutionMetricRegistrar())
+ MetricsFacade.PASSTHROUGH_METRICS_FACADE
);
func.accept(proc);
return proc;
diff --git a/procedures/extension/src/main/java/org/neo4j/gds/extension/OpenGraphDataScienceExtension.java b/procedures/extension/src/main/java/org/neo4j/gds/extension/OpenGraphDataScienceExtension.java
index 25998d7fd3..8e9627c047 100644
--- a/procedures/extension/src/main/java/org/neo4j/gds/extension/OpenGraphDataScienceExtension.java
+++ b/procedures/extension/src/main/java/org/neo4j/gds/extension/OpenGraphDataScienceExtension.java
@@ -23,8 +23,10 @@
import org.neo4j.configuration.Config;
import org.neo4j.gds.applications.graphstorecatalog.CatalogBusinessFacade;
import org.neo4j.gds.core.write.NativeExportBuildersProvider;
-import org.neo4j.gds.metrics.algorithms.AlgorithmMetricsService;
+import org.neo4j.gds.metrics.MetricsFacade;
import org.neo4j.gds.metrics.PassthroughExecutionMetricRegistrar;
+import org.neo4j.gds.metrics.algorithms.AlgorithmMetricsService;
+import org.neo4j.gds.metrics.projections.ProjectionMetricsService;
import org.neo4j.gds.procedures.GraphDataScience;
import org.neo4j.gds.procedures.integration.ExporterBuildersProviderService;
import org.neo4j.gds.procedures.integration.ExtensionBuilder;
@@ -67,19 +69,21 @@ public Lifecycle newInstance(ExtensionContext extensionContext, Dependencies dep
Optional> businessFacadeDecorator = Optional.empty();
var algorithmMetricsService = new AlgorithmMetricsService(new PassthroughExecutionMetricRegistrar());
+ var projectionMetricsService = new ProjectionMetricsService(new PassthroughExecutionMetricRegistrar());
+ var metricsFacade = MetricsFacade.PASSTHROUGH_METRICS_FACADE;
extensionBuilder
.withComponent(
GraphDataScience.class,
() -> extensionBuilder.gdsProvider(
exporterBuildersProviderService,
businessFacadeDecorator,
- algorithmMetricsService
+ metricsFacade
)
)
.withComponent(
- AlgorithmMetricsService.class,
- () -> ctx -> algorithmMetricsService
+ MetricsFacade.class,
+ () -> ctx -> metricsFacade
)
.registerExtension();
diff --git a/procedures/integration/src/main/java/org/neo4j/gds/procedures/integration/CatalogFacadeProvider.java b/procedures/integration/src/main/java/org/neo4j/gds/procedures/integration/CatalogFacadeProvider.java
index 97170d8d73..ef12492e70 100644
--- a/procedures/integration/src/main/java/org/neo4j/gds/procedures/integration/CatalogFacadeProvider.java
+++ b/procedures/integration/src/main/java/org/neo4j/gds/procedures/integration/CatalogFacadeProvider.java
@@ -48,6 +48,7 @@
import org.neo4j.gds.core.loading.GraphStoreCatalogService;
import org.neo4j.gds.core.write.ExporterContext;
import org.neo4j.gds.logging.Log;
+import org.neo4j.gds.metrics.projections.ProjectionMetricsService;
import org.neo4j.gds.procedures.KernelTransactionAccessor;
import org.neo4j.gds.procedures.ProcedureTransactionAccessor;
import org.neo4j.gds.procedures.TaskRegistryFactoryService;
@@ -114,6 +115,8 @@ public class CatalogFacadeProvider {
// Business logic
private final Optional> businessFacadeDecorator;
+ private final ProjectionMetricsService projectionMetricsService;
+
/**
* We inject services here so that we may control and isolate access to dependencies.
* Take {@link org.neo4j.gds.services.UserAccessor} for example.
@@ -154,7 +157,8 @@ public class CatalogFacadeProvider {
WriteNodePropertiesApplication writeNodePropertiesApplication,
WriteRelationshipPropertiesApplication writeRelationshipPropertiesApplication,
WriteRelationshipsApplication writeRelationshipsApplication,
- Optional> businessFacadeDecorator
+ Optional> businessFacadeDecorator,
+ ProjectionMetricsService projectionMetricsService
) {
this.catalogConfigurationService = catalogConfigurationService;
this.graphNameValidationService = graphNameValidationService;
@@ -193,6 +197,8 @@ public class CatalogFacadeProvider {
this.writeRelationshipsApplication = writeRelationshipsApplication;
this.businessFacadeDecorator = businessFacadeDecorator;
+
+ this.projectionMetricsService = projectionMetricsService;
}
/**
@@ -262,7 +268,8 @@ public void accept(AutoCloseable autoCloseable) {
writeNodePropertiesApplication,
writeRelationshipPropertiesApplication,
writeNodeLabelApplication,
- writeRelationshipsApplication
+ writeRelationshipsApplication,
+ projectionMetricsService
);
// wrap in decorator to inject conditional behaviour
diff --git a/procedures/integration/src/main/java/org/neo4j/gds/procedures/integration/CatalogFacadeProviderFactory.java b/procedures/integration/src/main/java/org/neo4j/gds/procedures/integration/CatalogFacadeProviderFactory.java
index 20b7dbcff2..da8d113867 100644
--- a/procedures/integration/src/main/java/org/neo4j/gds/procedures/integration/CatalogFacadeProviderFactory.java
+++ b/procedures/integration/src/main/java/org/neo4j/gds/procedures/integration/CatalogFacadeProviderFactory.java
@@ -47,6 +47,7 @@
import org.neo4j.gds.core.loading.GraphProjectCypherResult;
import org.neo4j.gds.core.loading.GraphStoreCatalogService;
import org.neo4j.gds.logging.Log;
+import org.neo4j.gds.metrics.projections.ProjectionMetricsService;
import org.neo4j.gds.procedures.KernelTransactionAccessor;
import org.neo4j.gds.procedures.ProcedureTransactionAccessor;
import org.neo4j.gds.procedures.TaskRegistryFactoryService;
@@ -84,6 +85,7 @@ CatalogFacadeProvider createCatalogFacadeProvider(
DatabaseIdAccessor databaseIdAccessor,
KernelTransactionAccessor kernelTransactionAccessor,
TaskRegistryFactoryService taskRegistryFactoryService,
+ ProjectionMetricsService projectionMetricsService,
TerminationFlagService terminationFlagService,
UserLogServices userLogServices,
UserAccessor userServices
@@ -170,7 +172,8 @@ CatalogFacadeProvider createCatalogFacadeProvider(
writeNodePropertiesApplication,
writeRelationshipPropertiesApplication,
writeRelationshipsApplication,
- businessFacadeDecorator
+ businessFacadeDecorator,
+ projectionMetricsService
);
}
}
diff --git a/procedures/integration/src/main/java/org/neo4j/gds/procedures/integration/ExtensionBuilder.java b/procedures/integration/src/main/java/org/neo4j/gds/procedures/integration/ExtensionBuilder.java
index ae18dc4f4e..f7af068b84 100644
--- a/procedures/integration/src/main/java/org/neo4j/gds/procedures/integration/ExtensionBuilder.java
+++ b/procedures/integration/src/main/java/org/neo4j/gds/procedures/integration/ExtensionBuilder.java
@@ -29,7 +29,8 @@
import org.neo4j.gds.core.utils.warnings.UserLogRegistryFactory;
import org.neo4j.gds.internal.MemoryEstimationSettings;
import org.neo4j.gds.logging.Log;
-import org.neo4j.gds.metrics.algorithms.AlgorithmMetricsService;
+import org.neo4j.gds.metrics.MetricsFacade;
+import org.neo4j.gds.metrics.projections.ProjectionMetricsService;
import org.neo4j.gds.procedures.GraphDataScience;
import org.neo4j.gds.procedures.KernelTransactionAccessor;
import org.neo4j.gds.procedures.TaskRegistryFactoryService;
@@ -188,26 +189,31 @@ public void registerExtension() {
*
* @param exporterBuildersProviderService The catalog of writers
* @param businessFacadeDecorator Any checks added across requests
- * @param algorithmMetricsService
+ * @param metricsFacade
*/
public ThrowingFunction gdsProvider(
ExporterBuildersProviderService exporterBuildersProviderService,
Optional> businessFacadeDecorator,
- AlgorithmMetricsService algorithmMetricsService
+ MetricsFacade metricsFacade
) {
var catalogFacadeProvider = createCatalogFacadeProvider(
exporterBuildersProviderService,
- businessFacadeDecorator
+ businessFacadeDecorator,
+ metricsFacade.projectionMetrics()
);
- var communityProcedureProvider = createCommunityProcedureProvider(exporterBuildersProviderService, algorithmMetricsService);
+ var communityProcedureProvider = createCommunityProcedureProvider(
+ exporterBuildersProviderService,
+ metricsFacade
+ );
return new GraphDataScienceProvider(log, catalogFacadeProvider, communityProcedureProvider);
}
private CatalogFacadeProvider createCatalogFacadeProvider(
ExporterBuildersProviderService exporterBuildersProviderService,
- Optional> businessFacadeDecorator
+ Optional> businessFacadeDecorator,
+ ProjectionMetricsService projectionMetricsService
) {
var catalogFacadeProviderFactory = new CatalogFacadeProviderFactory(
log,
@@ -220,6 +226,7 @@ private CatalogFacadeProvider createCatalogFacadeProvider(
databaseIdAccessor,
kernelTransactionAccessor,
taskRegistryFactoryService,
+ projectionMetricsService,
terminationFlagService,
userLogServices,
userAccessor
@@ -227,7 +234,7 @@ private CatalogFacadeProvider createCatalogFacadeProvider(
}
private CommunityProcedureProvider createCommunityProcedureProvider(ExporterBuildersProviderService exporterBuildersProviderService,
- AlgorithmMetricsService algorithmMetricsService
+ MetricsFacade metricsFacade
) {
var algorithmMetaDataSetterService = new AlgorithmMetaDataSetterService();
@@ -243,7 +250,7 @@ private CommunityProcedureProvider createCommunityProcedureProvider(ExporterBuil
terminationFlagService,
userLogServices,
userAccessor,
- algorithmMetricsService
+ metricsFacade.algorithmMetrics()
);
}
}
diff --git a/test-utils/src/main/java/org/neo4j/gds/BaseTest.java b/test-utils/src/main/java/org/neo4j/gds/BaseTest.java
index 970382e1f6..e43a791deb 100644
--- a/test-utils/src/main/java/org/neo4j/gds/BaseTest.java
+++ b/test-utils/src/main/java/org/neo4j/gds/BaseTest.java
@@ -31,8 +31,7 @@
import org.neo4j.gds.extension.Inject;
import org.neo4j.gds.extension.Neo4jGraphExtension;
import org.neo4j.gds.extension.NodeFunction;
-import org.neo4j.gds.metrics.algorithms.AlgorithmMetricsService;
-import org.neo4j.gds.metrics.PassthroughExecutionMetricRegistrar;
+import org.neo4j.gds.metrics.MetricsFacade;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Result;
@@ -99,8 +98,8 @@ protected void configuration(TestDatabaseManagementServiceBuilder builder) {
@Override
public Lifecycle newInstance(ExtensionContext context, Dependencies dependencies) {
dependencies.globalProcedures().registerComponent(
- AlgorithmMetricsService.class,
- ctx -> new AlgorithmMetricsService(new PassthroughExecutionMetricRegistrar()),
+ MetricsFacade.class,
+ ctx -> MetricsFacade.PASSTHROUGH_METRICS_FACADE,
false
);
return new LifecycleAdapter();