示例#1
0
    def __init__(self, settings):
        self.interval = settings.interval

        self.cluster = settings.cluster
        self.store = SerieslyStore(settings.seriesly_host)
        self.mc = MetadataClient(settings)

        self.nodes = settings.nodes
        self.stats_api = "http://{}:4985/_stats"
        self.prev_pause_total = None
示例#2
0
 def validate_num_connections(self):
     db = SerieslyStore.build_dbname(self.metric_helper.cluster_names[0], None, None, None, "secondary_debugstats")
     config_data = self.get_data_from_config_json(self.configfile)
     # Expecting one extra connection than concurrency in config file, MB-21584
     ret = self.metric_helper.verify_series_in_limits(db, config_data["Concurrency"] + 1, "num_connections")
     if not ret:
         raise Exception('Validation for num_connections failed')
示例#3
0
class SyncGateway(Collector):

    COLLECTOR = "sync_gateway"

    def __init__(self, settings):
        self.interval = settings.interval

        self.cluster = settings.cluster
        self.store = SerieslyStore(settings.seriesly_host)
        self.mc = MetadataClient(settings)

        self.nodes = settings.nodes
        self.stats_api = "http://{}:4985/_stats"
        self.prev_pause_total = None

    def _fetch_stats(self, node):
        stats_api = "http://{}:4985/_stats".format(node)
        for _, stats in requests.get(url=stats_api).json().items():
            for metric, value in stats.items():
                if type(value) == int:  # can't use isinstance because of bool
                    yield metric, value
                if metric == "PauseNs":
                    yield metric, filter(lambda v: v, value)[-1]
                if metric == "PauseTotalNs":
                    pause = value - (self.prev_pause_total or value)
                    pause_pct = 100.0 * pause / 10**9 / self.interval
                    self.prev_pause_total = value
                    yield "PausesPct", pause_pct

    def update_metadata(self):
        self.mc.add_cluster()
        for node in self.nodes:
            self.mc.add_server(node)
            for metric, _ in self._fetch_stats(node):
                self.mc.add_metric(metric,
                                   server=node,
                                   collector=self.COLLECTOR)

    def sample(self):
        for node in self.nodes:
            samples = dict(stats for stats in self._fetch_stats(node))
            self.store.append(samples,
                              cluster=self.cluster,
                              server=node,
                              collector=self.COLLECTOR)
示例#4
0
    def __init__(self, settings):
        self.interval = settings.interval

        self.cluster = settings.cluster
        self.store = SerieslyStore(settings.seriesly_host)
        self.mc = MetadataClient(settings)

        self.nodes = settings.nodes
        self.stats_api = "http://{}:4985/_stats"
        self.prev_pause_total = None
示例#5
0
class SyncGateway(Collector):

    COLLECTOR = "sync_gateway"

    def __init__(self, settings):
        self.interval = settings.interval

        self.cluster = settings.cluster
        self.store = SerieslyStore(settings.seriesly_host)
        self.mc = MetadataClient(settings)

        self.nodes = settings.nodes
        self.stats_api = "http://{}:4985/_stats"
        self.prev_pause_total = None

    def _fetch_stats(self, node):
        stats_api = "http://{}:4985/_stats".format(node)
        for _, stats in requests.get(url=stats_api).json().items():
            for metric, value in stats.items():
                if type(value) == int:  # can't use isinstance because of bool
                    yield metric, value
                if metric == "PauseNs":
                    yield metric, filter(lambda v: v, value)[-1]
                if metric == "PauseTotalNs":
                        pause = value - (self.prev_pause_total or value)
                        pause_pct = 100.0 * pause / 10 ** 9 / self.interval
                        self.prev_pause_total = value
                        yield "PausesPct", pause_pct

    def update_metadata(self):
        self.mc.add_cluster()
        for node in self.nodes:
            self.mc.add_server(node)
            for metric, _ in self._fetch_stats(node):
                self.mc.add_metric(metric, server=node,
                                   collector=self.COLLECTOR)

    def sample(self):
        for node in self.nodes:
            samples = dict(stats for stats in self._fetch_stats(node))
            self.store.append(samples, cluster=self.cluster, server=node,
                              collector=self.COLLECTOR)
示例#6
0
    def __init__(self, settings):
        self.session = requests.Session()

        self.interval = settings.interval

        self.cluster = settings.cluster
        self.master_node = settings.master_node
        self.index_node = settings.index_node
        self.auth = (settings.rest_username, settings.rest_password)

        self.buckets = settings.buckets
        self.hostnames = settings.hostnames
        self.nodes = list(self.get_nodes())
        self.ssh_username = getattr(settings, 'ssh_username', None)
        self.ssh_password = getattr(settings, 'ssh_password', None)

        self.secondary_statsfile = settings.secondary_statsfile
        self.store = SerieslyStore(settings.seriesly_host)
        self.mc = MetadataClient(settings)

        self.metrics = set()
        self.updater = None