Beispiel #1
0
 def __init__(self, settings, workload, ddocs, params, index_type,
              prefix=None):
     super(SpringQueryLatency, self).__init__(settings, workload, prefix)
     if index_type is None:
         self.new_queries = NewQuery(ddocs, params)
     else:
         self.new_queries = NewQueryNG(index_type, params)
Beispiel #2
0
class SpringQueryLatency(SpringLatency):

    COLLECTOR = "spring_query_latency"

    METRICS = ("latency_query", )

    def __init__(self, settings, workload, ddocs, params, index_type,
                 prefix=None):
        super(SpringQueryLatency, self).__init__(settings, workload, prefix)
        if index_type is None:
            self.new_queries = NewQuery(ddocs, params)
        else:
            self.new_queries = NewQueryNG(index_type, params)

    def measure(self, client, metric):
        key = self.existing_keys.next(curr_items=self.items, curr_deletes=0)
        doc = self.new_docs.next(key)
        ddoc_name, view_name, query = self.new_queries.next(doc)

        _, latency = client.query(ddoc_name, view_name, query=query)
        return 1000 * latency  # s -> ms