<commit_before>/*
 * Copyright 2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var traceSummaryTemplateText = ''
+ '{{#if error}}'
+ '  <b>ERROR</b><br>'
+ '{{/if}}'
+ '{{#if active}}'
+ '  <b>ACTIVE {{#if stuck}}/ STUCK{{/if}}</b><br>'
+ '{{^}}'
+ '  {{#if stuck}}<b>{{#if completed}}UN{{/if}}STUCK</b><br>{{/if}}'
+ '{{/if}}'
+ '{{#if background}}'
+ '  <b>background</b><br>'
+ '{{/if}}'
+ '<div class="second-line-indent">'
+ '  {{description}}'
+ '  {{#if showExport}}'
// unfortunately vertical padding isn't applied to inline elements, so "button" is a little small
// but it seems worth keeping this inline and it is a less used "button" anyways
+ '    <a class="indent1 pad1 rounded4" href="trace/export/{{id}}">export</a>'
+ '  {{/if}}'
+ '</div>'
+ 'start: {{date start}}<br>'
+ 'duration: {{nanosToMillis duration}}{{#if active}}..{{/if}} milliseconds<br>'
+ '{{#each attributes}}'
+ '  <div class="second-line-indent">{{name}}: {{value}}</div>'
+ '{{/each}}'
+ '{{#if userId}}<div class="second-line-indent">user ID: {{userId}}</div>{{/if}}'
+ '{{#if error}}<div class="second-line-indent"><b>error: {{error.text}}</b></div>{{/if}}'
+ 'breakdown (in milliseconds):<br>'
+ '<table class="metrics-table indent1" style="border-spacing:0">'
+ '  <thead>'
+ '    <tr>'
+ '      <td></td>'
+ '      <td>total</td>'
+ '      <td>min</td>'
+ '      <td>max</td>'
+ '      <td>count</td>'
+ '    </tr>'
+ '  </thead>'
+ '  <tbody>'
+ '    {{#each metrics}}'
+ '      <tr>'
+ '        <td style="text-align: left">{{name}}</td>'
+ '        <td>{{nanosToMillis total}}{{#if active}}..{{/if}}</td>'
+ '        <td>{{nanosToMillis min}}{{#if minActive}}..{{/if}}</td>'
+ '        <td>{{nanosToMillis max}}{{#if maxActive}}..{{/if}}</td>'
+ '        <td>{{count}}</td>'
+ '      </tr>'
+ '    {{/each}}'
+ '  </tbody>'
+ '</table>'
var traceDetailTemplateText = ''
+ '{{#if spans}}'
+ '  {{#ifRolledOver spans}}'
+ '    <div>spans <i>rolled over</i></div>'
+ '  {{^}}'
+ '    <button class="lightbtn pad1" onclick="toggleSpans()">'
+ '      <span class="red">spans</span> ({{spans.length}})'
+ '    </button><br>'
+ '    <div id="sps"></div>'
+ '  {{/ifRolledOver}}'
+ '{{/if}}'
// todo combine merged stack tree into template to consolidate code between coarse and fine mst
+ '{{#if coarseMergedStackTree}}'
+ '  {{#ifRolledOver coarseMergedStackTree}}'
+ '    <div>coarse-grained profile <i>rolled over</i></div>'
+ '  {{^}}'
+ '    <button class="lightbtn pad1" onclick="toggleCoarseMergedStackTree()">'
+ '      <span class="red">coarse-grained profile</span> ({{coarseMergedStackTree.sampleCount}})'
+ '    </button><br>'
+ '    <div class="nowrap indent1 hide" id="mstCoarseOuter">'
+ '        <select class="mst-filter input-large" onchange="this.blur()"'
+ '            style="margin: 4px"></select><br>'
// margin-bottom is needed to trump .expandable class' margin-bottom: 4px since no buffer is needed
// when this is expanded since nothing can be expanded directly below it
+ '      <button class="lightbtn mst-common expandable pad1 hide" style="margin-bottom: 0">'
+ '        <div class="unexpanded-content red">common base</div>'
+ '        <div class="expanded-content hide"></div>'
+ '      </button><br>'
+ '      <div class="mst-interesting indent1"></div>'
+ '    </div>'
+ '  {{/ifRolledOver}}'
+ '{{/if}}'
+ '{{#if fineMergedStackTree}}'
+ '  {{#ifRolledOver fineMergedStackTree}}'
+ '    <div>fine-grained profile <i>rolled over</i><div>'
+ '  {{^}}'
+ '    <button class="lightbtn pad1" onclick="toggleFineMergedStackTree()">'
+ '      <span class="red">fine-grained profile</span> ({{fineMergedStackTree.sampleCount}})'
+ '    </button><br>'
+ '    <div class="nowrap indent1 hide" id="mstFineOuter">'
+ '        <select class="mst-filter input-large" onchange="this.blur()"'
+ '            style="margin: 4px"></select><br>'
// margin-bottom is needed to trump .expandable class' margin-bottom: 4px since no buffer is needed
// when this is expanded since nothing can be expanded directly below it
+ '      <button class="lightbtn mst-common expandable pad1 hide" style="margin-bottom: 0">'
+ '        <div class="unexpanded-content red">common base</div>'
+ '        <div class="expanded-content hide"></div>'
+ '      </button><br>'
+ '      <div class="mst-interesting indent1"></div>'
+ '    </div>'
+ '  {{/ifRolledOver}}'
+ '{{/if}}'
var spansTemplateText = ''
+ '<div class="indent1" style="float: left; width: 3em; text-align: right">'
+ '    +{{nanosToMillis offset}}'
+ '  </div>'
+ '  <div style="margin-left: {{margin nestingLevel}}em">'
+ '    <div style="width: 2em; float: left; text-align: right">'
+ '      {{nanosToMillis duration}}{{#if active}}..{{/if}}'
+ '    </div>'
+ '    <div style="margin-left: 3em">'
+ '      {{#ifLongDescription message.text}}'
+ '        <span class="expandable indent1">'
// lack of spacing between first/middle/last text is important in these lines
+ '          {{first80 message.text}}<span class="unexpanded-content"> ... </span><span'
+ '             class="expanded-content hide">{{middle message.text}}</span>{{last80 message.text}}'
+ '        </span><br>'
+ '      {{^}}'
+ '        <div class="indent1">'
+ '          {{message.text}}'
+ '        </div>'
+ '      {{/ifLongDescription}}'
+ '      {{#if message.detail}}'
+ '        <button class="lightbtn expandable indent2 pad1">'
+ '          <div class="unexpanded-content red">detail</div>'
+ '          <div class="expanded-content hide">'
+ '            {{{messageDetailHtml message.detail}}}'
+ '          </div>'
+ '        </button><br>'
+ '      {{/if}}'
+ '      {{#if error}}'
+ '        <div class="indent2">'
+ '          <b><span class="indent1">{{error.text}}</span></b>'
+ '          <br>'
+ '          {{#if error.detail}}'
+ '            <div class="indent1">'
+ '              {{{messageDetailHtml error.detail}}}'
+ '            </div>'
+ '          {{/if}}'
+ '          {{#if error.exception}}'
+ '            <button class="lightbtn expandable indent1 pad1">'
+ '              <div class="unexpanded-content red">exception</div>'
+ '              <div class="expanded-content hide nowrap">'
+ '                {{{exceptionHtml error.exception}}}'
+ '              </div>'
+ '            </button><br>'
+ '          {{/if}}'
+ '        </div>'
+ '      {{/if}}'
+ '      {{#if stackTrace}}'
+ '        <button class="lightbtn expandable indent2 pad1">'
+ '          <div class="unexpanded-content red">span stack trace</div>'
+ '          <div class="expanded-content hide nowrap">'
+ '            {{{stackTraceHtml stackTrace}}}'
+ '          </div>'
+ '        </button><br>'
+ '      {{/if}}'
+ '    </div>'
+ '  </div>'
Handlebars.registerHelper('date', function(timestamp) {
  return moment(timestamp).format('L h:mm:ss A (Z)')
})
Handlebars.registerHelper('nanosToMillis', function(nanos) {
  return (nanos / 1000000).toFixed(1)
})
Handlebars.registerHelper('messageDetailHtml', function(detail) {
  function messageDetailHtml(detail) {
    var ret = ''
    $.each(detail, function(propName, propVal) {
      ret += propName + ':'
      if (typeof propVal == 'object') {<commit_msg>Fix bug with null detail value<commit_after>/*
 * Copyright 2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var traceSummaryTemplateText = ''
+ '{{#if error}}'
+ '  <b>ERROR</b><br>'
+ '{{/if}}'
+ '{{#if active}}'
+ '  <b>ACTIVE {{#if stuck}}/ STUCK{{/if}}</b><br>'
+ '{{^}}'
+ '  {{#if stuck}}<b>{{#if completed}}UN{{/if}}STUCK</b><br>{{/if}}'
+ '{{/if}}'
+ '{{#if background}}'
+ '  <b>background</b><br>'
+ '{{/if}}'
+ '<div class="second-line-indent">'
+ '  {{description}}'
+ '  {{#if showExport}}'
// unfortunately vertical padding isn't applied to inline elements, so "button" is a little small
// but it seems worth keeping this inline and it is a less used "button" anyways
+ '    <a class="indent1 pad1 rounded4" href="trace/export/{{id}}">export</a>'
+ '  {{/if}}'
+ '</div>'
+ 'start: {{date start}}<br>'
+ 'duration: {{nanosToMillis duration}}{{#if active}}..{{/if}} milliseconds<br>'
+ '{{#each attributes}}'
+ '  <div class="second-line-indent">{{name}}: {{value}}</div>'
+ '{{/each}}'
+ '{{#if userId}}<div class="second-line-indent">user ID: {{userId}}</div>{{/if}}'
+ '{{#if error}}<div class="second-line-indent"><b>error: {{error.text}}</b></div>{{/if}}'
+ 'breakdown (in milliseconds):<br>'
+ '<table class="metrics-table indent1" style="border-spacing:0">'
+ '  <thead>'
+ '    <tr>'
+ '      <td></td>'
+ '      <td>total</td>'
+ '      <td>min</td>'
+ '      <td>max</td>'
+ '      <td>count</td>'
+ '    </tr>'
+ '  </thead>'
+ '  <tbody>'
+ '    {{#each metrics}}'
+ '      <tr>'
+ '        <td style="text-align: left">{{name}}</td>'
+ '        <td>{{nanosToMillis total}}{{#if active}}..{{/if}}</td>'
+ '        <td>{{nanosToMillis min}}{{#if minActive}}..{{/if}}</td>'
+ '        <td>{{nanosToMillis max}}{{#if maxActive}}..{{/if}}</td>'
+ '        <td>{{count}}</td>'
+ '      </tr>'
+ '    {{/each}}'
+ '  </tbody>'
+ '</table>'
var traceDetailTemplateText = ''
+ '{{#if spans}}'
+ '  {{#ifRolledOver spans}}'
+ '    <div>spans <i>rolled over</i></div>'
+ '  {{^}}'
+ '    <button class="lightbtn pad1" onclick="toggleSpans()">'
+ '      <span class="red">spans</span> ({{spans.length}})'
+ '    </button><br>'
+ '    <div id="sps"></div>'
+ '  {{/ifRolledOver}}'
+ '{{/if}}'
// todo combine merged stack tree into template to consolidate code between coarse and fine mst
+ '{{#if coarseMergedStackTree}}'
+ '  {{#ifRolledOver coarseMergedStackTree}}'
+ '    <div>coarse-grained profile <i>rolled over</i></div>'
+ '  {{^}}'
+ '    <button class="lightbtn pad1" onclick="toggleCoarseMergedStackTree()">'
+ '      <span class="red">coarse-grained profile</span> ({{coarseMergedStackTree.sampleCount}})'
+ '    </button><br>'
+ '    <div class="nowrap indent1 hide" id="mstCoarseOuter">'
+ '        <select class="mst-filter input-large" onchange="this.blur()"'
+ '            style="margin: 4px"></select><br>'
// margin-bottom is needed to trump .expandable class' margin-bottom: 4px since no buffer is needed
// when this is expanded since nothing can be expanded directly below it
+ '      <button class="lightbtn mst-common expandable pad1 hide" style="margin-bottom: 0">'
+ '        <div class="unexpanded-content red">common base</div>'
+ '        <div class="expanded-content hide"></div>'
+ '      </button><br>'
+ '      <div class="mst-interesting indent1"></div>'
+ '    </div>'
+ '  {{/ifRolledOver}}'
+ '{{/if}}'
+ '{{#if fineMergedStackTree}}'
+ '  {{#ifRolledOver fineMergedStackTree}}'
+ '    <div>fine-grained profile <i>rolled over</i><div>'
+ '  {{^}}'
+ '    <button class="lightbtn pad1" onclick="toggleFineMergedStackTree()">'
+ '      <span class="red">fine-grained profile</span> ({{fineMergedStackTree.sampleCount}})'
+ '    </button><br>'
+ '    <div class="nowrap indent1 hide" id="mstFineOuter">'
+ '        <select class="mst-filter input-large" onchange="this.blur()"'
+ '            style="margin: 4px"></select><br>'
// margin-bottom is needed to trump .expandable class' margin-bottom: 4px since no buffer is needed
// when this is expanded since nothing can be expanded directly below it
+ '      <button class="lightbtn mst-common expandable pad1 hide" style="margin-bottom: 0">'
+ '        <div class="unexpanded-content red">common base</div>'
+ '        <div class="expanded-content hide"></div>'
+ '      </button><br>'
+ '      <div class="mst-interesting indent1"></div>'
+ '    </div>'
+ '  {{/ifRolledOver}}'
+ '{{/if}}'
var spansTemplateText = ''
+ '<div class="indent1" style="float: left; width: 3em; text-align: right">'
+ '    +{{nanosToMillis offset}}'
+ '  </div>'
+ '  <div style="margin-left: {{margin nestingLevel}}em">'
+ '    <div style="width: 2em; float: left; text-align: right">'
+ '      {{nanosToMillis duration}}{{#if active}}..{{/if}}'
+ '    </div>'
+ '    <div style="margin-left: 3em">'
+ '      {{#ifLongDescription message.text}}'
+ '        <span class="expandable indent1">'
// lack of spacing between first/middle/last text is important in these lines
+ '          {{first80 message.text}}<span class="unexpanded-content"> ... </span><span'
+ '             class="expanded-content hide">{{middle message.text}}</span>{{last80 message.text}}'
+ '        </span><br>'
+ '      {{^}}'
+ '        <div class="indent1">'
+ '          {{message.text}}'
+ '        </div>'
+ '      {{/ifLongDescription}}'
+ '      {{#if message.detail}}'
+ '        <button class="lightbtn expandable indent2 pad1">'
+ '          <div class="unexpanded-content red">detail</div>'
+ '          <div class="expanded-content hide">'
+ '            {{{messageDetailHtml message.detail}}}'
+ '          </div>'
+ '        </button><br>'
+ '      {{/if}}'
+ '      {{#if error}}'
+ '        <div class="indent2">'
+ '          <b><span class="indent1">{{error.text}}</span></b>'
+ '          <br>'
+ '          {{#if error.detail}}'
+ '            <div class="indent1">'
+ '              {{{messageDetailHtml error.detail}}}'
+ '            </div>'
+ '          {{/if}}'
+ '          {{#if error.exception}}'
+ '            <button class="lightbtn expandable indent1 pad1">'
+ '              <div class="unexpanded-content red">exception</div>'
+ '              <div class="expanded-content hide nowrap">'
+ '                {{{exceptionHtml error.exception}}}'
+ '              </div>'
+ '            </button><br>'
+ '          {{/if}}'
+ '        </div>'
+ '      {{/if}}'
+ '      {{#if stackTrace}}'
+ '        <button class="lightbtn expandable indent2 pad1">'
+ '          <div class="unexpanded-content red">span stack trace</div>'
+ '          <div class="expanded-content hide nowrap">'
+ '            {{{stackTraceHtml stackTrace}}}'
+ '          </div>'
+ '        </button><br>'
+ '      {{/if}}'
+ '    </div>'
+ '  </div>'
Handlebars.registerHelper('date', function(timestamp) {
  return moment(timestamp).format('L h:mm:ss A (Z)')
})
Handlebars.registerHelper('nanosToMillis', function(nanos) {
  return (nanos / 1000000).toFixed(1)
})
Handlebars.registerHelper('messageDetailHtml', function(detail) {
  function messageDetailHtml(detail) {
    var ret = ''
    $.each(detail, function(propName, propVal) {
      ret += propName + ':'
      // need to check not null since typeof null == 'object'
      if (propVal != null && typeof propVal == 'object') {
{'fraction_non_alphanumeric': 0.222710244154502, 'fraction_numerical': 0.007105025190543858, 'mean_word_length': 3.2570800109980755, 'pattern_counts': {'":': 0, '<': 325, '<?xml version=': 0, '>': 325, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4740474', 'n_tokens_mistral': 5300, 'n_tokens_neox': 5087, 'n_words': 1136}