Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don’t fetch everything from jmx in background fetches #898

Merged
merged 1 commit into from
Jan 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions src/shared/modules/jmx/jmxDuck.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()),
Expand All @@ -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
})
}

Expand Down