summaryrefslogtreecommitdiff
path: root/gitlab/objects.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab/objects.py')
-rw-r--r--gitlab/objects.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/gitlab/objects.py b/gitlab/objects.py
index 0e9c75f..d537d6a 100644
--- a/gitlab/objects.py
+++ b/gitlab/objects.py
@@ -495,6 +495,42 @@ class GitlabObject(object):
return not self.__eq__(other)
+class SidekiqManager(object):
+ """Manager for the Sidekiq methods.
+
+ This manager doesn't actually manage objects but provides helper fonction
+ for the sidekiq metrics API.
+ """
+ def __init__(self, gl):
+ """Constructs a Sidekiq manager.
+
+ Args:
+ gl (gitlab.Gitlab): Gitlab object referencing the GitLab server.
+ """
+ self.gitlab = gl
+
+ def _simple_get(self, url, **kwargs):
+ r = self.gitlab._raw_get(url, **kwargs)
+ raise_error_from_response(r, GitlabGetError)
+ return r.json()
+
+ def queue_metrics(self, **kwargs):
+ """Returns the registred queues information."""
+ return self._simple_get('/sidekiq/queue_metrics', **kwargs)
+
+ def process_metrics(self, **kwargs):
+ """Returns the registred sidekiq workers."""
+ return self._simple_get('/sidekiq/process_metrics', **kwargs)
+
+ def job_stats(self, **kwargs):
+ """Returns statistics about the jobs performed."""
+ return self._simple_get('/sidekiq/job_stats', **kwargs)
+
+ def compound_metrics(self, **kwargs):
+ """Returns all available metrics and statistics."""
+ return self._simple_get('/sidekiq/compound_metrics', **kwargs)
+
+
class UserEmail(GitlabObject):
_url = '/users/%(user_id)s/emails'
canUpdate = False