@@ -12,7 +12,7 @@ internal class EventGenerator : IEventGenerator
12
12
{
13
13
private const string EventTimestamp = "MM/dd/yyyy hh:mm:ss.fff tt" ;
14
14
15
- public void LogFunctionTraceEvent ( TraceLevel level , string subscriptionId , string appName , string functionName , string eventName , string source , string details , string summary )
15
+ public void LogFunctionTraceEvent ( TraceLevel level , string subscriptionId , string appName , string functionName , string eventName , string source , string details , string summary , string exceptionType , string exceptionMessage )
16
16
{
17
17
string eventTimestamp = DateTime . UtcNow . ToString ( EventTimestamp ) ;
18
18
switch ( level )
@@ -27,7 +27,7 @@ public void LogFunctionTraceEvent(TraceLevel level, string subscriptionId, strin
27
27
FunctionsSystemLogsEventSource . Instance . RaiseFunctionsEventWarning ( subscriptionId , appName , functionName , eventName , source , details , summary , ScriptHost . Version , eventTimestamp ) ;
28
28
break ;
29
29
case TraceLevel . Error :
30
- FunctionsSystemLogsEventSource . Instance . RaiseFunctionsEventError ( subscriptionId , appName , functionName , eventName , source , details , summary , ScriptHost . Version , eventTimestamp ) ;
30
+ FunctionsSystemLogsEventSource . Instance . RaiseFunctionsEventError ( subscriptionId , appName , functionName , eventName , source , details , summary , ScriptHost . Version , eventTimestamp , exceptionType , exceptionMessage ) ;
31
31
break ;
32
32
}
33
33
}
@@ -148,7 +148,7 @@ protected void WriteEvent(int eventNum, string a, string b, int c, string d, str
148
148
}
149
149
}
150
150
151
- // RaiseFunctionsEventVerbose/Info/Warning/Error
151
+ // RaiseFunctionsEventVerbose/Info/Warning
152
152
[ NonEvent ]
153
153
protected void WriteEvent ( int eventNum , string a , string b , string c , string d , string e , string f , string g , string h , string i )
154
154
{
@@ -187,6 +187,50 @@ protected void WriteEvent(int eventNum, string a, string b, string c, string d,
187
187
}
188
188
}
189
189
190
+ // RaiseFunctionsEventError
191
+ [ NonEvent ]
192
+ protected void WriteEvent ( int eventNum , string a , string b , string c , string d , string e , string f , string g , string h , string i , string j , string k )
193
+ {
194
+ const int count = 11 ;
195
+ fixed ( char * aPtr = a ,
196
+ bPtr = b ,
197
+ cPtr = c ,
198
+ dPtr = d ,
199
+ ePtr = e ,
200
+ fPtr = f ,
201
+ gPtr = g ,
202
+ hPtr = h ,
203
+ iPtr = i ,
204
+ jPtr = j ,
205
+ kPtr = k )
206
+ {
207
+ EventData * data = stackalloc EventData [ count ] ;
208
+ data [ 0 ] . DataPointer = ( IntPtr ) aPtr ;
209
+ data [ 0 ] . Size = ( a . Length + 1 ) * sizeof ( char ) ;
210
+ data [ 1 ] . DataPointer = ( IntPtr ) bPtr ;
211
+ data [ 1 ] . Size = ( b . Length + 1 ) * sizeof ( char ) ;
212
+ data [ 2 ] . DataPointer = ( IntPtr ) cPtr ;
213
+ data [ 2 ] . Size = ( c . Length + 1 ) * sizeof ( char ) ;
214
+ data [ 3 ] . DataPointer = ( IntPtr ) dPtr ;
215
+ data [ 3 ] . Size = ( d . Length + 1 ) * sizeof ( char ) ;
216
+ data [ 4 ] . DataPointer = ( IntPtr ) ePtr ;
217
+ data [ 4 ] . Size = ( e . Length + 1 ) * sizeof ( char ) ;
218
+ data [ 5 ] . DataPointer = ( IntPtr ) fPtr ;
219
+ data [ 5 ] . Size = ( f . Length + 1 ) * sizeof ( char ) ;
220
+ data [ 6 ] . DataPointer = ( IntPtr ) gPtr ;
221
+ data [ 6 ] . Size = ( g . Length + 1 ) * sizeof ( char ) ;
222
+ data [ 7 ] . DataPointer = ( IntPtr ) hPtr ;
223
+ data [ 7 ] . Size = ( h . Length + 1 ) * sizeof ( char ) ;
224
+ data [ 8 ] . DataPointer = ( IntPtr ) iPtr ;
225
+ data [ 8 ] . Size = ( i . Length + 1 ) * sizeof ( char ) ;
226
+ data [ 9 ] . DataPointer = ( IntPtr ) jPtr ;
227
+ data [ 9 ] . Size = ( j . Length + 1 ) * sizeof ( char ) ;
228
+ data [ 10 ] . DataPointer = ( IntPtr ) kPtr ;
229
+ data [ 10 ] . Size = ( k . Length + 1 ) * sizeof ( char ) ;
230
+ WriteEventCore ( eventNum , count , data ) ;
231
+ }
232
+ }
233
+
190
234
// LogFunctionMetricEvent
191
235
[ NonEvent ]
192
236
protected void WriteEvent ( int eventNum , string a , string b , string c , string d , long e , long f , long g , long h , string i , string j )
@@ -231,7 +275,7 @@ public class FunctionsEventSource : ExtendedEventSource
231
275
{
232
276
internal static readonly FunctionsEventSource Instance = new FunctionsEventSource ( ) ;
233
277
234
- [ Event ( 57907 , Level = EventLevel . Informational , Channel = EventChannel . Operational ) ]
278
+ [ Event ( 57907 , Level = EventLevel . Informational , Channel = EventChannel . Operational , Keywords = FunctionsKeywords . DefaultMetricsKeyword ) ]
235
279
public void LogFunctionExecutionAggregateEvent ( string siteName , string functionName , ulong executionTimeInMs , ulong functionStartedCount , ulong functionCompletedCount , ulong functionFailedCount )
236
280
{
237
281
if ( IsEnabled ( ) )
@@ -240,7 +284,7 @@ public void LogFunctionExecutionAggregateEvent(string siteName, string functionN
240
284
}
241
285
}
242
286
243
- [ Event ( 57908 , Level = EventLevel . Informational , Channel = EventChannel . Operational ) ]
287
+ [ Event ( 57908 , Level = EventLevel . Informational , Channel = EventChannel . Operational , Keywords = FunctionsKeywords . DefaultMetricsKeyword ) ]
244
288
public void LogFunctionDetailsEvent ( string siteName , string functionName , string inputBindings , string outputBindings , string scriptType , bool isDisabled )
245
289
{
246
290
if ( IsEnabled ( ) )
@@ -249,23 +293,28 @@ public void LogFunctionDetailsEvent(string siteName, string functionName, string
249
293
}
250
294
}
251
295
252
- [ Event ( 57909 , Level = EventLevel . Informational , Channel = EventChannel . Operational ) ]
296
+ [ Event ( 57909 , Level = EventLevel . Informational , Channel = EventChannel . Operational , Keywords = FunctionsKeywords . DefaultMetricsKeyword ) ]
253
297
public void LogFunctionExecutionEvent ( string executionId , string siteName , int concurrency , string functionName , string invocationId , string executionStage , ulong executionTimeSpan , bool success )
254
298
{
255
299
if ( IsEnabled ( ) )
256
300
{
257
301
WriteEvent ( 57909 , executionId , siteName , concurrency , functionName , invocationId , executionStage , executionTimeSpan , success ) ;
258
302
}
259
303
}
304
+
305
+ public class FunctionsKeywords
306
+ {
307
+ public const EventKeywords DefaultMetricsKeyword = unchecked ( ( EventKeywords ) 0x8000000000000000 ) ;
308
+ }
260
309
}
261
310
262
311
[ EventSource ( Guid = "a7044dd6-c8ef-4980-858c-942d972b6250" ) ]
263
- [ SuppressMessage ( "Microsoft.StyleCop.CSharp.NamingRules" , "SA1306 :FieldNamesMustBeginWithLowerCaseLetter" , Justification = "Need to use Pascal Case for MDS column names" ) ]
312
+ [ SuppressMessage ( "Microsoft.StyleCop.CSharp.NamingRules" , "SA1313 :FieldNamesMustBeginWithLowerCaseLetter" , Justification = "Need to use Pascal Case for MDS column names" ) ]
264
313
public class FunctionsSystemLogsEventSource : ExtendedEventSource
265
314
{
266
315
internal static readonly FunctionsSystemLogsEventSource Instance = new FunctionsSystemLogsEventSource ( ) ;
267
316
268
- [ Event ( 65520 , Level = EventLevel . Verbose , Channel = EventChannel . Operational , Version = 1 ) ]
317
+ [ Event ( 65520 , Level = EventLevel . Verbose , Channel = EventChannel . Operational , Version = 2 ) ]
269
318
public void RaiseFunctionsEventVerbose ( string SubscriptionId , string AppName , string FunctionName , string EventName , string Source , string Details , string Summary , string HostVersion , string EventTimestamp )
270
319
{
271
320
if ( IsEnabled ( ) )
@@ -274,7 +323,7 @@ public void RaiseFunctionsEventVerbose(string SubscriptionId, string AppName, st
274
323
}
275
324
}
276
325
277
- [ Event ( 65521 , Level = EventLevel . Informational , Channel = EventChannel . Operational , Version = 1 ) ]
326
+ [ Event ( 65521 , Level = EventLevel . Informational , Channel = EventChannel . Operational , Version = 2 ) ]
278
327
public void RaiseFunctionsEventInfo ( string SubscriptionId , string AppName , string FunctionName , string EventName , string Source , string Details , string Summary , string HostVersion , string EventTimestamp )
279
328
{
280
329
if ( IsEnabled ( ) )
@@ -283,7 +332,7 @@ public void RaiseFunctionsEventInfo(string SubscriptionId, string AppName, strin
283
332
}
284
333
}
285
334
286
- [ Event ( 65522 , Level = EventLevel . Warning , Channel = EventChannel . Operational , Version = 1 ) ]
335
+ [ Event ( 65522 , Level = EventLevel . Warning , Channel = EventChannel . Operational , Version = 2 ) ]
287
336
public void RaiseFunctionsEventWarning ( string SubscriptionId , string AppName , string FunctionName , string EventName , string Source , string Details , string Summary , string HostVersion , string EventTimestamp )
288
337
{
289
338
if ( IsEnabled ( ) )
@@ -292,16 +341,16 @@ public void RaiseFunctionsEventWarning(string SubscriptionId, string AppName, st
292
341
}
293
342
}
294
343
295
- [ Event ( 65523 , Level = EventLevel . Error , Channel = EventChannel . Operational , Version = 1 ) ]
296
- public void RaiseFunctionsEventError ( string SubscriptionId , string AppName , string FunctionName , string EventName , string Source , string Details , string Summary , string HostVersion , string EventTimestamp )
344
+ [ Event ( 65523 , Level = EventLevel . Error , Channel = EventChannel . Operational , Version = 2 ) ]
345
+ public void RaiseFunctionsEventError ( string SubscriptionId , string AppName , string FunctionName , string EventName , string Source , string Details , string Summary , string HostVersion , string EventTimestamp , string InnerExceptionType , string InnerExceptionMessage )
297
346
{
298
347
if ( IsEnabled ( ) )
299
348
{
300
- WriteEvent ( 65523 , SubscriptionId , AppName , FunctionName , EventName , Source , Details , Summary , HostVersion , EventTimestamp ) ;
349
+ WriteEvent ( 65523 , SubscriptionId , AppName , FunctionName , EventName , Source , Details , Summary , HostVersion , EventTimestamp , InnerExceptionType , InnerExceptionMessage ) ;
301
350
}
302
351
}
303
352
304
- [ Event ( 65524 , Level = EventLevel . Informational , Channel = EventChannel . Operational , Version = 1 ) ]
353
+ [ Event ( 65524 , Level = EventLevel . Informational , Channel = EventChannel . Operational , Version = 2 ) ]
305
354
public void LogFunctionMetricEvent ( string SubscriptionId , string AppName , string FunctionName , string EventName , long Average , long Minimum , long Maximum , long Count , string HostVersion , string EventTimestamp )
306
355
{
307
356
if ( IsEnabled ( ) )
@@ -311,4 +360,4 @@ public void LogFunctionMetricEvent(string SubscriptionId, string AppName, string
311
360
}
312
361
}
313
362
}
314
- }
363
+ }
0 commit comments