Skip to content

Commit

Permalink
v2.0.5
Browse files Browse the repository at this point in the history
Version 2.0.5 - 03.12.2018
Removed unused usings,
BacktraceDatabase conditions with maximum number of records/maximum disk space fix,
Removed invalid tests from Backtrace.Tests solution.
  • Loading branch information
konraddysput authored Dec 3, 2018
1 parent 0d32fac commit 07a4acd
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 87 deletions.
65 changes: 1 addition & 64 deletions Backtrace.Tests/IntegrationTests/ClientReportLimitTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Backtrace.Base;
using Backtrace.Interfaces;
using Backtrace.Interfaces;
using Backtrace.Model;
using Backtrace.Model.Database;
using Backtrace.Services;
Expand Down Expand Up @@ -147,67 +146,5 @@ public void SingleThreadWithoutReportRateLimit(int numberOfTasks)
Assert.AreEqual(expectedNumberOfReports, totalSend);
Assert.IsFalse(clientReportLimitReached);
}

/// <summary>
/// Test a initialization and submission sequence for backtrace client w/ threading w/o rate limiting
/// </summary>
[TestCase(1, 2)]
[TestCase(5, 2)]
[TestCase(10, 2)]
[TestCase(1, 5)]
[TestCase(5, 10)]
[TestCase(5, 20)]
[Test(Author = "Arthur Tu and Konrad Dysput", Description = "Test a initialization and submission sequence for backtrace client w/ threading w/o rate limiting")]
public void ThreadedWithReportRateLimit(int numberOfTasks, int clientRateLimit)
{
//set rate limiting
clientReportLimitReached = false;
_backtraceClient.SetClientReportLimit((uint)clientRateLimit);

//set expected number of drop and request
int expectedNumberOfAttempts = 4 * numberOfTasks;
int expectedNumberOfDropRequest = expectedNumberOfAttempts - (int)clientRateLimit;

if (expectedNumberOfDropRequest < 0)
{
expectedNumberOfDropRequest = 0;
}

var tasks = new Task[numberOfTasks];
int totalAttemps = 0;
int totalDrop = 0;
int totalNumberOfDropsOnEvents = 0;

//set backtrace events
_backtraceClient.OnClientReportLimitReached = (BacktraceReport report) =>
{
totalDrop++;
clientReportLimitReached = true;
};
_backtraceClient.AfterSend = (BacktraceResult res) =>
{
if (res.Status == BacktraceResultStatus.LimitReached)
{
totalNumberOfDropsOnEvents++;
}
totalAttemps++;
};

//initialize startup tasks
for (int taskIndex = 0; taskIndex < numberOfTasks; taskIndex++)
{
tasks[taskIndex] = ThreadTest(taskIndex);
}
Task.WaitAll(tasks);

//check if BacktraceResult is correct on events
Assert.AreEqual(totalDrop, totalNumberOfDropsOnEvents);
//check correct number of attempts
Assert.AreEqual(totalAttemps, expectedNumberOfAttempts);
//check if expected number of drops are equal to total dropped packages from rate limit client
Assert.AreEqual(totalDrop, expectedNumberOfDropRequest);
//check if limit reached or if any report was dropped
Assert.IsTrue(clientReportLimitReached || totalDrop == 0);
}
}
}
8 changes: 4 additions & 4 deletions Backtrace/Backtrace.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
<TargetFrameworks>netstandard2.0;net45;net35</TargetFrameworks>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageTags>Backtrace Error Diagnostic Tools Debug Bug Bugs StackTrace</PackageTags>
<PackageVersion>2.0.4</PackageVersion>
<PackageVersion>2.0.5</PackageVersion>
<Product>Backtrace</Product>
<PackageLicenseUrl>https://github.com/backtrace-labs/backtrace-csharp/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/backtrace-labs/backtrace-csharp</PackageProjectUrl>
<PackageIconUrl>http://backtrace.io/images/icon.png</PackageIconUrl>
<Description>Backtrace's integration with C# applications allows customers to capture and report handled and unhandled C# exceptions to their Backtrace instance, instantly offering the ability to prioritize and debug software errors.</Description>
<RepositoryUrl>https://github.com/backtrace-labs/backtrace-csharp</RepositoryUrl>
<NeutralLanguage>en</NeutralLanguage>
<Version>2.0.4</Version>
<Version>2.0.5</Version>
<Copyright>Backtrace I/O</Copyright>
<Authors>Backtrace I/O</Authors>
<Company>Backtrace I/O</Company>
<AssemblyVersion>2.0.4.0</AssemblyVersion>
<FileVersion>2.0.4.0</FileVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<FileVersion>2.0.5.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
8 changes: 6 additions & 2 deletions Backtrace/BacktraceDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,15 +417,19 @@ private bool ValidateDatabaseSize()

