public static XRaySegment Create(IAWSXRayRecorder xRayRecorder, string serviceName)
        {
            xRayRecorder.BeginSegment(serviceName);
            xRayRecorder.AddAnnotation("Environment", "Test");
            xRayRecorder.AddAnnotation("Version", "1.0");

            return(new XRaySegment(xRayRecorder));
        }
        public static XRaySegment Create(IAWSXRayRecorder xRayRecorder, string serviceName, string traceHeader, SampleDecision sampleDecision = SampleDecision.Unknown)
        {
            GetSamplingDetails(xRayRecorder, serviceName, traceHeader, out string traceId, out SamplingResponse samplingResponse, out string parentId);

            xRayRecorder.BeginSegment(
                serviceName, traceId, parentId, sampleDecision == SampleDecision.Unknown ? samplingResponse : new SamplingResponse(sampleDecision));
            xRayRecorder.AddAnnotation("Environment", "Test");
            xRayRecorder.AddAnnotation("Version", "1.0");

            return(new XRaySegment(xRayRecorder));
        }
 public void TestNoNewSegmentInLambda()
 {
     try
     {
         _recorder.BeginSegment("test", null, null);
         Assert.Fail();
     }
     catch (UnsupportedOperationException)
     {
         // expected
     }
     Assert.IsFalse(TraceContext.IsEntityPresent()); // Segment cannot be added in Lambda Context
 }