Skip to content

Commit

Permalink
[Metrics UI] Fix Host Overview boxes in Host Detail page (#89299) (#8…
Browse files Browse the repository at this point in the history
…9443)

* change from type:gauge to type:top_n in inventory models

* Add test for hostSystemOverview metric

* fix lint errors

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
estermv and kibanamachine authored Jan 28, 2021
1 parent 983e2e4 commit 0642909
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const hostDockerOverview: TSVBMetricModelCreator = (
index_pattern: indexPattern,
interval,
time_field: timeField,
type: 'gauge',
type: 'top_n',
series: [
{
id: 'total',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const hostK8sOverview: TSVBMetricModelCreator = (
index_pattern: indexPattern,
interval,
time_field: timeField,
type: 'gauge',
type: 'top_n',
series: [
{
id: 'cpucap',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const hostSystemOverview: TSVBMetricModelCreator = (
index_pattern: indexPattern,
interval,
time_field: timeField,
type: 'gauge',
type: 'top_n',
series: [
{
id: 'cpu',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const awsOverview: TSVBMetricModelCreator = (timeField, indexPattern): TS
id_type: 'cloud',
interval: '>=5m',
time_field: timeField,
type: 'gauge',
type: 'top_n',
series: [
{
id: 'cpu-util',
Expand Down
25 changes: 25 additions & 0 deletions x-pack/test/api_integration/apis/metrics_ui/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,30 @@ export default function ({ getService }: FtrProviderContext) {
expect(resp.metrics.length).to.equal(2);
});
});

it('should return multiple values for hostSystemOverview metric', () => {
const data = fetchNodeDetails({
sourceId: 'default',
metrics: ['hostSystemOverview'],
timerange: {
to: max,
from: min,
interval: '>=1m',
},
nodeId: 'demo-stack-mysql-01',
nodeType: 'host' as InfraNodeType,
});
return data.then((resp) => {
if (!resp) {
return;
}

const hostSystemOverviewMetric = resp.metrics.find(
(metric) => metric.id === 'hostSystemOverview'
);

expect(hostSystemOverviewMetric?.series.length).to.be.greaterThan(1);
});
});
});
}

0 comments on commit 0642909

Please sign in to comment.