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

Aggregate stats from a project #55

Closed
woodychuck opened this issue Mar 13, 2018 · 8 comments
Closed

Aggregate stats from a project #55

woodychuck opened this issue Mar 13, 2018 · 8 comments

Comments

@woodychuck
Copy link

I'd like to use the client to get aggregate stats for projects from our OpenShift platform. However query_metrics_stats() insists on a metric_id while I rather just want to filter by tags to get my result. I reckon a simple if statement enabling to use metric_id=None could resolve this but of course being new to this stuff leaves some uncertainty. Anyway, the following change in metrics.py did the trick for me:

    def _get_single_id_url(self, previous_url, id):
        if id:
            return previous_url + '/{0}'.format(HawkularBaseClient.quote(id))
        else:
            return previous_url

Does this make sense or am I supposed to use the client in a different way to retrieve my stats?

@burmanm
Copy link
Contributor

burmanm commented Mar 13, 2018

Do you want them as separate ones on your end (for further processing) or merged together at Hawkular-Metrics' end?

@woodychuck
Copy link
Author

In the end I just want aggregate (stacked) stats for complete projects in a TBD number of buckets, e.g. GET /hawkular/metrics/gauges/stats?tags=descriptor_name%3Acpu%2Frequest%2Ctype%3Apod&stacked=true&buckets=30&start=$(date -d -30minutes +%s%3N)" (in order to compare to cpu/usage_rate, get the max and - along with memory usage - calculate the billing parameters). If I wanted separate metrics for each pod I figured I need to get the metrics list and iterate through it (which can be cumbersome given cron job pods cumulating up etc.)

@burmanm
Copy link
Contributor

burmanm commented Mar 13, 2018

I'll create a version that allows this (given enough new Openshift-metrics)

burmanm added a commit to burmanm/hawkular-client-python that referenced this issue Mar 13, 2018
@burmanm
Copy link
Contributor

burmanm commented Mar 13, 2018

There's a version now available in PyPi (0.5.4) that allows leaving metric_id as None

@woodychuck
Copy link
Author

Hi, thanks that's great! However it seems to be missing hawkular/alerts/ in the package?

@burmanm
Copy link
Contributor

burmanm commented Mar 14, 2018

So it would appear, I'll create a version with the old alerts-package also. I'll track this in #57

burmanm added a commit to burmanm/hawkular-client-python that referenced this issue Mar 14, 2018
@burmanm
Copy link
Contributor

burmanm commented Mar 14, 2018

0.5.5 is now in the PyPi

@woodychuck
Copy link
Author

Lovely, works like charm, thanks again!

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

No branches or pull requests

2 participants