Пример #1
0
        public void TestAddPrecursorIdOnSubsegment()
        {
            _recorder.BeginSegment(GetType().Name, TraceId);
            var segment = AWSXRayRecorder.Instance.TraceContext.GetEntity();

            _recorder.BeginSubsegment("child");
            var newSegmentId = ThreadSafeRandom.GenerateHexNumber(16);

            _recorder.AddPrecursorId(newSegmentId);
            _recorder.EndSubsegment();

            Assert.AreEqual(newSegmentId, segment.Subsegments[0].PrecursorIds.First());

            _recorder.EndSegment();
        }
Пример #2
0
        public void TestLogErrorModeForContextMissingStrategy()
        {
            using (var recorder = new AWSXRayRecorder())
            {
                recorder.ContextMissingStrategy = ContextMissingStrategy.LOG_ERROR;

                recorder.EndSegment();
                recorder.BeginSubsegment("no segment");
                recorder.EndSubsegment();
                recorder.SetNamespace("dummy namespace");
                recorder.AddAnnotation("key", "value");
                recorder.AddHttpInformation("key", "value");
                recorder.MarkError();
                recorder.MarkFault();
                recorder.MarkThrottle();
                recorder.AddException(new ArgumentNullException());
                recorder.AddPrecursorId(Entity.GenerateId());
                recorder.AddSqlInformation("sqlKey", "value");
                recorder.AddMetadata("key", "value");
            }
        }