← Back to team overview

graphite-dev team mailing list archive

Re: [Question #108329]: search entire metric set

 

Question #108329 on Graphite changed:
https://answers.launchpad.net/graphite/+question/108329

Tamale gave more information on the question:
here's my attempt.  in graphite/metrics/urls.py, I added another url
handler, 'grep', and in graphite/metrics/views.py, I added these lines
starting at line 112:

def grep_view(request):
  "Josh's attempt to make a search function that looks through all metrics"
  profile = getProfile(request)
  contexts = int( request.REQUEST.get('contexts', 0) )
  wildcards = int( request.REQUEST.get('wildcards', 0) )

  try:
    query = str( request.REQUEST['query'] )
  except:
    return HttpResponseBadRequest(content="Missing required parameter 'query'", mimetype="text/plain")

  store = settings.STORE

  matches = list( store.find(query) )

  matches.sort(key=lambda node: node.name)
  content = json.dump(matches)
  content = matches
  response = HttpResponse(content, mimetype='text/json')
  return response

-- 
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.