Beispiel #1
0
        protected async System.Threading.Tasks.Task <BatchGetTracesResponse> BatchGetTracesAsync(string traceId)
        {
            var request = new BatchGetTracesRequest();

            request.TraceIds = new List <string>()
            {
                traceId
            };

            int retries = 0;
            BatchGetTracesResponse response = null;

            // Retry for 30s
            while (retries < 60)
            {
                response = await XrayClient.BatchGetTracesAsync(request);

                if (response.Traces.Count > 0)
                {
                    break;
                }
                else
                {
                    retries++;
                    Thread.Sleep(500);
                }
            }

            return(response);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            BatchGetTracesResponse response = new BatchGetTracesResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("NextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("Traces", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Trace, TraceUnmarshaller>(TraceUnmarshaller.Instance);
                    response.Traces = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("UnprocessedTraceIds", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <string, StringUnmarshaller>(StringUnmarshaller.Instance);
                    response.UnprocessedTraceIds = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Beispiel #3
0
        protected BatchGetTracesResponse BatchGetTraces(string traceId)
        {
            var request = new BatchGetTracesRequest();

            request.TraceIds = new List <string>()
            {
                traceId
            };

            int retries = 0;
            BatchGetTracesResponse response = null;

            while (retries < 60)
            {
                response = XrayClient.BatchGetTraces(request);
                if (response.Traces.Count > 0)
                {
                    break;
                }
                else
                {
                    retries++;
                    Thread.Sleep(500);
                }
            }

            return(response);
        }