示例#1
0
        public void TestLambdaInvokeSubsegmentContainsFunctionNameForAWSSDKHandler()
        {
            String temp_path = @"JSONs\AWSRequestInfoWithLambda.json"; //registering manifest file with Lambda

            AWSSDKHandler.RegisterXRayManifest(temp_path);
            var lambda = new AmazonLambdaClient(new AnonymousAWSCredentials(), RegionEndpoint.USEast1);

            CustomResponses.SetResponse(lambda, null, null, true);
            AWSXRayRecorder.Instance.BeginSegment("lambda", TraceId);
#if NET45
            lambda.Invoke(new InvokeRequest
            {
                FunctionName = "testFunction"
            });
#else
            lambda.InvokeAsync(new InvokeRequest
            {
                FunctionName = "testFunction"
            }).Wait();
#endif
            var segment = TraceContext.GetEntity();
            AWSXRayRecorder.Instance.EndSegment();

            Assert.AreEqual("Invoke", segment.Subsegments[0].Aws["operation"]);
            Assert.AreEqual("testFunction", segment.Subsegments[0].Aws["function_name"]);
        }