This repository has been archived by the owner on Jul 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Track dependency instrumented with HttpDesktop DiagnosticSource in
DiagnosticSource Response event (#509)
- Loading branch information
Liudmila Molkova
committed
Apr 28, 2017
1 parent
df9c452
commit 0d54117
Showing
14 changed files
with
469 additions
and
358 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
306 changes: 306 additions & 0 deletions
306
...ndencyCollector/Shared.Tests/Implementation/DesktopDiagnosticSourceHttpProcessingTests.cs
Large diffs are not rendered by default.
Oops, something went wrong.
280 changes: 25 additions & 255 deletions
280
Src/DependencyCollector/Shared.Tests/Implementation/FrameworkHttpProcessingTest.cs
Large diffs are not rendered by default.
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
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
81 changes: 81 additions & 0 deletions
81
Src/DependencyCollector/Shared/Implementation/DesktopDiagnosticSourceHttpProcessing.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,81 @@ | ||
#if NET45 | ||
namespace Microsoft.ApplicationInsights.DependencyCollector.Implementation | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Net; | ||
using Microsoft.ApplicationInsights.DataContracts; | ||
using Microsoft.ApplicationInsights.DependencyCollector.Implementation.Operation; | ||
using Microsoft.ApplicationInsights.Extensibility; | ||
using Microsoft.ApplicationInsights.Web.Implementation; | ||
|
||
/// <summary> | ||
/// Concrete class with all processing logic to generate RDD data from the callbacks received from HttpDesktopDiagnosticSourceListener. | ||
/// </summary> | ||
internal sealed class DesktopDiagnosticSourceHttpProcessing : HttpProcessing | ||
{ | ||
internal ObjectInstanceBasedOperationHolder TelemetryTable; | ||
|
||
internal DesktopDiagnosticSourceHttpProcessing(TelemetryConfiguration configuration, ObjectInstanceBasedOperationHolder telemetryTupleHolder, bool setCorrelationHeaders, ICollection<string> correlationDomainExclusionList, string appIdEndpoint) | ||
: base(configuration, SdkVersionUtils.GetSdkVersion("rdd" + RddSource.FrameworkAndDiagnostic + ":"), null, setCorrelationHeaders, correlationDomainExclusionList, appIdEndpoint) | ||
{ | ||
if (telemetryTupleHolder == null) | ||
{ | ||
throw new ArgumentNullException("telemetryTupleHolder"); | ||
} | ||
|
||
this.TelemetryTable = telemetryTupleHolder; | ||
} | ||
|
||
/// <summary> | ||
/// On request send callback from Http diagnostic source. | ||
/// </summary> | ||
/// <param name="request">The WebRequest object.</param> | ||
public void OnRequestSend(WebRequest request) | ||
{ | ||
this.OnBegin(request, true); | ||
} | ||
|
||
/// <summary> | ||
/// On request send callback from Http diagnostic source. | ||
/// </summary> | ||
/// <param name="request">The WebRequest object.</param> | ||
/// <param name="response">The WebResponse object.</param> | ||
public void OnResponseReceive(WebRequest request, HttpWebResponse response) | ||
{ | ||
this.OnEnd(null, request, response); | ||
} | ||
|
||
/// <summary> | ||
/// Implemented by the derived class for adding the tuple to its specific cache. | ||
/// </summary> | ||
/// <param name="webRequest">The request which acts the key.</param> | ||
/// <param name="telemetry">The dependency telemetry for the tuple.</param> | ||
/// <param name="isCustomCreated">Boolean value that tells if the current telemetry item is being added by the customer or not.</param> | ||
protected override void AddTupleForWebDependencies(WebRequest webRequest, DependencyTelemetry telemetry, bool isCustomCreated) | ||
{ | ||
var telemetryTuple = new Tuple<DependencyTelemetry, bool>(telemetry, isCustomCreated); | ||
this.TelemetryTable.Store(webRequest, telemetryTuple); | ||
} | ||
|
||
/// <summary> | ||
/// Implemented by the derived class for getting the tuple from its specific cache. | ||
/// </summary> | ||
/// <param name="webRequest">The request which acts as the key.</param> | ||
/// <returns>The tuple for the given request.</returns> | ||
protected override Tuple<DependencyTelemetry, bool> GetTupleForWebDependencies(WebRequest webRequest) | ||
{ | ||
return this.TelemetryTable.Get(webRequest); | ||
} | ||
|
||
/// <summary> | ||
/// Implemented by the derived class for removing the tuple from its specific cache. | ||
/// </summary> | ||
/// <param name="webRequest">The request which acts as the key.</param> | ||
protected override void RemoveTupleForWebDependencies(WebRequest webRequest) | ||
{ | ||
this.TelemetryTable.Remove(webRequest); | ||
} | ||
} | ||
} | ||
#endif |
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
Oops, something went wrong.