Skip to content

Commit fb9d5f9

Browse files
author
codeRR
committed
Corrected so that the StackTrace is included when new incidents are saved.
Reporting errors to our own instance of codeRR is now mandatory.
1 parent 7c7ddcf commit fb9d5f9

File tree

16 files changed

+80
-77
lines changed

16 files changed

+80
-77
lines changed

src/Server/Coderr.Server.ReportAnalyzer/Inbound/SaveReportHandler.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,13 @@ public class SaveReportHandler
3030
/// <summary>
3131
/// Creates a new instance of <see cref="SaveReportHandler" />.
3232
/// </summary>
33-
/// <param name="queueProvider">provider</param>
33+
/// <param name="queue">Queue used to enqueue new error reports</param>
3434
/// <param name="connectionFactory">Tries to find connection named "Queue" and uses default if not found.</param>
3535
/// <exception cref="ArgumentNullException">queueProvider;connectionFactory</exception>
36-
public SaveReportHandler(IMessageQueueProvider queueProvider, IConnectionFactory connectionFactory)
36+
public SaveReportHandler(IMessageQueue queue, IConnectionFactory connectionFactory)
3737
{
38-
if (queueProvider == null) throw new ArgumentNullException(nameof(queueProvider));
38+
_queue = queue ?? throw new ArgumentNullException(nameof(queue));
3939
_connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory));
40-
_queue = queueProvider.Open("ReportQueue");
4140
}
4241

