-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Event Counter metric support for ingestion response time (#1796)
* Added EventCounter to track breeze response time. * Removed unused reference. * Update to Changelog.md * Resolving merge conflict * Added EventCounter as non event menthod. * Fixed test - removed event counter check * Added test case for Event Counter * Adding sleep to trace listener. * Resolving merge conflict * Fixed EventCounter test * Fuxed file name * Added ingestion failure test case. * Fixed test case Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
- Loading branch information
1 parent
26d9b0d
commit 53ea6f5
Showing
5 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...licationInsights.Test/Microsoft.ApplicationInsights.Tests/Channel/EventCounterListener.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,36 @@ | ||
namespace Microsoft.ApplicationInsights.Channel | ||
{ | ||
using System; | ||
using System.Collections.Concurrent; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.Tracing; | ||
|
||
internal class EventCounterListener : EventListener | ||
{ | ||
private const long AllKeywords = -1; | ||
public ConcurrentQueue<EventWrittenEventArgs> EventsReceived { get; private set; } | ||
|
||
public EventCounterListener() | ||
{ | ||
this.EventsReceived = new ConcurrentQueue<EventWrittenEventArgs>(); | ||
} | ||
|
||
protected override void OnEventWritten(EventWrittenEventArgs eventData) | ||
{ | ||
this.EventsReceived.Enqueue(eventData); | ||
} | ||
|
||
protected override void OnEventSourceCreated(EventSource eventSource) | ||
{ | ||
if (string.Equals(eventSource.Name, "Microsoft-ApplicationInsights-Core", StringComparison.Ordinal)) | ||
{ | ||
var eventCounterArguments = new Dictionary<string, string> | ||
{ | ||
{"EventCounterIntervalSec", "1"} | ||
}; | ||
EnableEvents(eventSource, EventLevel.LogAlways, (EventKeywords)AllKeywords, eventCounterArguments); | ||
} | ||
} | ||
|
||
} | ||
} |
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
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