public new void TestCleanup() { base.TestCleanup(); _recorder.Dispose(); _recorder = null; _subscription.Dispose(); }
public void TestInitializeInstanceWithRecorder3() // setting custom daemon address to DefaultSamplingStrategy() { string daemonAddress = "udp:127.0.0.2:2001 tcp:127.0.0.1:2000"; IPEndPoint expectedUDPEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.2"), 2001); IPEndPoint expectedTCPEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 2000); AWSXRayRecorder recorder = BuildAWSXRayRecorder(daemonAddress: daemonAddress); #if NET45 AWSXRayRecorder.InitializeInstance(recorder); #else AWSXRayRecorder.InitializeInstance(recorder: recorder); #endif Assert.AreEqual(AWSXRayRecorder.Instance.SamplingStrategy, recorder.SamplingStrategy); Assert.AreEqual(typeof(DefaultSamplingStrategy), recorder.SamplingStrategy.GetType()); // Default startegy set Assert.AreEqual(typeof(UdpSegmentEmitter), recorder.Emitter.GetType()); // Default emitter set var udpEmitter = (UdpSegmentEmitter)recorder.Emitter; Assert.AreEqual(expectedUDPEndpoint, udpEmitter.EndPoint); var defaultStartegy = (DefaultSamplingStrategy)recorder.SamplingStrategy; Assert.AreEqual(expectedUDPEndpoint, defaultStartegy.DaemonCfg.UDPEndpoint); Assert.AreEqual(expectedTCPEndpoint, defaultStartegy.DaemonCfg.TCPEndpoint); recorder.Dispose(); }
public new void TestCleanup() { connection.Close(); connection.Dispose(); recorder.EndSegment(); recorder.Dispose(); base.TestCleanup(); }
public void TestInitializeInstanceWithRecorde4() // Set custom trace context { AWSXRayRecorder recorder = BuildAWSXRayRecorder(traceContext: new DummyTraceContext()); #if NET45 AWSXRayRecorder.InitializeInstance(recorder); #else AWSXRayRecorder.InitializeInstance(recorder: recorder); #endif Assert.AreEqual(typeof(DummyTraceContext), AWSXRayRecorder.Instance.TraceContext.GetType()); // Custom trace context recorder.Dispose(); }
public new void TestCleanup() { base.TestCleanup(); #if NET45 ConfigurationManager.AppSettings[DisableXRayTracingKey] = string.Empty; AppSettings.Reset(); #else _xRayOptions = new XRayOptions(); #endif Environment.SetEnvironmentVariable(AWSXRayRecorder.EnvironmentVariableContextMissingStrategy, null); _recorder.Dispose(); AWSXRayRecorder.Instance.Dispose(); }
public void TestInitializeInstanceWithRecorder1() { AWSXRayRecorder recorder = BuildAWSXRayRecorder(new TestSamplingStrategy()); #if NET45 AWSXRayRecorder.InitializeInstance(recorder); #else AWSXRayRecorder.InitializeInstance(recorder: recorder); #endif Assert.AreEqual(AWSXRayRecorder.Instance.SamplingStrategy, recorder.SamplingStrategy); // Custom recorder set in AWSXRayRecorder.Instance.TraceContext Assert.AreEqual(typeof(TestSamplingStrategy), recorder.SamplingStrategy.GetType()); // custom strategy set Assert.AreEqual(typeof(UdpSegmentEmitter), recorder.Emitter.GetType()); // Default emitter set recorder.Dispose(); }
public void TestInitializeInstanceWithRecorder() { IConfiguration configuration = BuildConfiguration("DisabledXRayTrue.json"); AWSXRayRecorder recorder = BuildAWSXRayRecorder(); AWSXRayRecorder.InitializeInstance(configuration, recorder); _xRayOptions = recorder.XRayOptions; Assert.IsTrue(_xRayOptions.IsXRayTracingDisabled); Assert.IsNull(_xRayOptions.AwsServiceHandlerManifest); Assert.IsNull(_xRayOptions.PluginSetting); Assert.IsNull(_xRayOptions.SamplingRuleManifest); Assert.AreEqual(AWSXRayRecorder.Instance.SamplingStrategy, recorder.SamplingStrategy); // Custom recorder set in TraceContext recorder.Dispose(); }
public void TestInitializeInstanceWithRecorder() { IConfiguration configuration = BuildConfiguration("DisabledXRayTrue.json"); AWSXRayRecorder recorder = new AWSXRayRecorder(); AWSXRayRecorder.InitializeInstance(configuration, recorder); _xRayOptions = recorder.XRayOptions; Assert.IsTrue(_xRayOptions.IsXRayTracingDisabled); Assert.IsNull(_xRayOptions.AwsServiceHandlerManifest); Assert.IsNull(_xRayOptions.PluginSetting); Assert.IsNull(_xRayOptions.SamplingRuleManifest); recorder.Dispose(); }
public void TestInitializeInstanceWithRecorder2() { IConfiguration configuration = BuildConfiguration("DisabledXRayTrue.json"); AWSXRayRecorder recorder = BuildAWSXRayRecorder(new TestSamplingStrategy(), new DummyEmitter()); AWSXRayRecorder.InitializeInstance(configuration, recorder); _xRayOptions = recorder.XRayOptions; Assert.IsTrue(_xRayOptions.IsXRayTracingDisabled); Assert.IsNull(_xRayOptions.AwsServiceHandlerManifest); Assert.IsNull(_xRayOptions.PluginSetting); Assert.IsNull(_xRayOptions.SamplingRuleManifest); Assert.IsTrue(_xRayOptions.UseRuntimeErrors); Assert.AreEqual(AWSXRayRecorder.Instance.SamplingStrategy, recorder.SamplingStrategy); // Custom recorder set in TraceContext Assert.AreEqual(typeof(DummyEmitter), recorder.Emitter.GetType()); // custom emitter set recorder.Dispose(); }
public static void ClassCleanup() { _recorder.Dispose(); }