public void CapBeforeSubscriberInvoke([Object] CapEventDataSubExecute eventData) { _entrySegmentContextAccessor.Context = _contexts[eventData.Message.GetId()]; var context = _tracingContext.CreateLocalSegmentContext("Subscriber Invoke: " + eventData.MethodInfo.Name); //context.Span.SpanLayer = SpanLayer.DB; context.Span.Component = Components.CAP; //context.Span.AddTag(Tags.DB_TYPE, "Sql"); context.Span.AddLog(LogEvent.Event("Subscriber Invoke")); context.Span.AddLog(LogEvent.Message("Begin invoke the subscriber: " + eventData.MethodInfo.Name)); }
public void CapBeforeSubscriberInvoke([Object] CapEventDataSubExecute eventData) { _entrySegmentContextAccessor.Context = _contexts[eventData.Message.GetId() + eventData.Message.GetGroup()]; var context = _tracingContext.CreateLocalSegmentContext("Subscriber Invoke: " + eventData.MethodInfo.Name); context.Span.SpanLayer = SpanLayer.MQ; context.Span.Component = Components.CAP; context.Span.AddLog(LogEvent.Event("Subscriber Invoke Start")); context.Span.AddLog(LogEvent.Message($"Begin invoke the subscriber: {eventData.MethodInfo} {Environment.NewLine}" + $"--> Message Id: { eventData.Message.GetId()}, Group: {eventData.Message.GetGroup()}, Name: {eventData.Operation}")); _contexts[eventData.Message.GetId() + eventData.Message.GetGroup()] = context; }
private void TracingAfter(long?tracingTimestamp, Message message, MethodInfo method) { if (tracingTimestamp != null && s_diagnosticListener.IsEnabled(CapDiagnosticListenerNames.AfterSubscriberInvoke)) { var now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); var eventData = new CapEventDataSubExecute() { OperationTimestamp = now, Operation = message.GetName(), Message = message, MethodInfo = method, ElapsedTimeMs = now - tracingTimestamp.Value }; s_diagnosticListener.Write(CapDiagnosticListenerNames.AfterSubscriberInvoke, eventData); } }
public void CapErrorSubscriberInvoke([Object] CapEventDataSubExecute eventData) { var context = _localSegmentContextAccessor.Context; if (context == null) { return; } context.Span.AddLog(LogEvent.Event("Subscriber Invoke")); context.Span.AddLog(LogEvent.Message("Subscriber invoke failed!")); context.Span.ErrorOccurred(eventData.Exception); _tracingContext.Release(context); _contexts.TryRemove(eventData.Message.GetId(), out _); }
public void CapAfterSubscriberInvoke([Object] CapEventDataSubExecute eventData) { var context = _localSegmentContextAccessor.Context; if (context == null) { return; } context.Span.AddLog(LogEvent.Event("Subscriber Invoke")); context.Span.AddLog(LogEvent.Message("Subscriber invoke succeeded!")); context.Span.AddLog(LogEvent.Message("Subscriber invoke spend time: " + eventData.ElapsedTimeMs + "ms")); _tracingContext.Release(context); _contexts.TryRemove(eventData.Message.GetId(), out _); }
public void CapAfterSubscriberInvoke([Object] CapEventDataSubExecute eventData) { var context = _contexts[eventData.Message.GetId() + eventData.Message.GetGroup()]; if (context == null) { return; } context.Span.AddLog(LogEvent.Event("Subscriber Invoke End")); context.Span.AddLog(LogEvent.Message("Subscriber invoke succeeded!")); context.Span.AddLog(LogEvent.Message($"Subscriber invoke spend time: { eventData.ElapsedTimeMs}ms. {Environment.NewLine}" + $"--> Method Info: {eventData.MethodInfo}")); _tracingContext.Release(context); _contexts.TryRemove(eventData.Message.GetId() + eventData.Message.GetGroup(), out _); }
private long?TracingBefore(Message message, MethodInfo method) { if (s_diagnosticListener.IsEnabled(CapDiagnosticListenerNames.BeforeSubscriberInvoke)) { var eventData = new CapEventDataSubExecute() { OperationTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(), Operation = message.GetName(), Message = message, MethodInfo = method }; s_diagnosticListener.Write(CapDiagnosticListenerNames.BeforeSubscriberInvoke, eventData); return(eventData.OperationTimestamp); } return(null); }
public void CapErrorSubscriberInvoke([Object] CapEventDataSubExecute eventData) { var context = _contexts[eventData.Message.GetId() + eventData.Message.GetGroup()]; if (context == null) { return; } context.Span.AddLog(LogEvent.Event("Subscriber Invoke Error")); context.Span.AddLog(LogEvent.Message($"Subscriber invoke failed! {Environment.NewLine}" + $"--> Method Info: { eventData.MethodInfo} {Environment.NewLine}" + $"--> Message Info: {Environment.NewLine}" + $"{ JsonConvert.SerializeObject(eventData.Message, Formatting.Indented)}")); context.Span.ErrorOccurred(eventData.Exception); _tracingContext.Release(context); _contexts.TryRemove(eventData.Message.GetId() + eventData.Message.GetGroup(), out _); }