public void EventSourceInstrumentationEnabledWhenProfilerInstrumentationDisabled() { using (var module = new TestableDependencyTrackingTelemetryModule()) { module.OnIsProfilerAvailable = () => false; module.Initialize(TelemetryConfiguration.CreateDefault()); var f1 = typeof(DependencyTrackingTelemetryModule).GetField("httpEventListener", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic); Assert.IsNotNull(f1.GetValue(module)); var f2 = typeof(DependencyTrackingTelemetryModule).GetField("sqlEventListener", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic); Assert.IsNotNull(f2.GetValue(module)); } }
public void EventSourceInstrumentationEnabledWhenProfilerInstrumentationDisabled() { using (var module = new TestableDependencyTrackingTelemetryModule()) { module.OnIsProfilerAvailable = () => false; module.Initialize(TelemetryConfiguration.CreateDefault()); var f1 = typeof(DependencyTrackingTelemetryModule).GetField("httpEventListener", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic); Assert.IsNotNull(f1.GetValue(module)); var f2 = typeof(DependencyTrackingTelemetryModule).GetField("sqlEventListener", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic); Assert.IsNotNull(f2.GetValue(module)); } }
public void EventSourceInstrumentationEnabledWhenProfilerFailsToAttach() { using (var module = new TestableDependencyTrackingTelemetryModule()) { module.OnIsProfilerAvailable = () => true; module.OnInitializeForRuntimeProfiler = () => { throw new Exception(); }; DependencyTableStore.Instance.IsProfilerActivated = false; module.Initialize(TelemetryConfiguration.CreateDefault()); var f1 = typeof(DependencyTrackingTelemetryModule).GetField("httpEventListener", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic); Assert.IsNotNull(f1.GetValue(module)); var f2 = typeof(DependencyTrackingTelemetryModule).GetField("sqlEventListener", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic); Assert.IsNotNull(f2.GetValue(module)); Assert.IsFalse(DependencyTableStore.Instance.IsProfilerActivated); } }
public void EventSourceInstrumentationEnabledWhenProfilerFailsToAttach() { using (var module = new TestableDependencyTrackingTelemetryModule()) { module.OnIsProfilerAvailable = () => true; module.OnInitializeForRuntimeProfiler = () => { throw new Exception(); }; DependencyTableStore.Instance.IsProfilerActivated = false; module.Initialize(TelemetryConfiguration.CreateDefault()); var f1 = typeof(DependencyTrackingTelemetryModule).GetField("httpEventListener", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic); Assert.IsNotNull(f1.GetValue(module)); var f2 = typeof(DependencyTrackingTelemetryModule).GetField("sqlEventListener", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic); Assert.IsNotNull(f2.GetValue(module)); Assert.IsFalse(DependencyTableStore.Instance.IsProfilerActivated); } }