2020
2121import Rx from 'rxjs/Rx'
2222import bolt from 'services/bolt/bolt'
23- import { toObjects , extractFromNeoObjects } from 'services/bolt/boltMappings'
23+ import {
24+ recordsToTableArray ,
25+ extractFromNeoObjects
26+ } from 'services/bolt/boltMappings'
2427import { APP_START } from 'shared/modules/app/appDuck'
2528import {
2629 CONNECTED_STATE ,
@@ -61,10 +64,21 @@ export const getJmxValues = ({ jmx }, arr) => {
6164 * Helpers
6265 */
6366
67+ const jmxQuery = `
68+ CALL dbms.queryJmx("org.neo4j:instance=*,name=Kernel") yield attributes
69+ RETURN {name: 'Kernel', data: collect(attributes)} as result
70+ UNION ALL
71+ CALL dbms.queryJmx("org.neo4j:instance=*,name=Store file sizes") yield attributes
72+ RETURN {name: 'Store file sizes', data: collect(attributes)} as result
73+ UNION ALL
74+ CALL dbms.queryJmx("org.neo4j:instance=*,name=Configuration") yield attributes
75+ RETURN {name: 'Configuration', data: collect(attributes)} as result
76+ `
77+
6478const fetchJmxValues = store => {
6579 return bolt
6680 . directTransaction (
67- 'CALL dbms.queryJmx("org.neo4j:*")' ,
81+ jmxQuery ,
6882 { } ,
6983 {
7084 useCypherThread : shouldUseCypherThread ( store . getState ( ) ) ,
@@ -79,15 +93,18 @@ const fetchJmxValues = store => {
7993 intConverter : val => val . toString ( ) ,
8094 objectConverter : extractFromNeoObjects
8195 }
82- return toObjects ( res . records , converters ) . map (
83- ( [ name , description , attributes ] ) => {
84- return {
85- name,
86- description,
87- attributes
88- }
96+ let objs = recordsToTableArray ( res . records , converters )
97+ if ( ! objs || ! objs . length ) {
98+ return [ ]
99+ }
100+ objs . shift ( ) // remove title
101+ objs = objs . map ( rec => {
102+ return {
103+ name : rec [ 0 ] . name ,
104+ attributes : rec [ 0 ] . data [ 0 ]
89105 }
90- )
106+ } )
107+ return objs
91108 } )
92109}
93110
0 commit comments