Skip to content

Commit

Permalink
Merge pull request #393 from MindscapeHQ/add-dnp-attribute
Browse files Browse the repository at this point in the history
[XRAY-2134] Release APM Raygun4Net changes.
  • Loading branch information
mduncan26 authored Sep 17, 2018
2 parents d7bae86 + a4d607b commit efa04d7
Show file tree
Hide file tree
Showing 27 changed files with 155 additions and 19 deletions.
4 changes: 2 additions & 2 deletions AssemblyVersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.5.5.0")]
[assembly: AssemblyFileVersion("5.5.5.0")]
[assembly: AssemblyVersion("5.6.0.0")]
[assembly: AssemblyFileVersion("5.6.0.0")]
4 changes: 2 additions & 2 deletions Mindscape.Raygun4Net.Azure.WebJob.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net.Azure.WebJob</id>
<version>5.5.5</version>
<version>5.6.0</version>
<title />
<authors>Raygun</authors>
<owners />
Expand All @@ -12,7 +12,7 @@
<projectUrl>https://github.com/MindscapeHQ/raygun4net</projectUrl>
<licenseUrl>https://raw.github.com/MindscapeHQ/raygun4net/master/LICENSE</licenseUrl>
<dependencies>
<dependency id="Mindscape.Raygun4Net.Core" version="5.5.5" />
<dependency id="Mindscape.Raygun4Net.Core" version="5.6.0" />
<dependency id="Microsoft.Azure.WebJobs.Extensions" version="2.0.0" />
</dependencies>
</metadata>
Expand Down
7 changes: 7 additions & 0 deletions Mindscape.Raygun4Net.ClientProfile/RaygunMessageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,12 @@ public IRaygunMessageBuilder SetTimeStamp(DateTime? currentTime)
}
return this;
}

