Permalink
Browse files

SQL Server: Show some blocking info

  • Loading branch information...
Nick Craver
Nick Craver committed Mar 12, 2015
1 parent 03ae19f commit c98f9ff7bb8a9e33f6395140aae3eaedc59de656
@@ -21,7 +21,7 @@ public Cache<List<ActiveOperation>> GetActiveOperations(ActiveSearchOptions opti
CacheKey = GetCacheKey("ActiveOperations-" + options.GetHashCode()),
CacheForSeconds = 5,
CacheStaleForSeconds = 5*60,
UpdateCache = UpdateFromSql("ActiveOperations", conn => conn.Query<WhoIsActiveRow>(options.ToSQLQuery(), options)
UpdateCache = UpdateFromSql("ActiveOperations", conn => conn.Query<WhoIsActiveRow>(options.ToSQLQuery(), options, commandTimeout: 300)
.Select(row => new ActiveOperation(row))
.ToList())
};
@@ -615,6 +615,22 @@ tr.primary-row td {
tr.primary-row td .node-name-link {
font-weight: bold;
}
.curved-section {
border-radius: 5px;
}
.critical-summary {
border: solid 1px rgba(200, 0, 0, 0.6) !important;
background: rgba(200, 0, 0, 0.05);
padding: 10px;
margin: 5px;
}
.critical-summary h3 {
padding: 0;
color: black;
}
.critical-summary ul ul {
padding-left: 15px;
}
/* Node Search */
.top-nodes {
margin-left: 15px;

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -477,6 +477,22 @@ tr {
}
}
}
.curved-section {
border-radius: 5px;
}
.critical-summary {
border: solid 1px rgba(200, 0, 0, 0.6) !important;
background: rgba(200, 0, 0, 0.05);
padding: 10px;
margin: 5px;
}
.critical-summary h3 {
padding: 0;
color: black;
}
.critical-summary ul ul {
padding-left: 15px;
}
/* Node Search */
.top-nodes {

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -56,8 +56,8 @@
<div class="node-dashboard-separator half-width"></div>
<table class="striped-dashboard">
<tbody class="node-header">
<table class="striped-dashboard" class="refresh-group" data-name="pagerduty">
<tbody>
<tr class="category-row">
<th colspan="8">
<h3>
@@ -74,27 +74,29 @@
<th>Summary</th>
</tr>
</tbody>
<tbody class="node-group">
<tbody>
@foreach (var i in Model.AllIncidents.OrderByDescending(i => i.CreationDate))
{
<tr class="server-row @i.MonitorStatus.RowClass()">
<td><a href="#/pagerduty/incident/detail/@i.Number">@i.Number</a></td>
<td>@i.CreationDate.ToRelativeTimeSpan()</td>
<td>@i.AffectedService.Name</td>
<td><span class="@i.MonitorStatus.Class()">@i.Status.ToTitleCase()</span>
@if (i.LastChangedBy != null)
{
<span class="note">(@i.LastChangedBy.FullName)</span>
}</td>
<td>
@if (i.SummaryData.Keys.Contains("subject"))
{
@i.SummaryData["subject"]
}
</td>
</tr>
}
@foreach (var i in Model.AllIncidents.OrderByDescending(i => i.CreationDate))
{
<tr class="server-row @i.MonitorStatus.RowClass()">
<td><a href="#/pagerduty/incident/detail/@i.Number">@i.Number</a></td>
<td>@i.CreationDate.ToRelativeTimeSpan()</td>
<td>@i.AffectedService.Name</td>
<td>
<span class="@i.MonitorStatus.Class()">@i.Status.ToTitleCase()</span>
@if (i.LastChangedBy != null)
{
<span class="note">(@i.LastChangedBy.FullName)</span>
}
</td>
<td>
@if (i.SummaryData.Keys.Contains("subject"))
{
@i.SummaryData["subject"]
}
</td>
</tr>
}
</tbody>
</table>
@@ -40,28 +40,28 @@
<div class="filters-wrap">
<div class="filters-current">
<span class="filter-label">Sleeping: </span><span class="filter-value">@Model.ActiveSearchOptions.IncludeSleepingSessions.GetDescription()</span>
@if (Model.ActiveSearchOptions.GetAdditionalInfo)
{
<span class="filter-label">Details: </span><span class="filter-value">Yes</span>
}
@if (Model.ActiveSearchOptions.IncludeSystemSessions)
{
<span class="filter-label">System: </span><span class="filter-value">Yes</span>
}
@if (Model.ActiveSearchOptions.FilterValue.HasValue())
{
<span class="filter-label">@Model.ActiveSearchOptions.FilterField.GetDescription(): </span><span class="filter-value">@Model.ActiveSearchOptions.FilterValue</span>
}
@if (Model.ActiveSearchOptions.GetAdditionalInfo)
{
<span class="filter-label">Details: </span><span class="filter-value">Yes</span>
}
@if (Model.ActiveSearchOptions.IncludeSystemSessions)
{
<span class="filter-label">System: </span><span class="filter-value">Yes</span>
}
@if (Model.ActiveSearchOptions.FilterValue.HasValue())
{
<span class="filter-label">@Model.ActiveSearchOptions.FilterField.GetDescription(): </span><span class="filter-value">@Model.ActiveSearchOptions.FilterValue</span>
}
</div>
<div class="filters">
<form class="filter-form" action="" method="GET">
<input type="hidden" name="node" value="@Model.CurrentInstance.Name" />
<input type="hidden" name="node" value="@Model.CurrentInstance.Name"/>
<div class="filters-header">Filters</div>
<div class="filter">
<label>Include Details: <input type="checkbox" @(Model.ActiveSearchOptions.GetAdditionalInfo ? "checked " : "") name="details" value="true" /></label>
<label>Include Details: <input type="checkbox" @(Model.ActiveSearchOptions.GetAdditionalInfo ? "checked " : "") name="details" value="true"/></label>
</div>
<div class="filter">
<label>Include System Sessions: <input type="checkbox" @(Model.ActiveSearchOptions.IncludeSystemSessions ? "checked " : "") name="system" value="true" /></label>
<label>Include System Sessions: <input type="checkbox" @(Model.ActiveSearchOptions.IncludeSystemSessions ? "checked " : "") name="system" value="true"/></label>
</div>
<div class="filter">
Include Sleeping:
@@ -70,21 +70,59 @@
@SleepingSessions(SQLInstance.ActiveSearchOptions.ShowSleepingSessionOptions.All, "Yes")
</div>
<div class="filter">
Search:
Search:
<select name="filterField">
@foreach (SQLInstance.ActiveSearchOptions.FilterFields e in Enum.GetValues(typeof(SQLInstance.ActiveSearchOptions.FilterFields)))
{
<option value="@e.ToString()" @(e == Model.ActiveSearchOptions.FilterField ? "selected " : "")>@e.GetDescription()</option>
}
@foreach (SQLInstance.ActiveSearchOptions.FilterFields e in Enum.GetValues(typeof (SQLInstance.ActiveSearchOptions.FilterFields)))
{
<option value="@e.ToString()" @(e == Model.ActiveSearchOptions.FilterField ? "selected " : "")>@e.GetDescription()</option>
}
</select>
<input style="width: 240px;" type="text" value="@Model.ActiveSearchOptions.FilterValue" name="filterValue" placeholder="Search Text" />
<input style="width: 240px;" type="text" value="@Model.ActiveSearchOptions.FilterValue" name="filterValue" placeholder="Search Text"/>
</div>
<button class="submit-button" type="submit">Apply</button>
</form>
</div>
</div>
@*<a href="#" class="reload-link">Refresh</a>*@
</h3>
@if (data.Any(o => o.BlockingSessionId.HasValue))
{
<div class="critical-summary curved-section">
<h3>Blocking Detected:</h3>
<div>
<ul>
@helper BlockingTree(SQLInstance.ActiveOperation op, Dictionary<SQLInstance.ActiveOperation, List<SQLInstance.ActiveOperation>> blocked){
<li>
Session: <a href="#spid-@op.SessionId">@op.SessionId</a>
@if (blocked[op].Any())
{
<ul>
<li>Session: @string.Join(", ", blocked[op].Where(b => !blocked[b].Any()).Select(b => string.Format("<a href=\"#spid-{0}\">{0}</a>", b.SessionId))).AsHtml()</li>
@foreach (var b in blocked[op].Where(bo => blocked[bo].Any()))
{
@BlockingTree(b, blocked)
}
</ul>
}
</li>
}
@{
var blocked = new Dictionary<SQLInstance.ActiveOperation, List<SQLInstance.ActiveOperation>>();
foreach (var op in data)
{
blocked[op] = data.Where(o => o.BlockingSessionId == op.SessionId).ToList();
}
// Iterate top level blockers
// TODO: Circular blocks
foreach (var op in data.Where(o => !o.BlockingSessionId.HasValue && blocked[o].Any()))
{
@BlockingTree(op, blocked)
}
}
</ul>
</div>
</div>
}
<table class="striped-dashboard" style="table-layout: fixed;">
<thead>
<tr>
@@ -101,7 +139,7 @@
<tbody>
@foreach (var w in data)
{
<tr>
<tr id="spid-@w.SessionId">
<td>
@w.SessionId
</td>
@@ -132,7 +170,7 @@
}
@if (w.BlockingSessionId.HasValue)
{
<div><span class="note">Blcoked By:</span> @w.BlockingSessionId</div>
<div><a href="#spid-@w.BlockingSessionId"><span class="note">Blocked By:</span> @w.BlockingSessionId</a></div>
}
</td>
<td title="@w.WaitInfo
@@ -42,12 +42,17 @@
"MakeMinified": false,
"OutputDirectory": null,
"RunOnBuild": false,
"SyncBase64ImageValues": true
"SyncBase64ImageValues": true,
"Autoprefix": false,
"AutoprefixerBrowsers": null,
"GenerateRtlSourceMaps": true,
"RtlCss": false
},
"General": {
"AllMessagesToOutputWindow": false,
"AllMessagesToOutputWindow": true,
"KeepImportantComments": true,
"SvgPreviewPane": true
"SvgPreviewPane": true,
"ShowWEIgnoreLogs": true
},
"Html": {
"AutoMinify": false,
@@ -76,7 +81,12 @@
"EnableFoundationValidation": true,
"MakeMinified": false,
"OutputDirectory": null,
"RunOnBuild": false
"RunOnBuild": false,
"AttributeQuotesRemovalMode": "KeepQuotes",
"CustomAngularDirectiveList": null,
"MinifyAngularBindingExpressions": false,
"MinifyKnockoutBindingExpressions": false,
"ProcessableScriptTypeList": null
},
"JavaScript": {
"AutoMinify": false,
@@ -88,7 +98,10 @@
"LintResultLocation": "Message",
"MakeMinified": false,
"OutputDirectory": null,
"RunOnBuild": false
"RunOnBuild": false,
"EvalTreatment": "MakeImmediateSafe",
"RootDirectory": "/Scripts/",
"TermSemicolons": true
},
"Less": {
"CompileOnBuild": false,
@@ -149,7 +162,10 @@
"OutputDirectory": null,
"ProcessSourceMapsForEditorEnhancements": true,
"ShowPreviewPane": true,
"StrictMath": false
"StrictMath": false,
"NumberPrecision": 5,
"OutputStyle": "Expanded",
"UseRubyRuntime": false
},
"Sprite": {
"CssOutputDirectory": null,
@@ -159,7 +175,9 @@
"RunOnBuild": false,
"ScssOutputDirectory": null,
"UseAbsoluteUrl": false,
"UseFullPathForIdentifierName": true
"UseFullPathForIdentifierName": true,
"Margin": 1,
"OutputDirectory": null
},
"SweetJs": {
"CompileOnBuild": false,
@@ -170,5 +188,11 @@
"ProcessSourceMapsForEditorEnhancements": true,
"ShowPreviewPane": true,
"StrictMath": false
},
"Handlebars": {
"CompileOnBuild": false,
"CompileOnSave": true,
"MinifyInPlace": false,
"OutputDirectory": null
}
}

0 comments on commit c98f9ff

Please sign in to comment.