15
15
namespace Microsoft . Azure . WebJobs . Script . WebHost . Diagnostics
16
16
{
17
17
public class MetricsEventManager : IDisposable
18
- {
18
+ {
19
19
private static FunctionActivityTracker instance = null ;
20
20
private readonly IEventGenerator _eventGenerator ;
21
21
private readonly int _functionActivityFlushIntervalSeconds ;
@@ -31,7 +31,7 @@ public class MetricsEventManager : IDisposable
31
31
public MetricsEventManager ( ScriptSettingsManager settingsManager , IEventGenerator generator , int functionActivityFlushIntervalSeconds , int metricsFlushIntervalMS = DefaultFlushIntervalMS )
32
32
{
33
33
// we read these in the ctor (not static ctor) since it can change on the fly
34
- appName = GetNormalizedString ( settingsManager . GetSetting ( EnvironmentSettingNames . AzureWebsiteName ) ) ?? string . Empty ;
34
+ appName = GetNormalizedString ( settingsManager . AzureWebsiteDefaultSubdomain ) ;
35
35
subscriptionId = Utility . GetSubscriptionId ( ) ?? string . Empty ;
36
36
37
37
_eventGenerator = generator ;
@@ -74,7 +74,7 @@ public void EndEvent(object eventHandle)
74
74
evt . Duration = DateTime . UtcNow - evt . Timestamp ;
75
75
long latencyMS = ( long ) evt . Duration . TotalMilliseconds ;
76
76
77
- QueuedEvents . AddOrUpdate ( evt . EventName ,
77
+ QueuedEvents . AddOrUpdate ( evt . EventName ,
78
78
( name ) =>
79
79
{
80
80
// create the default event that will be added
@@ -87,7 +87,7 @@ public void EndEvent(object eventHandle)
87
87
Average = latencyMS ,
88
88
Count = 1
89
89
} ;
90
- } ,
90
+ } ,
91
91
( name , evtToUpdate ) =>
92
92
{
93
93
// Aggregate into the existing event
@@ -110,7 +110,7 @@ public void LogEvent(string eventName)
110
110
throw new ArgumentNullException ( nameof ( eventName ) ) ;
111
111
}
112
112
113
- QueuedEvents . AddOrUpdate ( eventName ,
113
+ QueuedEvents . AddOrUpdate ( eventName ,
114
114
( name ) =>
115
115
{
116
116
// create the default event that will be added
@@ -120,7 +120,7 @@ public void LogEvent(string eventName)
120
120
EventName = eventName . ToLowerInvariant ( ) ,
121
121
Count = 1
122
122
} ;
123
- } ,
123
+ } ,
124
124
( name , evtToUpdate ) =>
125
125
{
126
126
// update the existing event
@@ -180,7 +180,7 @@ internal void HostStarted(ScriptHost scriptHost)
180
180
? SerializeBindings ( function . Metadata . InputBindings )
181
181
: GetNormalizedString ( null ) ,
182
182
function . Metadata != null
183
- ? SerializeBindings ( function . Metadata . OutputBindings )
183
+ ? SerializeBindings ( function . Metadata . OutputBindings )
184
184
: GetNormalizedString ( null ) ,
185
185
function . Metadata . ScriptType . ToString ( ) ,
186
186
function . Metadata != null ? function . Metadata . IsDisabled : false ) ;
@@ -278,7 +278,7 @@ internal FunctionActivityTracker(IEventGenerator generator, int functionActivity
278
278
while ( ! _etwTaskCancellationSource . Token . IsCancellationRequested )
279
279
{
280
280
RaiseMetricsPerFunctionEvent ( ) ;
281
-
281
+
282
282
if ( currentSecond >= _functionActivityFlushInterval )
283
283
{
284
284
RaiseFunctionMetricEvents ( ) ;
@@ -300,7 +300,7 @@ internal FunctionActivityTracker(IEventGenerator generator, int functionActivity
300
300
} ,
301
301
_etwTaskCancellationSource . Token ) ;
302
302
}
303
-
303
+
304
304
internal bool IsActive
305
305
{
306
306
get
@@ -309,12 +309,12 @@ internal bool IsActive
309
309
}
310
310
}
311
311
312
- internal IEventGenerator MetricsEventGenerator { get ; private set ; }
312
+ internal IEventGenerator MetricsEventGenerator { get ; private set ; }
313
313
314
314
protected virtual void Dispose ( bool disposing )
315
315
{
316
316
if ( disposing )
317
- {
317
+ {
318
318
_etwTaskCancellationSource . Dispose ( ) ;
319
319
}
320
320
}
@@ -458,7 +458,7 @@ private List<FunctionMetrics> GetMetricsQueueSnapshot()
458
458
}
459
459
460
460
private class RunningFunctionInfo
461
- {
461
+ {
462
462
public RunningFunctionInfo ( string name , Guid invocationId , DateTime startTime , bool success , ExecutionStage executionStage = ExecutionStage . InProgress )
463
463
{
464
464
Name = name ;
0 commit comments