4342
public void AddFilter(Func<NewReportDTO, bool> filter)
@@ -71,7 +70,7 @@ public async Task BuildReportAsync(string appKey, string signatureProvidedByTheC
7170

7271
var report = DeserializeBody(reportBody);
7372

74-
//fix malconfigured clients
73+
// correct incorrect clients
7574
if (report.CreatedAtUtc > DateTime.UtcNow)
7675
report.CreatedAtUtc = DateTime.UtcNow;
7776

src/Server/Coderr.Server.ReportAnalyzer/Services/ReportAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ public void Analyze(ErrorReportEntity report)
7575
}
7676
else
7777
{
78-
if (incident.ReportCount > 10000)
78+
if (incident.ReportCount > 1000)
7979
{
80-
_logger.Debug("Reportcount is more than 10000. Ignoring report for incident " + incident.Id);
80+
_logger.Debug("Report count is more than 10000. Ignoring report for incident " + incident.Id);
8181
return;
8282
}
8383

src/Server/Coderr.Server.SqlServer/Analysis/AnalyticsRepository.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ FROM Incidents
7171

7272
public void CreateIncident(IncidentBeingAnalyzed incident)
7373
{
74+
if (incident == null) throw new ArgumentNullException("incident");
7475
if (string.IsNullOrEmpty(incident.ReportHashCode))
7576
throw new InvalidOperationException("ReportHashCode is required to be able to detect duplicates");
7677

77-
if (incident == null) throw new ArgumentNullException("incident");
7878
using (var cmd = _unitOfWork.CreateCommand())
7979
{
8080
cmd.CommandText =
@@ -88,6 +88,7 @@ public void CreateIncident(IncidentBeingAnalyzed incident)
8888
cmd.AddParameter("ReportCount", incident.ReportCount);
8989
cmd.AddParameter("UpdatedAtUtc", incident.UpdatedAtUtc);
9090
cmd.AddParameter("Description", incident.Description);
91+
cmd.AddParameter("StackTrace", incident.StackTrace);
9192
cmd.AddParameter("FullName", incident.FullName);
9293
var id = (int) (decimal) cmd.ExecuteScalar();
9394
incident.GetType()

src/Server/Coderr.Server.SqlServer/Analysis/Incident2Mapper.cs renamed to src/Server/Coderr.Server.SqlServer/Analysis/IncidentBeingAnalyzedMapper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace codeRR.Server.SqlServer.Analysis
66
{
7-
public class Incident2Mapper : CrudEntityMapper<IncidentBeingAnalyzed>
7+
public class IncidentBeingAnalyzedMapper : CrudEntityMapper<IncidentBeingAnalyzed>
88
{
9-
public Incident2Mapper()
9+
public IncidentBeingAnalyzedMapper()
1010
: base("Incidents")
1111
{
1212
Property(x => x.UpdatedAtUtc)

src/Server/Coderr.Server.Web/App_Start/RouteConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static void RegisterInstallationRoutes(RouteCollection routes)
1010
routes.MapRoute(
1111
"Default",
1212
"{controller}/{action}/{id}",
13-
new {controller = "Home", action = "ToInstall", id = UrlParameter.Optional},
13+
new {controller = "Boot", action = "ToInstall", id = UrlParameter.Optional},
1414
new[] {"codeRR.Server.Web.Controllers"}
1515
);
1616
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.Mvc;
6+
7+
namespace codeRR.Server.Web.Areas.Installation.Controllers
8+
{
9+
/// <summary>
10+
/// Purpose is to be able to launch installation area and be able to use dependencies in the home controller
11+
/// </summary>
12+
public class BootController : Controller
13+
{
14+
public ActionResult Index()
15+
{
16+
return RedirectToAction("Index", "Home");
17+
}
18+
19+
[AllowAnonymous, Route("installation/{*url}")]
20+
public ActionResult NoInstallation()
21+
{
22+
if (Request.Url.AbsolutePath.EndsWith("/setup/activate", StringComparison.OrdinalIgnoreCase))
23+
return Redirect("~/?#/welcome");
24+
return View();
25+
}
26+
27+
[AllowAnonymous]
28+
public ActionResult ToInstall()
29+
{
30+
return RedirectToRoute(new { Controller = "Setup", Area = "Installation" });
31+
}
32+
33+
34+
}
35+
}

src/Server/Coderr.Server.Web/Areas/Installation/Controllers/SetupController.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ public ActionResult Errors()
8181
var config = ConfigurationStore.Instance.Load<codeRRConfigSection>();
8282
if (config != null)
8383
{
84-
model.ActivateTracking = config.ActivateTracking;
8584
model.ContactEmail = config.ContactEmail;
86-
model.InstallationId = config.InstallationId;
8785
}
8886
else
8987
{
@@ -101,9 +99,9 @@ public ActionResult Errors(ErrorTrackingViewModel model)
10199

102100
var settings = new codeRRConfigSection
103101
{
104-
ActivateTracking = model.ActivateTracking,
102+
ActivateTracking = true,
105103
ContactEmail = model.ContactEmail,
106-
InstallationId = model.InstallationId
104+
InstallationId = Guid.NewGuid().ToString("N")
107105
};
108106
ConfigurationStore.Instance.Store(settings);
109107
return Redirect(Url.GetNextWizardStep());

src/Server/Coderr.Server.Web/Areas/Installation/Models/ErrorTrackingViewModel.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,8 @@ namespace codeRR.Server.Web.Areas.Installation.Models
44
{
55
public class ErrorTrackingViewModel
66
{
7-
[Display(Name = "Activate tracking")]
8-
public bool ActivateTracking { get; set; }
9-
107
[Display(Name = "Contact email"), EmailAddress]
118
public string ContactEmail { get; set; }
129

13-
/// <summary>
14-
/// A fixed identity which identifies this specific installation. You can generate a GUID and then store it.
15-
/// </summary>
16-
/// <remarks>
17-
/// <para>
18-
/// Used to identify the number of installations that have the same issue.
19-
/// </para>
20-
/// </remarks>
21-
public string InstallationId { get; set; }
2210
}
2311
}

src/Server/Coderr.Server.Web/Areas/Installation/Views/Setup/ErrorTracking.cshtml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,22 @@
77

88
<h2>Error tracking</h2>
99
<p>
10-
To correct bugs much faster we would like to activate codeRR for your installation. All exceptions
11-
will be uploaded to our own installation for further analysis.
10+
To correct bugs faster we have activated codeRR in the community server. By completing this
11+
setup, you allow us to collect error information and sent it to our own hosted service.
12+
</p>
13+
<p>
14+
You can optionally enter your email address to get notifications when the errors in your
15+
installation have been corrected and released.
16+
</p>
17+
<p>
18+
<em>(We might also contact you if we need more information
19+
about the error)</em>
1220
</p>
1321
<form method="post" action="@Url.Action("Errors")" style="width: 100%" class="form">
1422
@Html.ValidationSummary(false)
15-
<div class="form-group">
16-
@Html.CheckBoxFor(x => x.ActivateTracking, new {@class = "form-control", style = "display:inline;height:auto;width:inherit;"})
17-
@Html.LabelFor(x => x.ActivateTracking, new {@class = "control-label"})
18-
<br/>
19-
<small>Allow us to track errors.</small>
20-
</div>
2123
<div class="form-group disabled suboption">
2224
@Html.LabelFor(x => x.ContactEmail, new {@class = "control-label"})
23-
@Html.TextBoxFor(x => x.ContactEmail, new {@class = "form-control", disabled = ""})
24-
<small>Email address that we may contact if we need any further information (will also receive notifications when your errors have been corrected).</small>
25-
</div>
26-
<div class="form-group disabled suboption">
27-
@Html.LabelFor(x => x.InstallationId, new {@class = "control-label"})
28-
@Html.TextBoxFor(x => x.InstallationId, new {@class = "form-control", disabled = ""})
29-
<small>A fixed identity which identifies this specific installation. You can generate a GUID and then store it. Used to identify the number of installations that have the same issue.</small>
30-
<br/>
31-
<small>A guid generated for your convencience if you want to enable this feature: @Guid.NewGuid().ToString("N")</small>
25+
@Html.TextBoxFor(x => x.ContactEmail, new {@class = "form-control", placeholder = "Your email address"})
3226
</div>
3327
<br/>
3428
@Html.Raw(ViewBag.PrevLink)

src/Server/Coderr.Server.Web/Areas/Receiver/Controllers/FeedbackController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class FeedbackController : ApiController
2020
{
2121
private readonly ILog _logger = LogManager.GetLogger(typeof(FeedbackController));
2222
private readonly IMessageQueue _queue;
23-
private IConnectionFactory _connectionFactory;
23+
private readonly IConnectionFactory _connectionFactory;
2424

2525
public FeedbackController(IMessageQueueProvider queueProvider, IConnectionFactory connectionFactory)
2626
{

0 commit comments

Comments
 (0)