public IRaygunMessageBuilder SetContextId(string contextId)
{
// No-op for ClientProfile provider

return this;
}
}
}
2 changes: 1 addition & 1 deletion Mindscape.Raygun4Net.Core.Signed.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net.Core.Signed</id>
<version>5.5.5</version>
<version>5.6.0</version>
<title />
<authors>Raygun</authors>
<owners />
Expand Down
2 changes: 1 addition & 1 deletion Mindscape.Raygun4Net.Core.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net.Core</id>
<version>5.5.5</version>
<version>5.6.0</version>
<title />
<authors>Raygun</authors>
<owners />
Expand Down
3 changes: 3 additions & 0 deletions Mindscape.Raygun4Net.Core/Mindscape.Raygun4Net.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
<Compile Include="..\AssemblyVersionInfo.cs">
<Link>Properties\AssemblyVersionInfo.cs</Link>
</Compile>
<Compile Include="..\Mindscape.Raygun4Net\Attributes\DoNotProfileAttribute.cs">
<Link>Attributes\DoNotProfileAttribute.cs</Link>
</Compile>
<Compile Include="..\Mindscape.Raygun4Net\Breadcrumbs\Enums.cs">
<Link>Breadcrumbs\Enums.cs</Link>
</Compile>
Expand Down
4 changes: 2 additions & 2 deletions Mindscape.Raygun4Net.Mvc.Signed.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net.Mvc.Signed</id>
<version>5.5.5</version>
<version>5.6.0</version>
<title />
<authors>Raygun</authors>
<owners />
Expand All @@ -12,7 +12,7 @@
<projectUrl>https://github.com/MindscapeHQ/raygun4net</projectUrl>
<licenseUrl>https://raw.github.com/MindscapeHQ/raygun4net/master/LICENSE</licenseUrl>
<dependencies>
<dependency id="Mindscape.Raygun4Net.Core.Signed" version="5.5.5" />
<dependency id="Mindscape.Raygun4Net.Core.Signed" version="5.6.0" />
</dependencies>
</metadata>
<files>
Expand Down
4 changes: 2 additions & 2 deletions Mindscape.Raygun4Net.Mvc.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net.Mvc</id>
<version>5.5.5</version>
<version>5.6.0</version>
<title />
<authors>Raygun</authors>
<owners />
Expand All @@ -12,7 +12,7 @@
<projectUrl>https://github.com/MindscapeHQ/raygun4net</projectUrl>
<licenseUrl>https://raw.github.com/MindscapeHQ/raygun4net/master/LICENSE</licenseUrl>
<dependencies>
<dependency id="Mindscape.Raygun4Net.Core" version="5.5.5" />
<dependency id="Mindscape.Raygun4Net.Core" version="5.6.0" />
</dependencies>
</metadata>
<files>
Expand Down
2 changes: 1 addition & 1 deletion Mindscape.Raygun4Net.Signed.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net.Signed</id>
<version>5.5.5</version>
<version>5.6.0</version>
<title />
<authors>Raygun</authors>
<owners />
Expand Down
4 changes: 2 additions & 2 deletions Mindscape.Raygun4Net.WebApi.Signed.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net.WebApi.Signed</id>
<version>5.5.5</version>
<version>5.6.0</version>
<title />
<authors>Raygun</authors>
<owners />
Expand All @@ -12,7 +12,7 @@
<projectUrl>https://github.com/MindscapeHQ/raygun4net</projectUrl>
<licenseUrl>https://raw.github.com/MindscapeHQ/raygun4net/master/LICENSE</licenseUrl>
<dependencies>
<dependency id="Mindscape.Raygun4Net.Core.Signed" version="5.5.5" />
<dependency id="Mindscape.Raygun4Net.Core.Signed" version="5.6.0" />
</dependencies>
</metadata>
<files>
Expand Down
4 changes: 2 additions & 2 deletions Mindscape.Raygun4Net.WebApi.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net.WebApi</id>
<version>5.5.5</version>
<version>5.6.0</version>
<title />
<authors>Raygun</authors>
<owners />
Expand All @@ -12,7 +12,7 @@
<projectUrl>https://github.com/MindscapeHQ/raygun4net</projectUrl>
<licenseUrl>https://raw.github.com/MindscapeHQ/raygun4net/master/LICENSE</licenseUrl>
<dependencies>
<dependency id="Mindscape.Raygun4Net.Core" version="5.5.5" />
<dependency id="Mindscape.Raygun4Net.Core" version="5.6.0" />
</dependencies>
</metadata>
<files>
Expand Down
1 change: 1 addition & 0 deletions Mindscape.Raygun4Net.WebApi/RaygunWebApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ protected RaygunMessage BuildMessage(Exception exception, IList<string> tags, ID
.SetVersion(ApplicationVersion)
.SetTags(tags)
.SetUserCustomData(userCustomData)
.SetContextId(ContextId)
.SetUser(UserInfo ?? (!String.IsNullOrEmpty(User) ? new RaygunIdentifierMessage(User) : null))
.Build();
var customGroupingKey = OnCustomGroupingKey(exception, message);
Expand Down
25 changes: 25 additions & 0 deletions Mindscape.Raygun4Net.WebApi/RaygunWebApiMessageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public IRaygunMessageBuilder SetExceptionDetails(Exception exception)
if (exception != null)
{
_raygunMessage.Details.Error = RaygunErrorMessageBuilder.Build(exception);

if (_raygunMessage.Details.Error != null)
{
AssignCorrelationId(_raygunMessage.Details);
}
}

var error = exception as RaygunWebApiHttpException;
Expand Down Expand Up @@ -77,6 +82,19 @@ public IRaygunMessageBuilder SetExceptionDetails(Exception exception)
return this;
}

private void AssignCorrelationId(RaygunMessageDetails details)
{
if (details != null && details.Error != null)
{
details.CorrelationId = GenerateCorrelationId(details.Error.ClassName);
}
}

