Beispiel #1
0
def show_table(request, id):
  table = dbutil.get_table(id)
  cluster = table.cluster

  read_requests_dist_by_rs, write_requests_dist_by_rs = dbutil.get_requests_distribution(table)
  params = {
    'chart_id': 'read_requests_on_rs',
    'chart_title': 'read requests on region',
    'request_dist': read_requests_dist_by_rs,
  }

  read_requests_dist_by_rs_chart = loader.get_template('monitor/requests_dist_column_chart.tpl').render(Context(params))

  params = {
    'chart_id': 'write_requests_on_rs',
    'chart_title': 'write requests on region',
    'request_dist': write_requests_dist_by_rs,
  }
  write_requests_dist_by_rs_chart = loader.get_template('monitor/requests_dist_column_chart.tpl').render(
    Context(params))

  group = str(table)
  tsdb_read_query = [metric_helper.make_metric_query(cluster.name, group, 'readRequestsCountPerSec')]
  tsdb_write_query = [metric_helper.make_metric_query(cluster.name, group, 'writeRequestsCountPerSec')]

  params = {
    'cluster': cluster,
    'table': table,
    'read_requests_dist_by_rs_chart': read_requests_dist_by_rs_chart,
    'write_requests_dist_by_rs_chart': write_requests_dist_by_rs_chart,
    'tsdb_read_query': tsdb_read_query,
    'tsdb_write_query': tsdb_write_query,
  }

  return respond(request, 'monitor/hbase_table.html', params)
Beispiel #2
0
def show_table_operation(request, id):
  table = dbutil.get_table(id)
  cluster = table.cluster
  endpoint = dbutil.map_cluster_to_endpoint(cluster.name)
  group = str(table)
  params = {
    'cluster' : cluster,
    'table' : table,
    'tsdb_metrics' : metric_helper.make_operation_metrics(endpoint, table, group),
    'endpoint' : endpoint
  }
  return respond(request, 'monitor/hbase_table_operation.html', params)
Beispiel #3
0
def show_table_operation(request, id):
    table = dbutil.get_table(id)
    cluster = table.cluster
    endpoint = dbutil.map_cluster_to_endpoint(cluster.name)
    group = str(table)
    params = {
        "cluster": cluster,
        "table": table,
        "tsdb_metrics": metric_helper.make_operation_metrics(endpoint, table, group),
        "endpoint": endpoint,
    }
    return respond(request, "monitor/hbase_table_operation.html", params)
Beispiel #4
0
def show_table(request, id):
    table = dbutil.get_table(id)
    cluster = table.cluster

    read_requests_dist_by_rs, write_requests_dist_by_rs = dbutil.get_requests_distribution(table)
    params = {
        "chart_id": "read_requests_on_rs",
        "chart_title": "read requests on region",
        "request_dist": read_requests_dist_by_rs,
    }

    read_requests_dist_by_rs_chart = loader.get_template("monitor/requests_dist_column_chart.tpl").render(
        Context(params)
    )

    params = {
        "chart_id": "write_requests_on_rs",
        "chart_title": "write requests on region",
        "request_dist": write_requests_dist_by_rs,
    }
    write_requests_dist_by_rs_chart = loader.get_template("monitor/requests_dist_column_chart.tpl").render(
        Context(params)
    )

    group = str(table)
    tsdb_read_query = [metric_helper.make_metric_query(cluster.name, group, "readRequestsCountPerSec")]
    tsdb_write_query = [metric_helper.make_metric_query(cluster.name, group, "writeRequestsCountPerSec")]

    params = {
        "cluster": cluster,
        "table": table,
        "read_requests_dist_by_rs_chart": read_requests_dist_by_rs_chart,
        "write_requests_dist_by_rs_chart": write_requests_dist_by_rs_chart,
        "tsdb_read_query": tsdb_read_query,
        "tsdb_write_query": tsdb_write_query,
    }

    return respond(request, "monitor/hbase_table.html", params)
Beispiel #5
0
def cancel_table_count_rows(request, id):
  table = dbutil.get_table(id)
  table.is_count_rows = False
  table.save()
  return HttpResponse()
Beispiel #6
0
def add_table_count_rows(request, id):
  table = dbutil.get_table(id)
  table.is_count_rows = True
  table.save()
  return HttpResponse()