/// <summary> /// Create AWS Service spans based on HttpRequestMessage /// if for some reason we are not able to parse the requests /// return null so an external request will be captured /// </summary> /// <param name="request"></param> /// <returns></returns> internal static ISpan CreateAWSSpans(HttpRequestMessage request) { ISpan span = null; var host = request.Headers.Host; var split = host.Split(new char[] { '.' }); switch (split[0]) { case "dynamodb": span = ServiceHelpers.CreateSpan(request.GetDynamoDBOperationData(), "DynamoDB"); break; case "sns": if (!UseDTWrapper) { span = ServiceHelpers.CreateSpan(request.GetSNSOperationData(), "SNS"); } break; case "sqs": if (!UseDTWrapper) { span = ServiceHelpers.CreateSpan(request.GetSQSOperationData(), "SQS"); } break; default: break; } return(span); }
private static ISpan BeforeWrappedMethod(object request) { if (AwsServiceHandler.UseDTWrapper) { ISpan span = null; switch (request.GetType().ToString()) { case "Amazon.SQS.Model.SendMessageRequest": var sendMessageRequest = (SendMessageRequest)request; span = ServiceHelpers.CreateSpan(sendMessageRequest.GetOperationName(ServiceHelpers.ProduceOperation), Component, ServiceHelpers.ProduceOperation); span.ApplyDistributedTracePayload(sendMessageRequest.MessageAttributes); break; case "Amazon.SQS.Model.SendMessageBatchRequest": var sendMessageBatchRequest = (SendMessageBatchRequest)request; span = ServiceHelpers.CreateSpan(sendMessageBatchRequest.GetOperationName(ServiceHelpers.ProduceOperation), Component, ServiceHelpers.ProduceOperation); foreach (var entry in sendMessageBatchRequest.Entries) { span.ApplyDistributedTracePayload(entry.MessageAttributes); } break; default: break; } return(span); } else { return(null); } }
private static ISpan BeforeWrappedMethod(PublishRequest publishRequest) { if (AwsServiceHandler.UseDTWrapper) { var span = ServiceHelpers.CreateSpan(publishRequest.GetOperationName(ServiceHelpers.ProduceOperation), "SNS", ServiceHelpers.ProduceOperation); span.ApplyDistributedTracePayload(publishRequest.MessageAttributes); return(span); } else { return(null); } }