- Status page now displaying server variable Questions instead of the sum of the Com_ statements. 'Questions' is an established performance measure, the sum of the Com_ statements is not

- Query pie chart displays always at least 7 statement types
- Live charts now use the server time on the x-axis, making them independent of time-zones
This commit is contained in:
Tyron Madlener 2011-06-22 10:22:22 +02:00
parent 3e4744df45
commit c7cf7574e4
6 changed files with 44 additions and 22 deletions

View File

@ -1414,10 +1414,13 @@ function PMA_createChart(passedSettings) {
var lastValue = null, curValue = null;
var numLoadedPoints = 0, otherSum = 0;
var diff;
// No realtime updates for graphs that are being exported, and disabled when no callback is set
// No realtime updates for graphs that are being exported, and disabled when realtime is not set
// Also don't do live charting if we don't have the server time
if(thisChart.options.chart.forExport == true ||
! passedSettings.realtime ||
! passedSettings.realtime.callback) return;
! passedSettings.realtime.callback ||
! server_time_diff) return;
thisChart.options.realtime.timeoutCallBack = function() {
$.post(passedSettings.realtime.url,
@ -1449,7 +1452,7 @@ function PMA_createChart(passedSettings) {
});
}
chart_activeTimeouts[container] = setTimeout(thisChart.options.realtime.timeoutCallBack, 0);
chart_activeTimeouts[container] = setTimeout(thisChart.options.realtime.timeoutCallBack, 5);
}
}
},
@ -1498,8 +1501,10 @@ function PMA_createChart(passedSettings) {
if(!passedSettings.realtime.numMaxPoints)
passedSettings.realtime.numMaxPoints = 30;
settings.xAxis.min = new Date().getTime() - passedSettings.realtime.numMaxPoints * passedSettings.realtime.refreshRate;
settings.xAxis.max = new Date().getTime();
if(server_time_diff) {
settings.xAxis.min = new Date().getTime() - server_time_diff - passedSettings.realtime.numMaxPoints * passedSettings.realtime.refreshRate;
settings.xAxis.max = new Date().getTime() - server_time_diff;
}
}
// Overwrite/Merge default settings with passedsettings

View File

@ -83,8 +83,10 @@ $js_messages['strChartServerTraffic'] = __('Server traffic (in kB)');
$js_messages['strChartConnections'] = __('Connections since last refresh');
$js_messages['strChartProcesses'] = __('Processes');
$js_messages['strChartConnectionsTitle'] = __('Connections / Processes');
$js_messages['strChartIssuedQueries'] = __('Issued queries since last refresh');
$js_messages['strChartIssuedQueriesTitle'] = __('Issued queries');
/* l10n: Questions is the name of a MySQL Status variable */
$js_messages['strChartIssuedQueries'] = __('Questions since last refresh');
/* l10n: Questions is the name of a MySQL Status variable */
$js_messages['strChartIssuedQueriesTitle'] = __('Questions (executed statements by the server)');
$js_messages['strChartQueryPie'] = __('Query statistics');

View File

