Metrics { @Procedure(mode=Mode.DBMS) @Description("apoc.metrics.get(metricName, {}) - retrieve a system metric by its metric name. Additional configuration options may be passed matching the options available for apoc.load.csv.") public Stream<GenericMetric> get( @Name("metricName") String metricName, @Name(value = "config",defaultValue = "{}") Map<String, Object> config) { Map<String,Object> csvConfig = config; if(csvConfig == null) { csvConfig = new HashMap<String,Object>(); } if (!csvConfig.containsKey("mapping")) { csvConfig.put("mapping", METRIC_TYPE_MAPPINGS); } return loadCsvForMetric(metricName, csvConfig); }  @Procedure(mode=Mode.DBMS) @Description("apoc.metrics.list() - get a list of available metrics") Stream<Neo4jMeasuredMetric> list(); Stream<GenericMetric> loadCsvForMetric(String metricName, Map<String,Object> config); @Procedure(mode=Mode.DBMS) @Description("apoc.metrics.storage(directorySetting) - retrieve storage metrics about the devices Neo4j uses for data storage. " + "directorySetting may be any valid neo4j directory setting name, such as 'dbms.directories.data'. If null is provided " + "as a directorySetting, you will get back all available directory settings. For a list of available directory settings, " + "see the Neo4j operations manual reference on configuration settings. Directory settings are **not** paths, they are " + "a neo4j.conf setting key name") Stream<StorageMetric> storage(@Name("directorySetting") String directorySetting); @Procedure(mode=Mode.DBMS) @Description("apoc.metrics.get(metricName, {}) - retrieve a system metric by its metric name. Additional configuration options may be passed matching the options available for apoc.load.csv.") /** * This method is a specialization of apoc.load.csv, it just happens that the directory and file path * are local. For Neo4j metrics, see: https://neo4j.com/docs/operations-manual/current/monitoring/metrics/reference/ * * The reason it's not suitable for users to use regular apoc.load.csv to get at the metrics file is that from the * outside they have no way of knowing the home path where they're located, and apoc.load.csv doesn't allow * relative paths. */ Stream<GenericMetric> get(
            @Name("metricName") String metricName,
            @Name(value = "config",defaultValue = "{}") Map<String, Object> config); @Context
    public Log log; }
@Test public void shouldGetMetrics() { session.readTransaction(tx -> tx.run("RETURN 1 AS num;")); String metricKey = "neo4j.bolt.sessions_started"; testResult(session, "CALL apoc.metrics.get($metricKey)", map("metricKey", metricKey), (r) -> { assertTrue("should have at least one element", r.hasNext()); Map<String, Object> map = r.next(); assertEquals(Stream.of("timestamp", "metric", "map").collect(Collectors.toSet()), map.keySet()); assertEquals(metricKey, map.get("metric")); }); }