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

Bug-fix: Fixing updated prometheus queries in object service dashboard #2255

Merged
Merged
Show file tree
Hide file tree
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
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,12 @@ 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.string} ${savingsPercentage}`}
</span>
);
}
Expand All @@ -83,6 +82,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