33
44using System ;
55using System . Diagnostics ;
6+ using System . Diagnostics . CodeAnalysis ;
67using System . Diagnostics . Tracing ;
78
89namespace Microsoft . Azure . WebJobs . Script . WebHost . Diagnostics
@@ -17,27 +18,27 @@ public void LogFunctionTraceEvent(TraceLevel level, string subscriptionId, strin
1718 switch ( level )
1819 {
1920 case TraceLevel . Verbose :
20- FunctionsEventSource . Instance . RaiseFunctionsEventVerbose ( subscriptionId , appName , functionName , eventName , source , details , summary , ScriptHost . Version , eventTimestamp ) ;
21+ FunctionsSystemLogsEventSource . Instance . RaiseFunctionsEventVerbose ( subscriptionId , appName , functionName , eventName , source , details , summary , ScriptHost . Version , eventTimestamp ) ;
2122 break ;
2223 case TraceLevel . Info :
23- FunctionsEventSource . Instance . RaiseFunctionsEventInfo ( subscriptionId , appName , functionName , eventName , source , details , summary , ScriptHost . Version , eventTimestamp ) ;
24+ FunctionsSystemLogsEventSource . Instance . RaiseFunctionsEventInfo ( subscriptionId , appName , functionName , eventName , source , details , summary , ScriptHost . Version , eventTimestamp ) ;
2425 break ;
2526 case TraceLevel . Warning :
26- FunctionsEventSource . Instance . RaiseFunctionsEventWarning ( subscriptionId , appName , functionName , eventName , source , details , summary , ScriptHost . Version , eventTimestamp ) ;
27+ FunctionsSystemLogsEventSource . Instance . RaiseFunctionsEventWarning ( subscriptionId , appName , functionName , eventName , source , details , summary , ScriptHost . Version , eventTimestamp ) ;
2728 break ;
2829 case TraceLevel . Error :
2930 if ( string . IsNullOrEmpty ( details ) && exception != null )
3031 {
3132 details = exception . ToString ( ) ;
3233 }
33- FunctionsEventSource . Instance . RaiseFunctionsEventError ( subscriptionId , appName , functionName , eventName , source , details , summary , ScriptHost . Version , eventTimestamp ) ;
34+ FunctionsSystemLogsEventSource . Instance . RaiseFunctionsEventError ( subscriptionId , appName , functionName , eventName , source , details , summary , ScriptHost . Version , eventTimestamp ) ;
3435 break ;
3536 }
3637 }
3738
3839 public void LogFunctionMetricEvent ( string subscriptionId , string appName , string eventName , long average , long minimum , long maximum , long count , DateTime eventTimestamp )
3940 {
40- FunctionsEventSource . Instance . LogFunctionMetricEvent ( subscriptionId , appName , eventName , average , minimum , maximum , count , ScriptHost . Version , eventTimestamp . ToString ( EventTimestamp ) ) ;
41+ FunctionsSystemLogsEventSource . Instance . LogFunctionMetricEvent ( subscriptionId , appName , eventName , average , minimum , maximum , count , ScriptHost . Version , eventTimestamp . ToString ( EventTimestamp ) ) ;
4142 }
4243
4344 public void LogFunctionExecutionAggregateEvent ( string siteName , string functionName , long executionTimeInMs , long functionStartedCount , long functionCompletedCount , long functionFailedCount )
@@ -86,49 +87,56 @@ public void LogFunctionExecutionEvent(string executionId, string siteName, int c
8687 WriteEvent ( 57909 , executionId , siteName , concurrency , functionName , invocationId , executionStage , executionTimeSpan , success ) ;
8788 }
8889 }
90+ }
91+
92+ [ EventSource ( Guid = "a7044dd6-c8ef-4980-858c-942d972b6250" ) ]
93+ [ SuppressMessage ( "Microsoft.StyleCop.CSharp.NamingRules" , "SA1306:FieldNamesMustBeginWithLowerCaseLetter" , Justification = "Need to use Pascal Case for MDS column names" ) ]
94+ public class FunctionsSystemLogsEventSource : EventSource
95+ {
96+ internal static readonly FunctionsSystemLogsEventSource Instance = new FunctionsSystemLogsEventSource ( ) ;
8997
90- [ Event ( 65520 , Level = EventLevel . Verbose , Channel = EventChannel . Operational ) ]
91- public void RaiseFunctionsEventVerbose ( string subscriptionId , string appName , string functionName , string eventName , string source , string details , string summary , string hostVersion , string eventTimestamp )
98+ [ Event ( 65520 , Level = EventLevel . Verbose , Channel = EventChannel . Operational , Version = 1 ) ]
99+ public void RaiseFunctionsEventVerbose ( string SubscriptionId , string AppName , string FunctionName , string EventName , string Source , string Details , string Summary , string HostVersion , string EventTimestamp )
92100 {
93101 if ( IsEnabled ( ) )
94102 {
95- WriteEvent ( 65520 , subscriptionId , appName , functionName , eventName , source , details , summary , hostVersion , eventTimestamp ) ;
103+ WriteEvent ( 65520 , SubscriptionId , AppName , FunctionName , EventName , Source , Details , Summary , HostVersion , EventTimestamp ) ;
96104 }
97105 }
98106
99- [ Event ( 65521 , Level = EventLevel . Informational , Channel = EventChannel . Operational ) ]
100- public void RaiseFunctionsEventInfo ( string subscriptionId , string appName , string functionName , string eventName , string source , string details , string summary , string hostVersion , string eventTimestamp )
107+ [ Event ( 65521 , Level = EventLevel . Informational , Channel = EventChannel . Operational , Version = 1 ) ]
108+ public void RaiseFunctionsEventInfo ( string SubscriptionId , string AppName , string FunctionName , string EventName , string Source , string Details , string Summary , string HostVersion , string EventTimestamp )
101109 {
102110 if ( IsEnabled ( ) )
103111 {
104- WriteEvent ( 65521 , subscriptionId , appName , functionName , eventName , source , details , summary , hostVersion , eventTimestamp ) ;
112+ WriteEvent ( 65521 , SubscriptionId , AppName , FunctionName , EventName , Source , Details , Summary , HostVersion , EventTimestamp ) ;
105113 }
106114 }
107115
108- [ Event ( 65522 , Level = EventLevel . Warning , Channel = EventChannel . Operational ) ]
109- public void RaiseFunctionsEventWarning ( string subscriptionId , string appName , string functionName , string eventName , string source , string details , string summary , string hostVersion , string eventTimestamp )
116+ [ Event ( 65522 , Level = EventLevel . Warning , Channel = EventChannel . Operational , Version = 1 ) ]
117+ public void RaiseFunctionsEventWarning ( string SubscriptionId , string AppName , string FunctionName , string EventName , string Source , string Details , string Summary , string HostVersion , string EventTimestamp )
110118 {
111119 if ( IsEnabled ( ) )
112120 {
113- WriteEvent ( 65522 , subscriptionId , appName , functionName , eventName , source , details , summary , hostVersion , eventTimestamp ) ;
121+ WriteEvent ( 65522 , SubscriptionId , AppName , FunctionName , EventName , Source , Details , Summary , HostVersion , EventTimestamp ) ;
114122 }
115123 }
116124
117- [ Event ( 65523 , Level = EventLevel . Error , Channel = EventChannel . Operational ) ]
118- public void RaiseFunctionsEventError ( string subscriptionId , string appName , string functionName , string eventName , string source , string details , string summary , string hostVersion , string eventTimestamp )
125+ [ Event ( 65523 , Level = EventLevel . Error , Channel = EventChannel . Operational , Version = 1 ) ]
126+ public void RaiseFunctionsEventError ( string SubscriptionId , string AppName , string FunctionName , string EventName , string Source , string Details , string Summary , string HostVersion , string EventTimestamp )
119127 {
120128 if ( IsEnabled ( ) )
121129 {
122- WriteEvent ( 65523 , subscriptionId , appName , functionName , eventName , source , details , summary , hostVersion , eventTimestamp ) ;
130+ WriteEvent ( 65523 , SubscriptionId , AppName , FunctionName , EventName , Source , Details , Summary , HostVersion , EventTimestamp ) ;
123131 }
124132 }
125133
126- [ Event ( 65524 , Level = EventLevel . Informational , Channel = EventChannel . Operational ) ]
127- public void LogFunctionMetricEvent ( string subscriptionId , string appName , string eventName , long average , long minimum , long maximum , long count , string hostVersion , string eventTimestamp )
134+ [ Event ( 65524 , Level = EventLevel . Informational , Channel = EventChannel . Operational , Version = 1 ) ]
135+ public void LogFunctionMetricEvent ( string SubscriptionId , string AppName , string EventName , long Average , long Minimum , long Maximum , long Count , string HostVersion , string EventTimestamp )
128136 {
129137 if ( IsEnabled ( ) )
130138 {
131- WriteEvent ( 65524 , subscriptionId , appName , eventName , average , minimum , maximum , count , hostVersion , eventTimestamp ) ;
139+ WriteEvent ( 65524 , SubscriptionId , AppName , EventName , Average , Minimum , Maximum , Count , HostVersion , EventTimestamp ) ;
132140 }
133141 }
134142 }
0 commit comments