Ejemplo n.º 1
0
def post_to_cbm(input_json):
    """Collect and post results to cbmonitor dashboard"""
    if not input_json:
        return

    if not "cbm" in input_json["info"] or not input_json["info"]["cbm"]:
        return

    try:
        name, phase = input_json["name"].split(".")
    except ValueError:
        log.error("invalid spec name %s" % input_json["name"])
        return

    if phase != "loop":
        log.error("cbmonitor only cares about access phase for now")
        return

    if "cluster_name" in input_json["info"]:
        cluster_name = input_json["info"]['cluster_name']
    else:
        cluster_name = "unknown"

    rs = {}
    if "reb_dur" in input_json["info"]:
        rs[("[%s:%s] Rebalance Time, s" % (cluster_name, name))] = \
            int(input_json["info"]["reb_dur"])

    client = CbmonitorClient(input_json["info"]["cbm-host"],
                             input_json["info"]["cbm-port"])
    client.post_results(input_json["buildinfo"]["version"], rs)
Ejemplo n.º 2
0
def post_to_cbm(input_json):
    """Collect and post results to cbmonitor dashboard"""
    if not input_json:
        return

    if not "cbm" in input_json["info"] or not input_json["info"]["cbm"]:
        return

    try:
        name, phase = input_json["name"].split(".")
    except ValueError:
        log.error("invalid spec name %s" % input_json["name"])
        return

    if phase != "loop":
        log.error("cbmonitor only cares about access phase for now")
        return

    if "cluster_name" in input_json["info"]:
        cluster_name = input_json["info"]['cluster_name']
    else:
        cluster_name = "unknown"

    rs = {}
    if "reb_dur" in input_json["info"]:
        rs[("[%s:%s] Rebalance Time, s" % (cluster_name, name))] = \
            int(input_json["info"]["reb_dur"])

    client = CbmonitorClient(input_json["info"]["cbm-host"],
                             input_json["info"]["cbm-port"])
    client.post_results(input_json["buildinfo"]["version"], rs)
Ejemplo n.º 3
0
def post_to_cbm(input_json):
    """Collect and post results to litmus dashboard"""
    if not input_json:
        return

    if not "cbm" in input_json["info"] or not input_json["info"]["cbm"]:
        return

    try:
        testcase, phase = input_json["name"].split(".")
    except ValueError:
        log.error("invalid testcase %s" % input_json["name"])
        return

    if phase != "loop":
        log.error("litmus dashboard only cares about access phase for now")
        return

    if "cluster_name" in input_json["info"]:
        env = input_json["info"]['cluster_name']
    else:
        env = "unknown"

    metrics = {}
    if "xperf" in testcase and "ns_server_data" in input_json:
        mean = lambda samples: float(sum(samples)) / (len(samples) or 1)
        xdcr_stats = {
            "Avg. XDCR Queue": "replication_changes_left",
            "Avg. XDCR ops/sec": "xdc_ops"
        }
        for title, metric in xdcr_stats.iteritems():
            value = mean([
                mean(sample["op"]["samples"].get(metric, []))
                for sample in input_json["ns_server_data"]
            ])
            metrics[title] = round(value, 1)
    if "reb_dur" in input_json["info"]:
        metrics["Rebalance Time, s"] = int(input_json["info"]["reb_dur"])
    elif testcase.startswith("reb"):
        metrics["Rebalance Time, s"] = 0
    else:
        if "latency-get-90th-avg" in input_json["info"]:
            metrics["90th Get Latency, us"] = int(
                input_json["info"]["latency-get-90th-avg"])

        if "latency-set-90th-avg" in input_json["info"]:
            metrics["90th Set Latency, us"] = int(
                input_json["info"]["latency-set-90th-avg"])

        if "latency-query-90th-avg" in input_json["info"]:
            metrics["90th Query Latency, us"] = int(
                input_json["info"]["latency-query-90th-avg"])

    client = CbmonitorClient(input_json["info"]["cbm-host"],
                             input_json["info"]["cbm-port"])
    client.post_results(input_json["buildinfo"]["version"], testcase, env,
                        metrics)
