Esempio n. 1
0
  def get(self):
    urlfetch.set_default_fetch_deadline(60)

    try:
      filters = query_filter.Filters(self.request)
    except ValueError as e:
      self.response.headers['Content-Type'] = 'application/json'
      self.response.out.write({'error': str(e)})
      return
    query_results = _QueryEvents(bigquery.BigQuery(), **filters)
    trace_events = list(_ConvertQueryEventsToTraceEvents(query_results))

    self.response.headers['Content-Type'] = 'application/json'
    self.response.out.write(json.dumps(trace_events, separators=(',', ':')))
Esempio n. 2
0
    def get(self):
        try:
            filters = query_filter.Filters(self.request)
        except ValueError as e:
            self.response.headers['Content-Type'] = 'application/json'
            self.response.out.write({'error': str(e)})
            return

        query_parameters = []
        for filter_name, filter_values in filters.iteritems():
            if filter_name == 'start_time':
                query_parameters.append(('start_time', filter_values))
            else:
                for filter_value in filter_values:
                    query_parameters.append((filter_name, filter_value))
        template_values = {
            'query_string': urllib.urlencode(query_parameters),
        }

        template = jinja.ENVIRONMENT.get_template('trace.html')
        self.response.out.write(template.render(template_values))