Skip to content

Commit

Permalink
Bug-fix: Updation Of Prometheus Queries
Browse files Browse the repository at this point in the history
change of num pools query in health card
change of savings query in object data reduction card
change of system name query in details card

Signed-off-by: Afreen Rahman <afrahman@redhat.com>
  • Loading branch information
Afreen Rahman committed Aug 6, 2019
1 parent 34f2268 commit 52a032d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const getInfrastructurePlatform = (infrastructure: K8sResourceKind): string =>
const getCephVersion = (cephCluster: K8sResourceKind): string =>
_.get(cephCluster, 'spec.cephVersion.image');

const NOOBAA_SYSTEM_NAME_QUERY = 'NooBaa_system_name';
const NOOBAA_SYSTEM_NAME_QUERY = 'NooBaa_system_info';

const cephClusterResource: FirehoseResource = {
kind: referenceForModel(CephClusterModel),
Expand Down Expand Up @@ -62,7 +62,7 @@ export const ObjectServiceDetailsCard: React.FC<DashboardItemProps> = ({

const queryResult = prometheusResults.getIn([NOOBAA_SYSTEM_NAME_QUERY, 'result']);

const systemName = _.get(queryResult, 'data.result[0].metric.name');
const systemName = _.get(queryResult, 'data.result[0].metric.system_name');

const infrastructure = _.get(resources, 'infrastructure');
const infrastructureLoaded = _.get(infrastructure, 'loaded', false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const getObjectStorageHealthState = (
}
}
if (!_.isNil(buckets) && !_.isNil(unhealthyBuckets)) {
value = Number((Number(unhealthyBuckets) / Number(buckets)).toFixed(1));
value = Number(unhealthyBuckets) / Number(buckets);
if (value >= 0.5) {
result.message = 'Many buckets have issues';
result.state = HealthState.ERROR;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ export const SavingsItem: React.FC<SavingsItemProps> = React.memo(
text = <LoadingInline />;
} else if (!_.isNil(savings)) {
const savingsPercentage = logicalSize
? humanizePercentage((100 * Number(savings)) / Number(logicalSize))
? `(${humanizePercentage((100 * Number(savings)) / logicalSize).string})`
: null;
const savingsFormattted = humanizeBinaryBytesWithoutB(Number(savings));
text = (
<span className="nb-object-data-reduction-card__row-status-item-text">
{savingsFormattted.value}
{savingsFormattted.unit}({savingsPercentage.string})
{savingsFormattted.unit}
{savingsPercentage}
</span>
);
}
Expand All @@ -83,6 +84,6 @@ type EfficiencyItemProps = {

type SavingsItemProps = {
savings: string;
logicalSize: string;
logicalSize: number;
isLoading: boolean;
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import * as _ from 'lodash';
import {
DashboardCard,
DashboardCardBody,
Expand Down Expand Up @@ -38,10 +37,14 @@ const DataReductionCard: React.FC<DashboardItemProps> = ({
ObjectDataReductionQueries.SAVINGS_QUERY,
'result',
]);
const logicalSavingsQueryResult = prometheusResults.getIn([
ObjectDataReductionQueries.LOGICAL_SAVINGS_QUERY,
'result',
]);

const efficiency = getPropsData(efficiencyQueryResult);
const savings = getPropsData(savingsQueryResult);
const logicalSize = _.get(savingsQueryResult, 'data.result[0].metric.logical_size', null);
const logicalSize = getPropsData(logicalSavingsQueryResult);

const efficiencyProps = {
efficiency,
Expand All @@ -50,8 +53,8 @@ const DataReductionCard: React.FC<DashboardItemProps> = ({

const savingsProps = {
savings,
logicalSize,
isLoading: !savingsQueryResult,
logicalSize: Number(logicalSize),
isLoading: !savingsQueryResult && !logicalSavingsQueryResult,
};

return (
Expand Down
13 changes: 7 additions & 6 deletions frontend/packages/noobaa-storage-plugin/src/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ export enum DATA_RESILIENCE_QUERIES {
REBUILD_TIME_QUERY = 'NooBaa_rebuild_time',
}

export const ObjectDataReductionQueries = {
EFFICIENCY_QUERY: 'NooBaa_reduction_ratio',
SAVINGS_QUERY: 'NooBaa_object_savings',
};
export enum ObjectDataReductionQueries {
EFFICIENCY_QUERY = 'NooBaa_reduction_ratio',
SAVINGS_QUERY = '(NooBaa_object_savings_logical_size - NooBaa_object_savings_physical_size) > 0',
LOGICAL_SAVINGS_QUERY = 'NooBaa_object_savings_logical_size',
}

export enum HealthCardQueries {
BUCKETS_COUNT = 'NooBaa_num_buckets',
UNHEALTHY_BUCKETS = 'NooBaa_num_unhealthy_buckets',
POOLS_COUNT = 'Noobaa_num_pools',
UNHEALTHY_POOLS = 'Noobaa_num_unhealthy_pools',
POOLS_COUNT = 'NooBaa_num_pools',
UNHEALTHY_POOLS = 'NooBaa_num_unhealthy_pools',
}

export const ObjectCapacityQueries = {
Expand Down

0 comments on commit 52a032d

Please sign in to comment.