I have a setup for SQSClient like this:
var client = new AmazonSQSClient();
new AWSSdkTracingHandler(AWSXRayRecorder.Instance).AddEventHandler(client);
return client;
now when i call the client
var receiveResult = _amazonSqs.ReceiveMessage(_longPollRequest);
I get the following exception
Amazon.XRay.Recorder.Core.Exceptions.EntityNotAvailableException was
unhandled by user code
HResult=-2146233088
Message=Entity doesn't exist in CallContext
Source=AWSXRayRecorder.Core
StackTrace:
at Amazon.XRay.Recorder.Core.Internal.Utils.TraceContext.GetEntity() in c:\Jenkins\jobs\net-release\workspace\sdk\src\Core\Internal\Utils\TraceContext.cs:line 47
at Amazon.XRay.Recorder.Handlers.AwsSdk.AWSSdkTracingHandler.ExceptionEventHandler(Object sender, ExceptionEventArgs e) in c:\Jenkins\jobs\net-release\workspace\sdk\src\Handlers\AwsSdk\AWSSdkTracingHandler.cs:line 324
at Amazon.Runtime.AmazonServiceClient.ProcessExceptionHandlers(IExecutionContext executionContext, Exception exception)
at Amazon.Runtime.Internal.ErrorCallbackHandler.HandleException(IExecutionContext executionContext, Exception exception)
at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.MetricsHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.RuntimePipeline.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.AmazonServiceClient.Invoke[TRequest,TResponse](TRequest request, IMarshaller`2 marshaller, ResponseUnmarshaller unmarshaller)
at Amazon.SQS.AmazonSQSClient.ReceiveMessage(ReceiveMessageRequest request)
at BasePriceCalculator.Library.Services.AwsSqsCalculationMessageListener.Listen() in C:\working\base-price-calculator\BasePriceCalculator.Library\Services\AwsSqsCalculationMessageListener.cs:line 74
at BasePriceCalculator.BasePriceCalculatorService.<Start>b__3_0() in C:\working\base-price-calculator\BasePriceCalculator\BasePriceCalculatorService.cs:line 26
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
i have tried adding something like AWSXRayRecorder.Instance.BeginSegment();
but somehow that requires a traceId
that i can't seem to satisfy
AWSXRayRecorder.Instance.BeginSegment("ReceiveMessage", Guid.NewGuid().ToString());
var receiveResult = _amazonSqs.ReceiveMessage(_longPollRequest);
AWSXRayRecorder.Instance.EndSegment();
exception:
System.ArgumentException was unhandled by user code
HResult=-2147024809
Message=Trace id is invalid.
Parameter name: value
ParamName=value
Source=AWSXRayRecorder.Core
StackTrace:
at Amazon.XRay.Recorder.Core.Internal.Entities.Entity.set_TraceId(String value) in c:\Jenkins\jobs\net-release\workspace\sdk\src\Core\Internal\Entities\Entity.cs:line 78
at Amazon.XRay.Recorder.Core.Internal.Entities.Segment..ctor(String name, String traceId, String parentId) in c:\Jenkins\jobs\net-release\workspace\sdk\src\Core\Internal\Entities\Segment.cs:line 46
at Amazon.XRay.Recorder.Core.AWSXRayRecorder.BeginSegment(String name, String traceId, String parentId, SampleDecision sampleDecision) in c:\Jenkins\jobs\net-release\workspace\sdk\src\Core\AWSXRayRecorder.cs:line 164
at BasePriceCalculator.Library.Services.AwsSqsCalculationMessageListener.<Listen>b__10_1() in C:\working\base-price-calculator\BasePriceCalculator.Library\Services\AwsSqsCalculationMessageListener.cs:line 65
at StatsdClient.DogStatsdService.Time[T](Func`1 func, String statName, Double sampleRate, String[] tags)
at StatsdClient.DogStatsd.Time[T](Func`1 func, String statName, Double sampleRate, String[] tags)
at DataDogUtils.DataDogMetricPublisher.Time[T](Func`1 func, String statName, Double sampleRate, String[] tags)
at BasePriceCalculator.Library.Services.AwsSqsCalculationMessageListener.<Listen>b__10_0() in C:\working\base-price-calculator\BasePriceCalculator.Library\Services\AwsSqsCalculationMessageListener.cs:line 63
at Polly.Policy`1.<>c__DisplayClass67_0.<ExecuteAndCapture>b__0(Context ctx, CancellationToken ct) in C:\projects\polly\src\Polly.Shared\Policy.TResult.cs:line 194
at Polly.Retry.RetryEngine.Implementation[TResult](Func`3 action, Context context, CancellationToken cancellationToken, IEnumerable`1 shouldRetryExceptionPredicates, IEnumerable`1 shouldRetryResultPredicates, Func`1 policyStateFactory) in C:\projects\polly\src\Polly.Shared\Retry\RetryEngine.cs:line 26
I must be doing something wrong, but i am not seeing it.
You can create a new Trace ID using TraceId.NewId();
. This class is available in the Amazon.XRay.Recorder.Core.Internal.Entities
namespace.
As Ruslan mentioned, we (the AWS X-Ray team) are very active on the AWS X-Ray official forum. Unfortunately, your linked post appears to have been posted in the AWS .NET language specific forum. We're much more likely to quickly respond to future posts if they're made to the X-Ray specific forum .
Thanks,
James B.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.