//check database size. If database size == 0 then we ignore this condition
//remove all records till database use enough space
if (DatabaseSettings.MaxDatabaseSize != 0)
if (DatabaseSettings.MaxDatabaseSize != 0 && BacktraceDatabaseContext.GetSize() > DatabaseSettings.MaxDatabaseSize)
{
//if your database is entry or every record is locked
//deletePolicyRetry avoid infinity loop
int deletePolicyRetry = 5;
while (BacktraceDatabaseContext.GetSize() > DatabaseSettings.MaxDatabaseSize || deletePolicyRetry != 0)
while (BacktraceDatabaseContext.GetSize() > DatabaseSettings.MaxDatabaseSize)
{
BacktraceDatabaseContext.RemoveLastRecord();
deletePolicyRetry--;
if(deletePolicyRetry != 0)
{
break;
}
}
return deletePolicyRetry != 0;
}
Expand Down
3 changes: 1 addition & 2 deletions Backtrace/Interfaces/IBacktraceAPI.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Backtrace.Base;
using Backtrace.Model;
using Backtrace.Model;
using System;

namespace Backtrace.Interfaces
Expand Down
7 changes: 3 additions & 4 deletions Backtrace/Model/BacktraceData.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using Newtonsoft.Json;
using Backtrace.Model.JsonData;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using Backtrace.Model.JsonData;
using System.Linq;
using System.Reflection;
using static Backtrace.Model.JsonData.SourceCodeData;
using Backtrace.Base;

namespace Backtrace.Model
{
Expand Down Expand Up @@ -43,7 +42,7 @@ public class BacktraceData
/// Name of the client that is sending this error report.
/// </summary>
[JsonProperty(PropertyName = "agent")]
public const string Agent = "backtrace-csharp";
public const string Agent = "backtrace-csharp";

/// <summary>
/// Version of the C# library
Expand Down
2 changes: 2 additions & 0 deletions Backtrace/Model/BacktraceReport.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Backtrace.Extensions;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
#if !NET35
using System.Runtime.ExceptionServices;
Expand Down
5 changes: 2 additions & 3 deletions Backtrace/Model/Database/BacktraceDatabaseRecord.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Backtrace.Base;
using Backtrace.Interfaces.Database;
using Backtrace.Interfaces.Database;
using Newtonsoft.Json;
using System;
using System.Diagnostics;
Expand Down Expand Up @@ -153,7 +152,7 @@ public bool Save()
{
DiagnosticDataPath = Save(Record, $"{Id}-attachment");
ReportPath = Save(Record.Report, $"{Id}-report");

// get minidump information
MiniDumpPath = Record.Report?.MinidumpFile ?? string.Empty;
Size += MiniDumpPath == string.Empty ? 0 : new FileInfo(MiniDumpPath).Length;
Expand Down
2 changes: 0 additions & 2 deletions Backtrace/Model/JsonData/Annotations.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

namespace Backtrace.Model.JsonData
{
Expand Down
3 changes: 0 additions & 3 deletions Backtrace/Model/JsonData/SourceCodeData.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace Backtrace.Model.JsonData
{
Expand Down
1 change: 0 additions & 1 deletion Backtrace/Services/BacktraceApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Backtrace.Common;
using System.Collections.Generic;
using Backtrace.Extensions;
using Backtrace.Base;
#if !NET35
using System.Threading.Tasks;
using System.Net.Http;
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Backtrace C# Release Notes

## Version 2.0.5 - 03.12.2018
- Removed unused usings,
- `BacktraceDatabase` conditions with maximum number of records/maximum disk space fix,
- Removed invalid tests from `Backtrace.Tests` solution.

## Version 2.0.4 - 23.09.2018
- `BacktraceClient` allows developer to unpack `AggregateException` and send only exceptions available in `InnerExceptions` property.
- `BacktraceReport` accepts two new properties: `Factor` and `Fingerprint`. These properties allows you to change server side algorithms.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Backtrace
[![Backtrace@release](https://img.shields.io/badge/Backtrace%40master-2.0.4-blue.svg)](https://www.nuget.org/packages/Backtrace)
[![Backtrace@release](https://img.shields.io/badge/Backtrace%40master-2.0.5-blue.svg)](https://www.nuget.org/packages/Backtrace)
[![Build status](https://ci.appveyor.com/api/projects/status/o0n9sp0ydgxb3ktu?svg=true)](https://ci.appveyor.com/project/konraddysput/backtrace-csharp)

[![Backtrace@pre-release](https://img.shields.io/badge/Backtrace%40dev-2.0.5-blue.svg)](https://www.nuget.org/packages/Backtrace)
[![Backtrace@pre-release](https://img.shields.io/badge/Backtrace%40dev-2.0.6-blue.svg)](https://www.nuget.org/packages/Backtrace)
[![Build status](https://ci.appveyor.com/api/projects/status/o0n9sp0ydgxb3ktu/branch/dev?svg=true)](https://ci.appveyor.com/project/konraddysput/backtrace-csharp/branch/dev)


Expand Down

0 comments on commit 07a4acd

Please sign in to comment.