Ejemplo n.º 4
0
def post_to_cbm(input_json):
    """Collect and post results to litmus dashboard"""
    if not input_json:
        return

    if not "cbm" in input_json["info"] or not input_json["info"]["cbm"]:
        return

    try:
        testcase, phase = input_json["name"].split(".")
    except ValueError:
        log.error("invalid testcase %s" % input_json["name"])
        return

    if phase != "loop":
        log.error("litmus dashboard only cares about access phase for now")
        return

    if "cluster_name" in input_json["info"]:
        env = input_json["info"]['cluster_name']
    else:
        env = "unknown"

    metrics = {}
    if "xperf" in testcase and "ns_server_data" in input_json:
        mean = lambda samples: float(sum(samples)) / (len(samples) or 1)
        xdcr_stats = {"Avg. XDCR Queue": "replication_changes_left",
                      "Avg. XDCR ops/sec": "xdc_ops"}
        for title, metric in xdcr_stats.iteritems():
            value = mean([
                mean(sample["op"]["samples"].get(metric, []))
                for sample in input_json["ns_server_data"]
            ])
            metrics[title] = round(value, 1)
    if "reb_dur" in input_json["info"]:
        metrics["Rebalance Time, s"] = int(input_json["info"]["reb_dur"])
    elif testcase.startswith("reb"):
        metrics["Rebalance Time, s"] = 0
    else:
        if "latency-get-90th-avg" in input_json["info"]:
            metrics["90th Get Latency, us"] = int(input_json["info"]["latency-get-90th-avg"])

        if "latency-set-90th-avg" in input_json["info"]:
            metrics["90th Set Latency, us"] = int(input_json["info"]["latency-set-90th-avg"])

        if "latency-query-90th-avg" in input_json["info"]:
            metrics["90th Query Latency, us"] = int(input_json["info"]["latency-query-90th-avg"])

    client = CbmonitorClient(input_json["info"]["cbm-host"],
                             input_json["info"]["cbm-port"])
    client.post_results(input_json["buildinfo"]["version"], testcase, env, metrics)
Ejemplo n.º 5
0
def post_to_cbm(input_json):
    """Collect and post results to cbmonitor dashboard"""
    if not input_json:
        return

    if not "cbm" in input_json["info"] or not input_json["info"]["cbm"]:
        return

    try:
        testcase, phase = input_json["name"].split(".")
    except ValueError:
        log.error("invalid testcase %s" % input_json["name"])
        return

    if phase != "loop":
        log.error("cbmonitor only cares about access phase for now")
        return

    if "cluster_name" in input_json["info"]:
        env = input_json["info"]["cluster_name"]
    else:
        env = "unknown"

    metrics = {}
    if "reb_dur" in input_json["info"]:
        metrics["Rebalance Time, s"] = int(input_json["info"]["reb_dur"])
    elif testcase.startswith("reb"):
        metrics["Rebalance Time, s"] = 0
    elif testcase.startswith("xperf"):
        xdcr_stats = {"Avg. XDCR Queue": "avg_replication_changes_left", "Avg. XDCR ops/sec": "avg_xdc_ops"}
        for title, metric in xdcr_stats.iteritems():
            if metric in input_json["info"]:
                metrics[title] = input_json["info"][metric]
    else:
        if "latency-get-90th-avg" in input_json["info"]:
            metrics["90th Get Latency, us"] = int(input_json["info"]["latency-get-90th-avg"])

        if "latency-set-90th-avg" in input_json["info"]:
            metrics["90th Set Latency, us"] = int(input_json["info"]["latency-set-90th-avg"])

        if "latency-query-90th-avg" in input_json["info"]:
            metrics["90th Query Latency, us"] = int(input_json["info"]["latency-query-90th-avg"])

    client = CbmonitorClient(input_json["info"]["cbm-host"], input_json["info"]["cbm-port"])
    client.post_results(input_json["buildinfo"]["version"], testcase, env, metrics)