Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Capacity card integration #273

Merged
merged 1 commit into from
Apr 9, 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
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { coFetchJSON } from '../../../co-fetch';
const REFRESH_TIMEOUT = 5000;

const CEPH_STATUS = 'ceph_health_status';
const STORAGE_CEPH_CAPACITY_TOTAL_QUERY = 'ceph_cluster_total_bytes';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mareklibra I guess we should also use this queries for storage in cluster overview, right ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, we should be aligned with storage on that.
We discussed these queries multiple times - @AyushAmbastha, is this the "final" metric to be used, please?

Copy link
Author

@AyushAmbastha AyushAmbastha Apr 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cloudbehl is in a better position to answer this.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mareklibra I think for now this is best possible metric available from the ceph to calculate this value. As I can see in cluster dashboard we are using kubelet metric or node available.

  1. Kubelet metric is not available as the cephCSI and generic CSI doesn't have a support of that right and I don't think it will be available.
  2. node_filesystem_avail_bytes includes all the nodes that are present in the system and doesn't gives the actual number which can be used by customer.

I used both queries(ceph_cluster_total_bytes and node_filesystem_avail_bytes) to see what difference.

Screenshot from 2019-04-09 13-54-27

if you see the screen shot:

ceph_cluster_total_bytes - 385568673792 = 385.5 GB
node_filesystem_avail_bytes - 5049127116800 = 5049.1GB

So I think we can use ceph_cluster_total_bytes to show the storage bytes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thank you for exmplnation.
So I'll update ClusterOverview metric to this one for Ceph. I'll keep the default in case Ceph is not available.

const STORAGE_CEPH_CAPACITY_USED_QUERY = 'ceph_cluster_total_used_bytes';

const resourceMap = {
nodes: {
Expand All @@ -45,8 +47,10 @@ export class StorageOverview extends React.Component {
data: {},
loaded: false,
},
capacityData: {},
};
this.setHealthData = this._setHealthData.bind(this);
this.setCapacityData = this._setCapacityData.bind(this);
}

_setHealthData(healthy) {
Expand All @@ -60,6 +64,15 @@ export class StorageOverview extends React.Component {
});
}

_setCapacityData(key, response) {
this.setState(state => ({
capacityData: {
...state.capacityData,
[key]: response,
},
}));
}

fetchPrometheusQuery(query, callback) {
const url = `${getPrometheusBaseURL()}/api/v1/query?query=${encodeURIComponent(query)}`;
coFetchJSON(url).then(result => {
Expand All @@ -80,19 +93,22 @@ export class StorageOverview extends React.Component {
componentDidMount() {
this._isMounted = true;
this.fetchPrometheusQuery(CEPH_STATUS, this.setHealthData);
this.fetchPrometheusQuery(STORAGE_CEPH_CAPACITY_TOTAL_QUERY, response => this.setCapacityData('capacityTotal', response));
this.fetchPrometheusQuery(STORAGE_CEPH_CAPACITY_USED_QUERY, response => this.setCapacityData('capacityUsed', response));
}
componentWillUnmount() {
this._isMounted = false;
}

render() {
const { ocsHealthData } = this.state;
const { ocsHealthData, capacityData } = this.state;
const inventoryResourceMapToProps = resources => {
return {
value: {
LoadingComponent: LoadingInline,
...resources,
ocsHealthData,
...capacityData,
},
};
};
Expand Down