Skip to content

Commit

Permalink
Add disk space percentage to node listing (#42145) (#43142)
Browse files Browse the repository at this point in the history
* Add disk space percentage to node listing

* Test modification for totalSpace

* Fix test mockup

* Add totalSpace to fixture

* Test fixup

* Remove trailing space per review suggestion

* More fixture updates

* More fixture update

* More fixture updates

* Update mock

* More fixture changes
  • Loading branch information
cachedout authored Aug 19, 2019
1 parent b3baa36 commit d22c55d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function NodeDetailStatus({ stats }) {
transport_address: transportAddress,
usedHeap,
freeSpace,
totalSpace,
documents,
dataSize,
indexCount,
Expand All @@ -24,6 +25,8 @@ export function NodeDetailStatus({ stats }) {
isOnline,
} = stats;

const percentSpaceUsed = (freeSpace / totalSpace) * 100;

const metrics = [
{
label: i18n.translate('xpack.monitoring.elasticsearch.nodeDetailStatus.transportAddress', {
Expand All @@ -45,9 +48,9 @@ export function NodeDetailStatus({ stats }) {
},
{
label: i18n.translate('xpack.monitoring.elasticsearch.nodeDetailStatus.freeDiskSpaceLabel', {
defaultMessage: 'Free Disk Space'
defaultMessage: 'Free Disk Space',
}),
value: formatMetric(freeSpace, '0.0 b'),
value: formatMetric(freeSpace, '0.0 b') + ' (' + formatMetric(percentSpaceUsed, '0,0.[00]', '%', { prependSpace: false }) + ')',
'data-test-subj': 'freeDiskSpace'
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe('Elasticsearch Node Summary get_node_summary handleResponse', () => {
documents: undefined,
dataSize: undefined,
freeSpace: undefined,
totalSpace: undefined,
usedHeap: undefined,
nodeTypeLabel: 'Node',
nodeTypeClass: 'fa-server',
Expand Down Expand Up @@ -108,7 +109,8 @@ describe('Elasticsearch Node Summary get_node_summary handleResponse', () => {
},
fs: {
total: {
available_in_bytes: 8700
available_in_bytes: 8700,
total_in_bytes: 10000
}
},
jvm: {
Expand All @@ -135,6 +137,7 @@ describe('Elasticsearch Node Summary get_node_summary handleResponse', () => {
documents: 11000,
dataSize: 35000,
freeSpace: 8700,
totalSpace: 10000,
usedHeap: 33,
nodeTypeLabel: 'Master Node',
nodeTypeClass: 'fa-star',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function handleResponse(clusterState, shardStats, nodeUuid) {
documents: get(sourceStats, 'indices.docs.count'),
dataSize: get(sourceStats, 'indices.store.size_in_bytes'),
freeSpace: get(sourceStats, 'fs.total.available_in_bytes'),
totalSpace: get(sourceStats, 'fs.total.total_in_bytes'),
usedHeap: get(sourceStats, 'jvm.mem.heap_used_percent'),
status: i18n.translate('xpack.monitoring.es.nodes.onlineStatusLabel', {
defaultMessage: 'Online' }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"documents": 24830,
"dataSize": 52847579,
"freeSpace": 186755088384,
"totalSpace": 499065712640,
"usedHeap": 29,
"status": "Online",
"isOnline": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function ({ getService, getPageObjects }) {
expect(await nodeDetail.getSummary()).to.eql({
transportAddress: 'Transport Address\n127.0.0.1:9300',
jvmHeap: 'JVM Heap\n29%',
freeDiskSpace: 'Free Disk Space\n173.9 GB',
freeDiskSpace: 'Free Disk Space\n173.9 GB (37.42%)',
documentCount: 'Documents\n24.8k',
dataSize: 'Data\n50.4 MB',
indicesCount: 'Indices\n20',
Expand All @@ -58,7 +58,7 @@ export default function ({ getService, getPageObjects }) {
expect(await nodeDetail.getSummary()).to.eql({
transportAddress: 'Transport Address\n127.0.0.1:9302',
jvmHeap: 'JVM Heap\n17%',
freeDiskSpace: 'Free Disk Space\n173.9 GB',
freeDiskSpace: 'Free Disk Space\n173.9 GB (37.42%)',
documentCount: 'Documents\n240',
dataSize: 'Data\n1.4 MB',
indicesCount: 'Indices\n4',
Expand Down Expand Up @@ -93,7 +93,7 @@ export default function ({ getService, getPageObjects }) {
expect(await nodeDetail.getSummary()).to.eql({
transportAddress: 'Transport Address\n127.0.0.1:9302',
jvmHeap: 'JVM Heap\nN/A',
freeDiskSpace: 'Free Disk Space\nN/A',
freeDiskSpace: 'Free Disk Space\nN/A (N/A)',
documentCount: 'Documents\nN/A',
dataSize: 'Data\nN/A',
indicesCount: 'Indices\nN/A',
Expand Down

0 comments on commit d22c55d

Please sign in to comment.