@ -56,6 +56,14 @@ $(function() {
var tabStatus = new Object();
// Holds the current chart instances for each tab
var tabChart = new Object();
// Tell highcarts not to use UTC dates (global setting)
Highcharts.setOptions({
global: {
useUTC: false
}
});
$.ajaxSetup({
cache:false
@ -84,8 +92,8 @@ $(function() {
chart.options.realtime.refreshRate = 1000*parseInt(this.value);
chart.xAxis[0].setExtremes(
new Date().getTime() - chart.options.realtime.numMaxPoints * chart.options.realtime.refreshRate,
new Date().getTime() + chart.options.realtime.refreshRate / 4,
new Date().getTime() - server_time_diff - chart.options.realtime.numMaxPoints * chart.options.realtime.refreshRate,
new Date().getTime() - server_time_diff,
true
);

View File

@ -44,15 +44,17 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
exit(json_encode($ret));
case 'queries':
$queries = PMA_DBI_fetch_result('SHOW GLOBAL STATUS WHERE Variable_name LIKE "Com_%" AND Value>0', 0, 1);
$queries = PMA_DBI_fetch_result('SHOW GLOBAL STATUS WHERE Variable_name LIKE "Com_%" OR Variable_name="Questions" AND Value>0', 0, 1);
cleanDeprecated($queries);
// admin commands are not queries
unset($queries['Com_admin_commands']);
$questions = $queries['Questions'];
unset($queries['Questions']);
$sum=array_sum($queries);
//$sum=array_sum($queries);
$ret = array(
'x' => microtime(true)*1000,
'y' => $sum,
'y' => $questions,
'pointInfo' => $queries
);
@ -367,6 +369,7 @@ require './libraries/server_links.inc.php';
pma_token = '<?php echo $_SESSION[' PMA_token ']; ?>';
url_query = '<?php echo str_replace('&amp;','&',$url_query);?>';
pma_theme_image = '<?php echo $GLOBALS['pmaThemeImage']; ?>';
server_time_diff = new Date().getTime() - <?php echo microtime(true)*1000; ?>;
</script>
<div id="serverstatus">
<h2><?php
@ -521,7 +524,9 @@ function printQueryStatistics() {
?>
<h3 id="serverstatusqueries">
<?php
echo sprintf('Queries since startup: %s',PMA_formatNumber($total_queries, 0));
/* l10n: Questions is the name of a MySQL Status variable */
echo sprintf(__('Questions since startup: %s'),PMA_formatNumber($total_queries, 0)) . ' ';
echo PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_Questions');
?>
<br>
<span>
@ -537,11 +542,11 @@ function printQueryStatistics() {
if($total_queries / $server_status['Uptime'] >= 1) {
echo '&oslash;'.__('per second').':';
echo PMA_formatNumber( $total_queries / $server_status['Uptime'], 0);
}
?>
</span><br>
</span>
</h3>
<?php
}
// reverse sort by value to show most used statements first
arsort($used_queries);
@ -556,7 +561,7 @@ function printQueryStatistics() {
<col class="namecol" />
<col class="valuecol" span="3" />
<thead>
<tr><th><?php echo __('Query type'); ?></th>
<tr><th><?php echo __('Statements'); ?></th>
<th><?php
/* l10n: # = Amount of queries */
echo __('#');
@ -579,7 +584,8 @@ function printQueryStatistics() {
// but is included in Questions. Then the total of the percentages is 100.
$name = str_replace(Array('Com_', '_'), Array('', ' '), $name);
if($value < $query_sum * 0.02)
// Group together values that make out less than 2% into "Other", but only if we have more than 6 fractions already
if($value < $query_sum * 0.02 && count($chart_json)>6)
$other_sum += $value;
else $chart_json[$name] = $value;
?>

View File

@ -44,7 +44,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
$value = $_REQUEST['varValue'];
if(!is_numeric($value)) $value="'".$value."'";
if(PMA_DBI_query('SET GLOBAL '.PMA_backquote($_REQUEST['varName']).' = '.$value))
if(PMA_DBI_query('SET GLOBAL '.$_REQUEST['varName'].' = '.$value))
// Some values are rounded down etc.
$varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="'.$_REQUEST['varName'].'";','NUM');

View File

@ -1207,10 +1207,14 @@ div#serverstatusquerieschart {
padding-<?php echo $left; ?>: 30px;
}
div#serverstatus table#serverstatusqueriesdetails {
table#serverstatusqueriesdetails, table#serverstatustraffic {
float: <?php echo $left; ?>;
}
table#serverstatusqueriesdetails th {
min-width: 35px;
}
.clearfloat {
clear: both;
}
@ -1225,9 +1229,6 @@ table#serverstatusvariables .name {
table#serverstatusvariables .value {
width: 6em;
}
table#serverstatustraffic {
float: <?php echo $left; ?>;
}
table#serverstatusconnections {
float: <?php echo $left; ?>;
margin-<?php echo $left; ?>: 30px;