コード例 #1
0
        public void ActivityIdsAreRecordedOnChildEvents()
        {
            var healthReporter = Mock.Of <IHealthReporter>();
            var observer       = new Mock <IObserver <EventData> >();

            using (var input = new DiagnosticSourceInput(new[] { new DiagnosticSourceConfiguration {
                                                                     ProviderName = "test"
                                                                 } }, healthReporter))
            {
                input.Subscribe(observer.Object);

                var          parentActivity = new Activity("parent-activity");
                var          childActivity  = new Activity("child-activity");
                const string eventName      = "event-name";

                TestLog.StartActivity(parentActivity, null);
                TestLog.StartActivity(childActivity, null);
                TestLog.Write(eventName, null);
                TestLog.StopActivity(childActivity, null);
                TestLog.StopActivity(parentActivity, null);

                observer.Verify(o => o.OnNext(It.Is <EventData>(data =>
                                                                data.Payload["EventName"].Equals(eventName) &&
                                                                data.Payload["ActivityId"].Equals(childActivity.Id) &&
                                                                data.Payload["ActivityParentId"].Equals(parentActivity.Id)
                                                                )), Times.Once);
            }
        }
コード例 #2
0
 private void HandleSpanStart(ApmSpanScopeParams prms)
 {
     if (RabbitMqLogger.IsEnabled(Constants.Events.SpanStart))
     {
         RabbitMqLogger.Write(Constants.Events.SpanStart, RabbitMqEvent <ApmSpanScopeParams> .Success(prms));
     }
 }
コード例 #3
0
 public void Handle(CommandStartedEvent @event)
 {
     if (MongoLogger.IsEnabled(Constants.Events.CommandStart))
     {
         MongoLogger.Write(Constants.Events.CommandStart, new EventPayload <CommandStartedEvent>(@event));
     }
 }
コード例 #4
0
 private static void PublishTracingHeader(IBasicProperties basicProperties)
 {
   if (basicProperties != null)
     RabbitMqLogger.Write(Constants.Events.PublishTracingHeader, RabbitMqEvent<IBasicProperties>.Success(basicProperties));
 }