Use DiagnosticListener instance (instead of the name) to distinguish and dedup subscription (#1973)
* Use DiagnosticListener instance (instead of the name) to distinguish and dedup subscription * changelog
This commit is contained in:
Родитель
743848ab2b
Коммит
d927917e05
|
@ -5,6 +5,7 @@
|
|||
- [Create single request telemetry when URL-rewrite rewrites a request](https://github.com/microsoft/ApplicationInsights-dotnet/issues/1744)
|
||||
- [Remove legacy TelemetryConfiguration.Active from AspNetCore SDK](https://github.com/microsoft/ApplicationInsights-dotnet/issues/1953)
|
||||
- [Refactor AspNetCore and WorkerService use of Heartbeat (DiagnosticTelemetryModule)](https://github.com/microsoft/ApplicationInsights-dotnet/issues/1954)
|
||||
- [Fix broken correlation and missing in-proc dependency Azure Blob SDK v12](https://github.com/microsoft/ApplicationInsights-dotnet/issues/1915)
|
||||
|
||||
## Version 2.15.0-beta2
|
||||
- [Read all properties of ApplicationInsightsServiceOptions from IConfiguration](https://github.com/microsoft/ApplicationInsights-dotnet/issues/1882)
|
||||
|
|
|
@ -99,6 +99,36 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void AzureClientSpansAreCollectedMultipleDiagnosticSourcesSameName()
|
||||
{
|
||||
using (var listener1 = new DiagnosticListener("Azure.SomeClient"))
|
||||
using (var listener2 = new DiagnosticListener("Azure.SomeClient"))
|
||||
using (var module = new DependencyTrackingTelemetryModule())
|
||||
{
|
||||
module.Initialize(this.configuration);
|
||||
|
||||
var telemetry1 = this.TrackOperation<DependencyTelemetry>(
|
||||
listener1,
|
||||
"Azure.SomeClient.Send",
|
||||
null,
|
||||
() => { });
|
||||
|
||||
Assert.IsNotNull(telemetry1);
|
||||
Assert.AreEqual("SomeClient.Send", telemetry1.Name);
|
||||
|
||||
var telemetry2 = this.TrackOperation<DependencyTelemetry>(
|
||||
listener2,
|
||||
"Azure.SomeClient.Send",
|
||||
null,
|
||||
() => { });
|
||||
|
||||
Assert.IsNotNull(telemetry2);
|
||||
Assert.AreEqual("SomeClient.Send", telemetry2.Name);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AzureClientSpansAreCollectedClientKind()
|
||||
{
|
||||
|
|
|
@ -15,8 +15,8 @@ namespace Microsoft.ApplicationInsights.DependencyCollector.Implementation
|
|||
/// <typeparamref name="TContext">The type of processing context for given diagnostic source.</typeparamref>
|
||||
internal abstract class DiagnosticSourceListenerBase<TContext> : IObserver<DiagnosticListener>, IDisposable
|
||||
{
|
||||
protected static readonly ConcurrentDictionary<string, ActiveSubsciptionManager> SubscriptionManagers =
|
||||
new ConcurrentDictionary<string, ActiveSubsciptionManager>();
|
||||
protected static readonly ConcurrentDictionary<DiagnosticListener, ActiveSubsciptionManager> SubscriptionManagers =
|
||||
new ConcurrentDictionary<DiagnosticListener, ActiveSubsciptionManager>();
|
||||
|
||||
protected readonly TelemetryClient Client;
|
||||
protected readonly TelemetryConfiguration Configuration;
|
||||
|
@ -77,7 +77,7 @@ namespace Microsoft.ApplicationInsights.DependencyCollector.Implementation
|
|||
}
|
||||
|
||||
var eventHandler = this.GetEventHandler(value.Name);
|
||||
var manager = SubscriptionManagers.GetOrAdd(value.Name, k => new ActiveSubsciptionManager());
|
||||
var manager = SubscriptionManagers.GetOrAdd(value, k => new ActiveSubsciptionManager());
|
||||
|
||||
var individualListener = new IndividualDiagnosticSourceListener(
|
||||
value,
|
||||
|
|
Загрузка…
Ссылка в новой задаче