< Summary

Class:Azure.Messaging.EventHubs.Processor.Diagnostics.EventProcessorClientEventSource
Assembly:Azure.Messaging.EventHubs.Processor
File(s):C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.Messaging.EventHubs.Processor\src\Diagnostics\EventProcessorClientEventSource.cs
Covered lines:15
Uncovered lines:8
Coverable lines:23
Total lines:182
Line coverage:65.2% (15 of 23)
Covered branches:5
Total branches:64
Branch coverage:7.8% (5 of 64)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_Log()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
EventBatchProcessingStart(...)-66.67%10%
EventBatchProcessingComplete(...)-66.67%10%
EventBatchProcessingError(...)-66.67%8.33%
UpdateCheckpointStart(...)-66.67%10%
UpdateCheckpointComplete(...)-66.67%10%
UpdateCheckpointError(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.Messaging.EventHubs.Processor\src\Diagnostics\EventProcessorClientEventSource.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Diagnostics.Tracing;
 5using Azure.Core.Diagnostics;
 6
 7namespace Azure.Messaging.EventHubs.Processor.Diagnostics
 8{
 9    /// <summary>
 10    ///   Serves as an ETW event source for logging of information about
 11    ///   Event Processor client.
 12    /// </summary>
 13    ///
 14    /// <remarks>
 15    ///   When defining Start/Stop tasks, it is highly recommended that the
 16    ///   the StopEvent.Id must be exactly StartEvent.Id + 1.
 17    /// </remarks>
 18    ///
 19    [EventSource(Name = EventSourceName)]
 20    internal class EventProcessorClientEventSource : EventSource
 21    {
 22        /// <summary>The name to use for the event source.</summary>
 23        private const string EventSourceName = "Azure-Messaging-EventHubs-Processor-EventProcessorClient";
 24
 25        /// <summary>
 26        ///   Provides a singleton instance of the event source for callers to
 27        ///   use for logging.
 28        /// </summary>
 29        ///
 13430        public static EventProcessorClientEventSource Log { get; } = new EventProcessorClientEventSource(EventSourceName
 31
 32        /// <summary>
 33        ///   Prevents an instance of the <see cref="EventProcessorClientEventSource"/> class from being created
 34        ///   outside the scope of this library.  Exposed for testing purposes only.
 35        /// </summary>
 36        ///
 1037        protected EventProcessorClientEventSource() : base(EventSourceName, EventSourceSettings.Default, AzureEventSourc
 38        {
 1039        }
 40
 41        /// <summary>
 42        ///   Prevents an instance of the <see cref="EventProcessorClientEventSource"/> class from being created
 43        ///   outside the scope of this library.  Exposed for testing purposes only.
 44        /// </summary>
 45        ///
 46        /// <param name="eventSourceName">The name to assign the event source.</param>
 47        ///
 248        private EventProcessorClientEventSource(string eventSourceName) : base(eventSourceName, EventSourceSettings.Defa
 49        {
 250        }
 51
 52        /// <summary>
 53        ///   Indicates that an <see cref="EventProcessorClient" /> has begin processing a batch of events for a partiti
 54        /// </summary>
 55        ///
 56        /// <param name="partitionId">The identifier of the Event Hub partition whose processing is taking place.</param
 57        /// <param name="identifier">A unique name used to identify the event processor.</param>
 58        /// <param name="eventHubName">The name of the Event Hub that the processor is associated with.</param>
 59        /// <param name="consumerGroup">The name of the consumer group that the processor is associated with.</param>
 60        ///
 61        [Event(20, Level = EventLevel.Verbose, Message = "Starting to process a batch of events for partition '{0}' by p
 62        public virtual void EventBatchProcessingStart(string partitionId,
 63                                                      string identifier,
 64                                                      string eventHubName,
 65                                                      string consumerGroup)
 66        {
 867            if (IsEnabled())
 68            {
 069                WriteEvent(20, partitionId ?? string.Empty, identifier ?? string.Empty, eventHubName ?? string.Empty, co
 70            }
 871        }
 72
 73        /// <summary>
 74        ///   Indicates that an <see cref="EventProcessorClient" /> instance has experienced an exception while processi
 75        /// </summary>
 76        ///
 77        /// <param name="partitionId">The identifier of the Event Hub partition whose processing is taking place.</param
 78        /// <param name="identifier">A unique name used to identify the event processor.</param>
 79        /// <param name="eventHubName">The name of the Event Hub that the processor is associated with.</param>
 80        /// <param name="consumerGroup">The name of the consumer group that the processor is associated with.</param>
 81        ///
 82        [Event(21, Level = EventLevel.Verbose, Message = "Completed processing a batch of events for partition '{0}' by 
 83        public virtual void EventBatchProcessingComplete(string partitionId,
 84                                                         string identifier,
 85                                                         string eventHubName,
 86                                                         string consumerGroup)
 87        {
 888            if (IsEnabled())
 89            {
 090                WriteEvent(21, partitionId ?? string.Empty, identifier ?? string.Empty, eventHubName ?? string.Empty, co
 91            }
 892        }
 93
 94        /// <summary>
 95        ///   Indicates that an <see cref="EventProcessorClient" /> has completed processing for a batch of events.
 96        /// </summary>
 97        ///
 98        /// <param name="partitionId">The identifier of the Event Hub partition whose processing is taking place.</param
 99        /// <param name="identifier">A unique name used to identify the event processor.</param>
 100        /// <param name="eventHubName">The name of the Event Hub that the processor is associated with.</param>
 101        /// <param name="consumerGroup">The name of the consumer group that the processor is associated with.</param>
 102        /// <param name="errorMessage">The message for the exception that occurred.</param>
 103        ///
 104        [Event(22, Level = EventLevel.Error, Message = "An exception occurred while processing events for partition '{0}
 105        public virtual void EventBatchProcessingError(string partitionId,
 106                                                      string identifier,
 107                                                      string eventHubName,
 108                                                      string consumerGroup,
 109                                                      string errorMessage)
 110        {
 8111            if (IsEnabled())
 112            {
 0113                WriteEvent(22, partitionId ?? string.Empty, identifier ?? string.Empty, eventHubName ?? string.Empty, co
 114            }
 8115        }
 116
 117        /// <summary>
 118        ///   Indicates that process of updating the checkpoint in the chosen storage service has started.
 119        /// </summary>
 120        ///
 121        /// <param name="partitionId">The identifier of the Event Hub partition whose processing is taking place.</param
 122        /// <param name="identifier">A unique name used to identify the event processor.</param>
 123        /// <param name="eventHubName">The name of the Event Hub that the processor is associated with.</param>
 124        /// <param name="consumerGroup">The name of the consumer group that the processor is associated with.</param>
 125        ///
 126        [Event(23, Level = EventLevel.Verbose, Message = "Starting to perform a checkpoint update for partition '{0}' by
 127        public virtual void UpdateCheckpointStart(string partitionId,
 128                                                  string identifier,
 129                                                  string eventHubName,
 130                                                  string consumerGroup)
 131        {
 6132            if (IsEnabled())
 133            {
 0134                WriteEvent(23, partitionId ?? string.Empty, identifier ?? string.Empty, eventHubName ?? string.Empty, co
 135            }
 6136        }
 137
 138        /// <summary>
 139        ///   Indicates that process of updating the checkpoint in the chosen storage service has completed.
 140        /// </summary>
 141        ///
 142        /// <param name="partitionId">The identifier of the Event Hub partition whose processing is taking place.</param
 143        /// <param name="identifier">A unique name used to identify the event processor.</param>
 144        /// <param name="eventHubName">The name of the Event Hub that the processor is associated with.</param>
 145        /// <param name="consumerGroup">The name of the consumer group that the processor is associated with.</param>
 146        ///
 147        [Event(24, Level = EventLevel.Verbose, Message = "Completed performing a checkpoint update for partition '{0}' b
 148        public virtual void UpdateCheckpointComplete(string partitionId,
 149                                                     string identifier,
 150                                                     string eventHubName,
 151                                                     string consumerGroup)
 152        {
 6153            if (IsEnabled())
 154            {
 0155                WriteEvent(24, partitionId ?? string.Empty, identifier ?? string.Empty, eventHubName ?? string.Empty, co
 156            }
 6157        }
 158
 159        /// <summary>
 160        ///   Indicates that the process of updating the checkpoint in the chosen storage service has experienced an exc
 161        /// </summary>
 162        ///
 163        /// <param name="partitionId">The identifier of the Event Hub partition whose processing is taking place.</param
 164        /// <param name="identifier">A unique name used to identify the event processor.</param>
 165        /// <param name="eventHubName">The name of the Event Hub that the processor is associated with.</param>
 166        /// <param name="consumerGroup">The name of the consumer group that the processor is associated with.</param>
 167        /// <param name="errorMessage">The message for the exception that occurred.</param>
 168        ///
 169        [Event(25, Level = EventLevel.Error, Message = "An exception occurred while attempting to perform a checkpoint u
 170        public virtual void UpdateCheckpointError(string partitionId,
 171                                                  string identifier,
 172                                                  string eventHubName,
 173                                                  string consumerGroup,
 174                                                  string errorMessage)
 175        {
 0176            if (IsEnabled())
 177            {
 0178                WriteEvent(25, partitionId ?? string.Empty, identifier ?? string.Empty, eventHubName ?? string.Empty, co
 179            }
 0180        }
 181    }
 182}