private string GenerateCorrelationId(string className)
{
return Guid.NewGuid().ToString();
}

public IRaygunMessageBuilder SetClientDetails()
{
_raygunMessage.Details.Client = new RaygunClientMessage() { Name = "Raygun4Net.WebApi" };
Expand Down Expand Up @@ -145,5 +163,12 @@ public IRaygunMessageBuilder SetTimeStamp(DateTime? currentTime)
}
return this;
}

public IRaygunMessageBuilder SetContextId(string contextId)
{
_raygunMessage.Details.ContextId = contextId;

return this;
}
}
}
7 changes: 7 additions & 0 deletions Mindscape.Raygun4Net.WinRT/RaygunMessageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,12 @@ public IRaygunMessageBuilder SetTimeStamp(DateTime? currentTime)
}
return this;
}

public IRaygunMessageBuilder SetContextId(string contextId)
{
// No-op for WinRT provider

return this;
}
}
}
7 changes: 7 additions & 0 deletions Mindscape.Raygun4Net.WindowsStore/RaygunMessageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,12 @@ public IRaygunMessageBuilder SetTimeStamp(DateTime? currentTime)
}
return this;
}

public IRaygunMessageBuilder SetContextId(string contextId)
{
// No-op for WindowsStore provider

return this;
}
}
}
2 changes: 1 addition & 1 deletion Mindscape.Raygun4Net.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>Mindscape.Raygun4Net</id>
<version>5.5.5</version>
<version>5.6.0</version>
<title />
<authors>Raygun</authors>
<owners />
Expand Down
9 changes: 9 additions & 0 deletions Mindscape.Raygun4Net/Attributes/DoNotProfileAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace Mindscape.Raygun4Net.Attributes
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class DoNotProfileAttribute : Attribute
{
}
}
2 changes: 2 additions & 0 deletions Mindscape.Raygun4Net/IRaygunMessageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ public interface IRaygunMessageBuilder
IRaygunMessageBuilder SetUser(RaygunIdentifierMessage user);

IRaygunMessageBuilder SetTimeStamp(DateTime? currentTime);

IRaygunMessageBuilder SetContextId(string contextId);
}
}
4 changes: 4 additions & 0 deletions Mindscape.Raygun4Net/Messages/RaygunMessageDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class RaygunMessageDetails

public string Version { get; set; }

public string CorrelationId { get; set; }

public string ContextId { get; set; }

public RaygunErrorMessage Error { get; set; }

public RaygunEnvironmentMessage Environment { get; set; }
Expand Down
1 change: 1 addition & 0 deletions Mindscape.Raygun4Net/Mindscape.Raygun4Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<Compile Include="..\AssemblyVersionInfo.cs">
<Link>Properties\AssemblyVersionInfo.cs</Link>
</Compile>
<Compile Include="Attributes\DoNotProfileAttribute.cs" />
<Compile Include="Breadcrumbs\DefaultBreadcrumbStorage.cs" />
<Compile Include="Breadcrumbs\Enums.cs" />
<Compile Include="Breadcrumbs\HttpBreadcrumbStorage.cs" />
Expand Down
2 changes: 1 addition & 1 deletion Mindscape.Raygun4Net/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("72856682-3b04-495f-8e1f-bdd4b698b20e")]

