< Summary

Class:Azure.Core.Diagnostics.AzureCoreEventSource
Assembly:Azure.Core
File(s):C:\Git\azure-sdk-for-net\sdk\core\Azure.Core\src\Diagnostics\AzureCoreEventSource.cs
Covered lines:34
Uncovered lines:2
Coverable lines:36
Total lines:138
Line coverage:94.4% (34 of 36)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
get_Singleton()-100%100%
BackgroundRefreshFailed(...)-100%100%
Request(...)-100%100%
RequestContent(...)-100%100%
RequestContentText(...)-100%100%
Response(...)-100%100%
ResponseContent(...)-100%100%
ResponseContentBlock(...)-100%100%
ResponseContentText(...)-100%100%
ResponseContentTextBlock(...)-100%100%
ErrorResponse(...)-100%100%
ErrorResponseContent(...)-100%100%
ErrorResponseContentBlock(...)-100%100%
ErrorResponseContentText(...)-100%100%
ErrorResponseContentTextBlock(...)-100%100%
RequestRetrying(...)-100%100%
ResponseDelay(...)-0%100%
ExceptionResponse(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\core\Azure.Core\src\Diagnostics\AzureCoreEventSource.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Diagnostics.Tracing;
 6
 7namespace Azure.Core.Diagnostics
 8{
 9    [EventSource(Name = EventSourceName)]
 10    internal sealed class AzureCoreEventSource : EventSource
 11    {
 12        private const string EventSourceName = "Azure-Core";
 13
 14        private const int BackgroundRefreshFailedEvent = 19;
 15        private const int RequestEvent = 1;
 16        private const int RequestContentEvent = 2;
 17        private const int RequestContentTextEvent = 17;
 18        private const int ResponseEvent = 5;
 19        private const int ResponseContentEvent = 6;
 20        private const int ResponseDelayEvent = 7;
 21        private const int ResponseContentTextEvent = 13;
 22        private const int ResponseContentBlockEvent = 11;
 23        private const int ResponseContentTextBlockEvent = 15;
 24        private const int ErrorResponseEvent = 8;
 25        private const int ErrorResponseContentEvent = 9;
 26        private const int ErrorResponseContentTextEvent = 14;
 27        private const int ErrorResponseContentBlockEvent = 12;
 28        private const int ErrorResponseContentTextBlockEvent = 16;
 29        private const int RequestRetryingEvent = 10;
 30        private const int ExceptionResponseEvent = 18;
 31
 432        private AzureCoreEventSource() : base(EventSourceName, EventSourceSettings.Default, AzureEventSourceListener.Tra
 33
 74634        public static AzureCoreEventSource Singleton { get; } = new AzureCoreEventSource();
 35
 36        [Event(BackgroundRefreshFailedEvent, Level = EventLevel.Informational, Message = "Background token refresh [{0}]
 37        public void BackgroundRefreshFailed(string requestId, string exception)
 38        {
 1239            WriteEvent(BackgroundRefreshFailedEvent, requestId, exception);
 1240        }
 41
 42        [Event(RequestEvent, Level = EventLevel.Informational, Message = "Request [{0}] {1} {2}\r\n{3}client assembly: {
 43        public void Request(string requestId, string method, string uri, string headers, string? clientAssembly)
 44        {
 213245            WriteEvent(RequestEvent, requestId, method, uri, headers, clientAssembly);
 213246        }
 47
 48        [Event(RequestContentEvent, Level = EventLevel.Verbose, Message = "Request [{0}] content: {1}")]
 49        public void RequestContent(string requestId, byte[] content)
 50        {
 851            WriteEvent(RequestContentEvent, requestId, content);
 852        }
 53
 54        [Event(RequestContentTextEvent, Level = EventLevel.Verbose, Message = "Request [{0}] content: {1}")]
 55        public void RequestContentText(string requestId, string content)
 56        {
 857            WriteEvent(RequestContentTextEvent, requestId, content);
 858        }
 59
 60        [Event(ResponseEvent, Level = EventLevel.Informational, Message = "Response [{0}] {1} {2} ({4:00.0}s)\r\n{3}")]
 61        public void Response(string requestId, int status, string reasonPhrase, string headers, double seconds)
 62        {
 167263            WriteEvent(ResponseEvent, requestId, status, reasonPhrase, headers, seconds);
 167264        }
 65
 66        [Event(ResponseContentEvent, Level = EventLevel.Verbose, Message = "Response [{0}] content: {1}")]
 67        public void ResponseContent(string requestId, byte[] content)
 68        {
 469            WriteEvent(ResponseContentEvent, requestId, content);
 470        }
 71
 72        [Event(ResponseContentBlockEvent, Level = EventLevel.Verbose, Message = "Response [{0}] content block {1}: {2}")
 73        public void ResponseContentBlock(string requestId, int blockNumber, byte[] content)
 74        {
 875            WriteEvent(ResponseContentBlockEvent, requestId, blockNumber, content);
 876        }
 77
 78        [Event(ResponseContentTextEvent, Level = EventLevel.Verbose, Message = "Response [{0}] content: {1}")]
 79        public void ResponseContentText(string requestId, string content)
 80        {
 881            WriteEvent(ResponseContentTextEvent, requestId, content);
 882        }
 83
 84        [Event(ResponseContentTextBlockEvent, Level = EventLevel.Verbose, Message = "Response [{0}] content block {1}: {
 85        public void ResponseContentTextBlock(string requestId, int blockNumber, string content)
 86        {
 1287            WriteEvent(ResponseContentTextBlockEvent, requestId, blockNumber, content);
 1288        }
 89
 90        [Event(ErrorResponseEvent, Level = EventLevel.Warning, Message = "Error response [{0}] {1} {2} ({4:00.0}s)\r\n{3
 91        public void ErrorResponse(string requestId, int status, string reasonPhrase, string headers, double seconds)
 92        {
 43893            WriteEvent(ErrorResponseEvent, requestId, status, reasonPhrase, headers, seconds);
 43894        }
 95
 96        [Event(ErrorResponseContentEvent, Level = EventLevel.Informational, Message = "Error response [{0}] content: {1}
 97        public void ErrorResponseContent(string requestId, byte[] content)
 98        {
 499            WriteEvent(ErrorResponseContentEvent, requestId, content);
 4100        }
 101
 102        [Event(ErrorResponseContentBlockEvent, Level = EventLevel.Informational, Message = "Error response [{0}] content
 103        public void ErrorResponseContentBlock(string requestId, int blockNumber, byte[] content)
 104        {
 8105            WriteEvent(ErrorResponseContentBlockEvent, requestId, blockNumber, content);
 8106        }
 107
 108        [Event(ErrorResponseContentTextEvent, Level = EventLevel.Informational, Message = "Error response [{0}] content:
 109        public void ErrorResponseContentText(string requestId, string content)
 110        {
 4111            WriteEvent(ErrorResponseContentTextEvent, requestId, content);
 4112        }
 113
 114        [Event(ErrorResponseContentTextBlockEvent, Level = EventLevel.Informational, Message = "Error response [{0}] con
 115        public void ErrorResponseContentTextBlock(string requestId, int blockNumber, string content)
 116        {
 8117            WriteEvent(ErrorResponseContentTextBlockEvent, requestId, blockNumber, content);
 8118        }
 119
 120        [Event(RequestRetryingEvent, Level = EventLevel.Informational, Message = "Request [{0}] retry number {1} took {2
 121        public void RequestRetrying(string requestId, int retryNumber, double seconds)
 122        {
 640123            WriteEvent(RequestRetryingEvent, requestId, retryNumber, seconds);
 640124        }
 125
 126        [Event(ResponseDelayEvent, Level = EventLevel.Warning, Message = "Response [{0}] took {1:00.0}s")]
 127        public void ResponseDelay(string requestId, double seconds)
 128        {
 0129            WriteEvent(ResponseDelayEvent, requestId, seconds);
 0130        }
 131
 132        [Event(ExceptionResponseEvent, Level = EventLevel.Informational, Message = "Request [{0}] exception {1}")]
 133        public void ExceptionResponse(string requestId, string exception)
 134        {
 20135            WriteEvent(ExceptionResponseEvent, requestId, exception);
 20136        }
 137    }
 138}