def show_storm_topology(request, id):
  cluster = dbutil.get_cluster(id)

  storm_id = request.GET.get('topology_id')
  spout_keys = ["__ack-count", "__fail-count", "__emit-count", "__transfer-count", "__complete-latency",]
  bolt_keys = ["__ack-count", "__fail-count", "__emit-count", "__transfer-count", "__process-latency", "__execute-count", "__execute-latency",]

  storm_metrics = {"storm_id" : storm_id}
  storm_graphs = []
  for key in spout_keys:
    title = storm_id + ":Spout:" + key
    query = ((key, dbutil.format_storm_name(storm_id)) % "&m=sum:%s{host=%s,group=STORM_BUILTIN_SPOUT_METRICS}&o=")
    graph = {
      "title" : title,
      "query" : query,
    }
    storm_graphs.append(graph)

  for key in bolt_keys:
    title = storm_id + ":Bolt:" + key
    query = ("&m=sum:%s{host=%s,group=STORM_BUILTIN_BOLT_METRICS}&o=" % (key, dbutil.format_storm_name(storm_id)))
    graph = {
      "title" : title,
      "query" : query,
    }
    storm_graphs.append(graph)

  storm_metrics["graphs"] = storm_graphs
  params = {
    'cluster' : cluster,
    'storm_metrics' : storm_metrics,
  }

  return respond(request, 'monitor/storm_topology.html', params)
dataset/ETHPy150Open XiaoMi/minos/owl/monitor/views.py/show_storm_topology/swapped operands of `%`