protocol.SeriesCursor

Here are the examples of the python api protocol.SeriesCursor taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

Example 1

Project: tempodb-python Source File: client.py
    def __call__(self, f, *args, **kwargs):
        @functools.wraps(f)
        def wrapper(*args, **kwargs):
            resp = f(*args, **kwargs)
            session = args[0].session
            resp_obj = Response(resp, session)
            if resp_obj.status == 200:
                data = json.loads(resp_obj.body)
                if self.cursor_type in [protocol.SeriesCursor,
                                        protocol.SingleValueCursor]:
                    return self.cursor_type(data, self.data_type, resp_obj)
                else:
                    return self.cursor_type(data, self.data_type, resp_obj,
                                            kwargs.get('tz'))
            raise ResponseException(resp_obj)
        return wrapper

Example 2

Project: tempodb-python Source File: client.py
    @with_cursor(protocol.SeriesCursor, protocol.Series)
    def list_series(self, keys=None, tags=None, attrs=None,
                    limit=1000):
        """Get a list of all series matching the given criteria.

        **Note:** for the key argument, the filter will return the *union* of
        those values.  For the tag and attr arguments, the filter will return
        the *intersection* of those values.

        :param keys: filter by one or more series keys
        :type keys: list or string
        :param tags: filter by one or more tags
        :type tags: list or string
        :param dict attrs: filter by one or more key-value attributes
        :rtype: :class:`tempodb.protocol.cursor.SeriesCursor` with an
                iterator over :class:`tempodb.protocol.objects.Series`
                objects"""

        params = {
            'key': keys,
            'tag': tags,
            'attr': attrs,
            'limit': limit
        }
        url_args = endpoint.make_url_args(params)
        url = '?'.join([endpoint.SERIES_ENDPOINT, url_args])
        resp = self.session.get(url)
        return resp