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

Add /cluster/<fsid>/{pool/<id>/}stats endpoints #494

Merged
merged 1 commit into from Oct 13, 2016

Conversation

b-ranto
Copy link
Contributor

@b-ranto b-ranto commented Oct 12, 2016

The commit adds two stats endpoints that provide global cluster as well
per pool statistics.

Signed-off-by: Boris Ranto branto@redhat.com

Copy link
Contributor

@ChristinaMeno ChristinaMeno left a comment

Choose a reason for hiding this comment

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

Generally looks good.

def cluster_stats(cluster_name):
import rados

cluster = rados.Rados(name=RADOS_NAME, clustername=cluster_name, conffile='')
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a context manager like

to prevent memory leaks. mon_remote.py is long-running code

except Exception as e:
raise RuntimeError("pool lookup: " + str(e))

result = cluster.open_ioctx(pool).get_stats()
Copy link
Contributor

Choose a reason for hiding this comment

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

return result


def pool_stats(cluster_name, pool_id):
Copy link
Contributor

Choose a reason for hiding this comment

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

@b-ranto I'd like to building up of a data structure that could be used to support a list-view here. so maybe iterate over http://docs.ceph.com/docs/master/rados/api/python/#rados.Rados.list_pools and return a dict of pool name: stats

@@ -75,6 +75,11 @@
'patch': 'update',
'delete': 'destroy'}),
name='cluster-pool-detail'),
url(r'^cluster/(?P<fsid>[a-zA-Z0-9-]+)/pool/(?P<pool_id>\d+)/stats$',
Copy link
Contributor

Choose a reason for hiding this comment

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

@b-ranto please add a list view at /api/cluster/FSID/pool/stats you're almost there

The commit adds two stats endpoints that provide global cluster as well
per pool statistics.

Signed-off-by: Boris Ranto <branto@redhat.com>
@b-ranto
Copy link
Contributor Author

b-ranto commented Oct 13, 2016

I've rebased and repushed the commit that should cover the comments. I did use a somehow different layout for pool/stats endpoint since I did not manage to get the serializers to do it the suggested way.

@ChristinaMeno ChristinaMeno merged commit cc1583b into 1.4 Oct 13, 2016
@ktdreyer ktdreyer deleted the wip-1.4-rados-native branch October 13, 2016 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants