summaryrefslogtreecommitdiffstats
path: root/google-appengine/google/appengine/ext/appstats/templates/details.html
blob: 20710aff96f4a890d662fb867e9be4926403a29f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
{% extends "base.html" %}
{% block headstuff %}{% endblock %}
{% block content %}
  {% if not record %}
    <p>Invalid or stale record key!</p>
  {% else %}
    <div class="g-section" id="ae-stats-summary">
      <dl>
        <dt>
          <span class="ae-stats-date">{{record.start_time_formatted}}</span><br>
          <span class="ae-stats-response ae-stats-response-{{record.http_status}}">
            {{record.http_status}}
          </span>
        </dt>
        <dd>
          <a {% ifequal record.http_method 'GET' %}target="_new" title="Resubmit the original request to the server" href="{{record.http_path|escape}}{{record.http_query|escape}}" {% endifequal %}>
            {{record.http_method|escape}}  {{record.http_path|escape}}{{record.http_query|escape}}
          </a>
          <br>
          {{record.user_email|escape}}{% if record.is_admin %}*{% endif %}
          real={{record.duration_milliseconds}}ms
          cpu={{record.processor_milliseconds}}ms
          api={{record.api_milliseconds}}ms
          overhead={{record.overhead_walltime_milliseconds}}ms
        </dd>
      </dl>
    </div>


    <div id="ae-stats-details-timeline">
      <h2>Timeline</h2>
      <div id="ae-body-timeline">
        <div id="ae-rpc-chart">[Chart goes here]</div>
      </div>
      {% if record.individual_stats_size %}
        <div id="ae-rpc-traces">
          <div class="ae-table-title">
            <div class="g-section g-tpl-50-50 g-split">
              <div class="g-unit g-first"><h2>RPC Call Traces</h2></div>
              <div class="g-unit" id="ae-rpc-expand-all"></div>
            </div>
          </div>
          <table cellspacing="0" cellpadding="0" class="ae-table" id="ae-table-rpc">
            <thead>
              <tr>
                <th>RPC</th>
              </tr>
            </thead>
            {% for t in record.individual_stats_list %}
            <tbody id="rpc{{forloop.counter}}">
              <tr>
                <td>
                  <span class="goog-inline-block ae-zippy ae-zippy-expand" id="ae-path-requests-{{forloop.counter}}"></span>
                  @{{t.start_offset_milliseconds}}ms
                  <b>{{t.service_call_name|escape}}</b>
                  real={{t.duration_milliseconds}}ms
                  api={{t.api_milliseconds}}ms
                </td>
              </tr>
            </tbody>
            <tbody>
              {% if t.request_data_summary %}
              <tr>
                <td style="padding-left: 20px"><b>Request:</b> {{t.request_data_summary|escape}}</td>
              </tr>
              {% endif %}
              {% if t.response_data_summary %}
              <tr>
                <td style="padding-left: 20px"><b>Response:</b> {{t.response_data_summary|escape}}</td>
              </tr>
              {% endif %}
              {% if t.call_stack_size %}
              <tr>
                <td style="padding-left: 20px"><b>Stack:</b></td>
              </tr>
              {% for f in t.call_stack_list %}
                <tr>
                  <td style="padding-left: 40px">
              <span  style="padding-left: 12px; text-indent: -12px" class="goog-inline-block ae-zippy-expand" id="ae-head-stack-{{forloop.parentloop.counter}}-{{forloop.counter}}">&nbsp;</span>
                    {% if file_url %}<a href="{{file_url}}?f={{f.class_or_file_name|escape}}&n={{f.line_number}}#n{{f.line_number|add:"-10"}}">{% endif %} {{f.class_or_file_name|escape}}:{{f.line_number}}{% if file_url %}</a>{% endif %} {{f.function_name|escape}}()
                  </td>
                </tr>
                {% if f.variables_size %}
                  <tr id="ae-body-stack-{{forloop.parentloop.counter}}-{{forloop.counter}}">
                    <td style="padding-left: 60px">{% for item in f.variables_list %}{{item.key|escape}} = {{item.value|escape}}<br>{% endfor %}
                    </td>
                  </tr>
                {% endif %}{# f.variables_size #}
              {% endfor %}{# t.call_stack_list #}
              {% endif %}{# t.call_stack_size #}
            </tbody>
            {% endfor %}{# record.individual_stats_list #}
          </table>
        </div>
      {% endif %}{# traces #}
    {% endif %}
  </div>

  {% if rpcstats_by_count %}
    <div id="ae-stats-details-rpcstats">
      <h2>RPC Stats</h2>
      <table cellspacing="0" cellpadding="0" class="ae-table" id="ae-table-rpcstats">
        <tbody>
          <tr>
            <td>service.call</td>
            <td align="right">#RPCs</td>
            <td align="right">real time</td>
            <td align="right">api time</td>
          </tr>
          {% for item in rpcstats_by_count %}
          <tr>
            <td>{{item.0|escape}}</td>
            <td align="right">{{item.1|escape}}</td>
            <td align="right">{{item.2}}ms</td>
            <td align="right">{{item.3}}ms</td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
  {% endif %}{# rpcstats_by_count #}

  {% if record.cgi_env_size %}
    <div id="ae-stats-details-cgienv">
      <h2>CGI Environment</h2>
      <table cellspacing="0" cellpadding="0" class="ae-table" id="ae-table-cgienv">
        <tbody>
          {% for item in record.cgi_env_list %}
          <tr>
            <td align="right" valign="top">{{item.key|escape}}=</td>
            <td valign="top">{{item.value|escape}}</td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
  {% endif %}{# record.cgi_env_size #}

  {% if sys.path %}
    <div id="ae-stats-details-syspath">
      <h2>sys.path</h2>
      <table cellspacing="0" cellpadding="0" class="ae-table" id="ae-table-syspath">
        <tbody>
          <tr>
            <td colspan="2">
              <i>Note:</i> sys.path is not saved with the request;
              this is the <i>current</i> sys.path.
            </td>
          </tr>
          <tr>
          </tr>
          {% for item in sys.path %}
          <tr>
            <td align="right" valign="top">{{forloop.counter0}}:</td>
            <td valign="top">{{item|escape}}</td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
  {% endif %}{# sys.path #}

{% endblock %}

{% block tailstuff %}
<script>
var rpcZippyMaker = new ae.Stats.MakeZippys('ae-table-rpc',
    'ae-rpc-expand-all');
var rpcZippys = rpcZippyMaker.getZippys();
{% for t in record.individual_stats_list %}
  {% for f in t.call_stack_list %}
    {% if f.variables_size %}
      new goog.ui.Zippy(
          'ae-head-stack-{{forloop.parentloop.counter}}-{{forloop.counter}}',
          'ae-body-stack-{{forloop.parentloop.counter}}-{{forloop.counter}}',
          false);
    {% endif %}
  {% endfor %}
{% endfor %}
</script>
<script>
var detailsTabs_ = new ae.Stats.Details.Tabs(['timeline', 'rpcstats',
    'cgienv', 'syspath']);
</script>
<script>
function timelineClickHandler(zippyIndex, hash) {
  rpcZippyMaker.getExpandCollapse().setExpanded(false);
  rpcZippys[zippyIndex].setExpanded(true);

  var headlineIndex = parseInt(zippyIndex, 10) + 1;
  var zippyLine = document.getElementById('ae-path-requests-' + headlineIndex);
  zippyLine.scrollIntoView(true);
}
function renderChart() {
  var chart = new Gantt();
  {% for t in record.individual_stats_list %}
    chart.add_bar('{{t.service_call_name|escape}}',
        {{t.start_offset_milliseconds}}, {{t.duration_milliseconds}},
        {{t.api_milliseconds}},
        '{{t.duration_milliseconds}}ms{% if t.api_milliseconds %} ({{t.api_milliseconds}}ms api){% endif %}',
        'javascript:timelineClickHandler(\'{{forloop.counter0}}\');');
  {% endfor %}

  chart.add_bar('<b>RPC Total</b>', 0, {{real_total}}, {{api_total}},
      '{{real_total}}ms{% if api_total %} ({{api_total}}ms api){% endif %}',
      '');
  chart.add_bar('<b>Grand Total</b>', 0, {{record.duration_milliseconds}},
      {{charged_total}},
      '{{record.duration_milliseconds}}ms{% if charged_total %} ({{charged_total}}ms cpu+api){% endif %}', '');
  document.getElementById('ae-rpc-chart').innerHTML = chart.draw();
}
renderChart();
</script>
{% endblock %}