From c8de875177729f77ea4aced004bbf70305277ebc Mon Sep 17 00:00:00 2001 From: Oskar Hane Date: Tue, 15 Jan 2019 09:25:04 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20fetch=20everything=20from=20jmx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pick what’s needed --- src/shared/modules/jmx/jmxDuck.js | 37 ++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/src/shared/modules/jmx/jmxDuck.js b/src/shared/modules/jmx/jmxDuck.js index 805cfd8eb55..90683a1b928 100644 --- a/src/shared/modules/jmx/jmxDuck.js +++ b/src/shared/modules/jmx/jmxDuck.js @@ -20,7 +20,10 @@ import Rx from 'rxjs/Rx' import bolt from 'services/bolt/bolt' -import { toObjects, extractFromNeoObjects } from 'services/bolt/boltMappings' +import { + recordsToTableArray, + extractFromNeoObjects +} from 'services/bolt/boltMappings' import { APP_START } from 'shared/modules/app/appDuck' import { CONNECTED_STATE, @@ -61,10 +64,21 @@ export const getJmxValues = ({ jmx }, arr) => { * Helpers */ +const jmxQuery = ` +CALL dbms.queryJmx("org.neo4j:instance=*,name=Kernel") yield attributes +RETURN {name: 'Kernel', data: collect(attributes)} as result +UNION ALL +CALL dbms.queryJmx("org.neo4j:instance=*,name=Store file sizes") yield attributes +RETURN {name: 'Store file sizes', data: collect(attributes)} as result +UNION ALL +CALL dbms.queryJmx("org.neo4j:instance=*,name=Configuration") yield attributes +RETURN {name: 'Configuration', data: collect(attributes)} as result +` + const fetchJmxValues = store => { return bolt .directTransaction( - 'CALL dbms.queryJmx("org.neo4j:*")', + jmxQuery, {}, { useCypherThread: shouldUseCypherThread(store.getState()), @@ -79,15 +93,18 @@ const fetchJmxValues = store => { intConverter: val => val.toString(), objectConverter: extractFromNeoObjects } - return toObjects(res.records, converters).map( - ([name, description, attributes]) => { - return { - name, - description, - attributes - } + let objs = recordsToTableArray(res.records, converters) + if (!objs || !objs.length) { + return [] + } + objs.shift() // remove title + objs = objs.map(rec => { + return { + name: rec[0].name, + attributes: rec[0].data[0] } - ) + }) + return objs }) }