示例#1
0
def histogram_snippet(
    request: Request,
    cluster: str,
    environment: str,
    topology: str,
    instance: str,
) -> HTMLResponse:
    """Render a HTML snippet containing jmap histogram output of container."""
    # use a function to DRY up these container API methods
    physical_plan = tracker.get_physical_plan(cluster, environment, topology)
    host = physical_plan["stmgrs"][physical_plan["instances"][instance]
                                   ["stmgrId"]]["host"]
    info = tracker.get_instance_mem_histogram(cluster, environment, topology,
                                              instance)
    command = info["command"]
    stdout = info["stdout"]
    return templates.TemplateResponse(
        "shell.snip.html",
        {
            "request": request,
            "host": host,
            "command": command,
            "output": stdout,
        },
    )
示例#2
0
def jmap_snippet(
    request: Request,
    cluster: str,
    environment: str,
    topology: str,
    instance: str,
) -> HTMLResponse:
    """Render a HTML snippet containing jmap output of container."""
    physical_plan = tracker.get_physical_plan(cluster, environment, topology)
    host = physical_plan["stmgrs"][physical_plan["instances"][instance]
                                   ["stmgrId"]]["host"]
    info = tracker.run_instance_jmap(cluster, environment, topology, instance)
    command = info["command"]
    stdout = info["stdout"]
    info = """
      <ul>
        <li>May take longer than usual (1-2 minutes) please be patient.</li>
        <li>Use SCP to copy heap dump files from host. (SCP {host}:/tmp/heap.bin /tmp/)</li>
      </ul>
  """
    return templates.TemplateResponse(
        "shell.snip.html",
        {
            "request": request,
            "host": host,
            "command": command,
            "output": stdout,
            "info": info,
        },
    )
示例#3
0
def physical_plan_json(cluster: str, environment: str,
                       topology: str) -> ApiEnvelope:
    """Return the physical plan object for a topology."""
    return api_topology_json(lambda: tracker.get_physical_plan(
        cluster,
        environment,
        topology,
        None,
    ))
示例#4
0
def pid_snippet(
    request: Request,
    cluster: str,
    environment: str,
    topology: str,
    instance: str,
) -> Response:
    """Render a HTML snippet containing topology output of container."""
    physical_plan = tracker.get_physical_plan(cluster, environment, topology)
    host = physical_plan["stmgrs"][physical_plan["instances"][instance]
                                   ["stmgrId"]]["host"]
    info = tracker.get_instance_pid(cluster, environment, topology, instance)
    command = info["command"]
    stdout = info["stdout"]
    return templates.TemplateResponse(
        "shell.snip.html",
        {
            "request": request,
            "host": host,
            "command": command,
            "output": stdout,
        },
    )