[assembly: InternalsVisibleTo("Mindscape.Raygun4Net.Tests")]
[assembly: InternalsVisibleTo("Mindscape.Raygun4Net.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c9ca3e9ab66536ef6801fae072b191c8c257a3f6ef7dbb7678c675791f1df028f36a5ea91dd292aacdfa35280ef2571217099e7e101e0eff7f8eb46aa815bd624d7c63c6294f5eb1d57446d345d3dd2a7a08a1b5d52ad76a56aa913d7af13cb0bc4d6b2e6f1ca01fb31ec8e020897c228dce3fc6106e0e884463d62433e6e9c5")]
1 change: 1 addition & 0 deletions Mindscape.Raygun4Net/RaygunClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ protected RaygunMessage BuildMessage(Exception exception, IList<string> tags, ID
.SetVersion(ApplicationVersion)
.SetTags(tags)
.SetUserCustomData(userCustomData)
.SetContextId(ContextId)
.SetUser(userInfoMessage ?? UserInfo ?? (!String.IsNullOrEmpty(User) ? new RaygunIdentifierMessage(User) : null))
.Build();

Expand Down
7 changes: 6 additions & 1 deletion Mindscape.Raygun4Net/RaygunClientBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ public abstract class RaygunClientBase
public virtual RaygunIdentifierMessage UserInfo { get; set; }

/// <summary>
/// Gets or sets a custom application version identifier for all error messages sent to the Raygun.io endpoint.
/// Gets or sets the context identifier defining a scope under which errors are related
/// </summary>
public string ContextId { get; set; }

/// <summary>
/// Gets or sets a custom application version identifier for all error messages sent to the Raygun endpoint.
/// </summary>
public string ApplicationVersion { get; set; }

Expand Down
15 changes: 14 additions & 1 deletion Mindscape.Raygun4Net/RaygunHttpModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class RaygunHttpModule : IHttpModule
public void Init(HttpApplication context)
{
context.Error += SendError;

HttpStatusCodesToExclude = RaygunSettings.Settings.ExcludedStatusCodes;
ExcludeErrorsBasedOnHttpStatusCode = HttpStatusCodesToExclude.Any();
ExcludeErrorsFromLocal = RaygunSettings.Settings.ExcludeErrorsFromLocal;
Expand Down Expand Up @@ -56,7 +57,19 @@ public void SendError(HttpApplication application, Exception exception)
protected RaygunClient GetRaygunClient(HttpApplication application)
{
var raygunApplication = application as IRaygunApplication;
return raygunApplication != null ? raygunApplication.GenerateRaygunClient() : new RaygunClient();
return raygunApplication != null ? raygunApplication.GenerateRaygunClient() : GenerateDefaultRaygunClient(application);
}

private RaygunClient GenerateDefaultRaygunClient(HttpApplication application)
{
var instance = new RaygunClient();

if (HttpContext.Current != null && HttpContext.Current.Session != null)
{
instance.ContextId = HttpContext.Current.Session.SessionID;
}

return instance;
}

protected bool CanSend(Exception exception)
Expand Down
25 changes: 25 additions & 0 deletions Mindscape.Raygun4Net/RaygunMessageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public IRaygunMessageBuilder SetExceptionDetails(Exception exception)
if (exception != null)
{
_raygunMessage.Details.Error = RaygunErrorMessageBuilder.Build(exception);

if (_raygunMessage.Details.Error != null)
{
AssignCorrelationId(_raygunMessage.Details);
}
}

HttpException error = exception as HttpException;
Expand Down Expand Up @@ -93,6 +98,19 @@ public IRaygunMessageBuilder SetExceptionDetails(Exception exception)
return this;
}

private void AssignCorrelationId(RaygunMessageDetails details)
{
if (details != null && details.Error != null)
{
details.CorrelationId = GenerateCorrelationId(details.Error.ClassName);
}
}

private string GenerateCorrelationId(string className)
{
return Guid.NewGuid().ToString();
}

public IRaygunMessageBuilder SetClientDetails()
{
_raygunMessage.Details.Client = new RaygunClientMessage()
Expand Down Expand Up @@ -209,5 +227,12 @@ public IRaygunMessageBuilder SetBreadcrumbs(List<RaygunBreadcrumb> breadcrumbs)

return this;
}

public IRaygunMessageBuilder SetContextId(string contextId)
{
_raygunMessage.Details.ContextId = contextId;

return this;
}
}
}
Loading

0 comments on commit efa04d7

Please sign in to comment.