/// <inheritdoc /> public ReceiveMessagesErrorResult MessageFailedProcessing(IReceivedMessageInternal message, IMessageContext context, Exception exception) { var spanContext = message.Extract(_tracer, _headers); if (spanContext != null) { using (IScope scope = _tracer.BuildSpan("Error").AddReference(References.FollowsFrom, spanContext).StartActive(finishSpanOnDispose: true)) { scope.Span.Log(exception.ToString()); Tags.Error.Set(scope.Span, true); var result = _handler.MessageFailedProcessing(message, context, exception); scope.Span.SetTag("WillRetry", result == ReceiveMessagesErrorResult.Retry); return(result); } } else { using (IScope scope = _tracer.BuildSpan("Error").StartActive(finishSpanOnDispose: true)) { scope.Span.AddMessageIdTag(message); scope.Span.Log(exception.ToString()); Tags.Error.Set(scope.Span, true); var result = _handler.MessageFailedProcessing(message, context, exception); scope.Span.SetTag("WillRetry", result == ReceiveMessagesErrorResult.Retry); return(result); } } }
/// <inheritdoc /> public void Handle(IReceivedMessageInternal message, IWorkerNotification workerNotification) { var ActivityContext = message.Extract(_tracer, _headers); using (var scope = _tracer.StartActivity("MessageHandler", ActivityKind.Internal, parentContext: ActivityContext)) { _handler.Handle(message, workerNotification); } }
/// <summary> /// Handles the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="workerNotification">The worker notification.</param> /// <returns></returns> public async Task HandleAsync(IReceivedMessageInternal message, IWorkerNotification workerNotification) { var activityContext = message.Extract(_tracer, _headers.StandardHeaders); using (var scope = _tracer.StartActivity("MessageHandlerAsync", ActivityKind.Internal, activityContext)) { scope?.AddMessageIdTag(message); await _handler.HandleAsync(message, workerNotification); } }
/// <inheritdoc /> public ReceiveMessagesErrorResult MessageFailedProcessing(IReceivedMessageInternal message, IMessageContext context, Exception exception) { var activityContext = message.Extract(_tracer, _headers); using (var scope = _tracer.StartActivity("Error", ActivityKind.Internal, parentContext: activityContext)) { scope?.AddMessageIdTag(message); scope?.RecordException(exception); scope?.SetStatus(Status.Error);; var result = _handler.MessageFailedProcessing(message, context, exception); scope?.SetTag("WillRetry", result == ReceiveMessagesErrorResult.Retry); return(result); } }
/// <inheritdoc /> public void Handle(IReceivedMessageInternal message, IWorkerNotification workerNotification) { var spanContext = message.Extract(_tracer, _headers); if (spanContext != null) { using (IScope scope = _tracer.BuildSpan("MessageHandler").AddReference(References.FollowsFrom, spanContext).StartActive(finishSpanOnDispose: true)) { _handler.Handle(message, workerNotification); } } else { using (IScope scope = _tracer.BuildSpan("MessageHandler").StartActive(finishSpanOnDispose: true)) { _handler.Handle(message, workerNotification); } } }
/// <summary> /// Handles the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="workerNotification">The worker notification.</param> /// <returns></returns> public async Task HandleAsync(IReceivedMessageInternal message, IWorkerNotification workerNotification) { var spanContext = message.Extract(_tracer, _headers.StandardHeaders); if (spanContext != null) { using (IScope scope = _tracer.BuildSpan("MessageHandlerAsync").AddReference(References.FollowsFrom, spanContext).StartActive(finishSpanOnDispose: true)) { scope.Span.AddMessageIdTag(message); await _handler.HandleAsync(message, workerNotification); } } else { using (IScope scope = _tracer.BuildSpan("MessageHandlerAsync").StartActive(finishSpanOnDispose: true)) { scope.Span.AddMessageIdTag(message); await _handler.HandleAsync(message, workerNotification); } } }