-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1) Add "TryAddCustomData" method into "PerformanceMeter" class;
2 Add "AddMethodArgumentsToCustomDataAttribute" attribute for adding arguments to measurement custom data with "DiagnosticSource"
- Loading branch information
Showing
12 changed files
with
258 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...uentPerformanceMeter.AspNetCore.Mvc/Attributes/AddMethodArgumentsToCustomDataAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
using System; | ||
|
||
namespace Unchase.FluentPerformanceMeter.AspNetCore.Mvc.Attributes | ||
{ | ||
/// <summary> | ||
/// Attribute to adding action arguments to the measurement custom data with <see cref="WatchingWithDiagnosticSourceAttribute"/>. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] | ||
public class AddMethodArgumentsToCustomDataAttribute : ActionFilterAttribute | ||
{ | ||
#region Fileds | ||
|
||
private string _argumentsKey; | ||
|
||
#endregion | ||
|
||
#region Constructors | ||
|
||
/// <summary> | ||
/// Constructor for <see cref="AddMethodArgumentsToCustomDataAttribute"/>. | ||
/// </summary> | ||
/// <param name="argumentsKey">Key for arguments in custom data storage.</param> | ||
public AddMethodArgumentsToCustomDataAttribute(string argumentsKey = "arguments") | ||
{ | ||
this._argumentsKey = argumentsKey; | ||
} | ||
|
||
#endregion | ||
|
||
#region Methods | ||
|
||
/// <summary> | ||
/// Call before the action executes, after model binding is complete. | ||
/// </summary> | ||
/// <param name="context"><see cref="ActionExecutingContext"/>.</param> | ||
public override void OnActionExecuting(ActionExecutingContext context) | ||
{ | ||
if (context.HttpContext.Items.TryGetValue("PerformanceMeter", out object performanceMeter)) | ||
{ | ||
var tryAddCustomDataMethod = performanceMeter.GetType().GetMethod("TryAddCustomData"); | ||
tryAddCustomDataMethod.Invoke(performanceMeter, new object[] { this._argumentsKey, context.ActionArguments }); | ||
} | ||
|
||
base.OnActionExecuting(context); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...e.FluentPerformanceMeter.AspNetCore.Mvc/Unchase.FluentPerformanceMeter.AspNetCore.Mvc.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
Unchase.FluentPerformanceMeter.TestWebAPI/Unchase.FluentPerformanceMeter.TestWebAPI.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
Unchase.FluentPerformanceMeter/Unchase.FluentPerformanceMeter.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version: 1.1.{build} | ||
version: 1.2.{build} | ||
pull_requests: | ||
do_not_increment_build_number: true | ||
skip_tags: true | ||
|