Example #1
0
 public static void FunctionStarted(FunctionStartedEvent startedEvent)
 {
     lock (functionActivityTrackerLockObject)
     {
         if (instance == null)
         {
             instance = new FunctionActivityTracker();
         }
         instance.FunctionStarted(startedEvent);
     }
 }
 internal void FunctionStarted(FunctionStartedEvent startedEvent)
 {
     lock (_functionActivityTrackerLockObject)
     {
         if (instance == null)
         {
             instance = new FunctionActivityTracker(_eventGenerator, _functionActivityFlushIntervalSeconds);
         }
         instance.FunctionStarted(startedEvent);
     }
 }
 public static void FunctionStarted(FunctionStartedEvent startedEvent)
 {
     lock (functionActivityTrackerLockObject)
     {
         if (instance == null)
         {
             instance = new FunctionActivityTracker();
         }
         instance.FunctionStarted(startedEvent);
     }
 }
Example #4
0
 internal void FunctionStarted(FunctionStartedEvent startedEvent)
 {
     lock (_functionActivityTrackerLockObject)
     {
         if (instance == null)
         {
             instance = new FunctionActivityTracker(_appServiceOptions, _eventGenerator, _metricsPublisher,
                                                    _linuxContainerActivityPublisher, _functionActivityFlushIntervalSeconds);
         }
         instance.FunctionStarted(startedEvent);
     }
 }
Example #5
0
        public MetricsEventManager(IOptionsMonitor <AppServiceOptions> appServiceOptions, IEventGenerator generator, int functionActivityFlushIntervalSeconds, IMetricsPublisher metricsPublisher, ILinuxContainerActivityPublisher linuxContainerActivityPublisher, ILogger <MetricsEventManager> logger, int metricsFlushIntervalMS = DefaultFlushIntervalMS)
        {
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            // we read these in the ctor (not static ctor) since it can change on the fly
            _appServiceOptions = appServiceOptions;
            _eventGenerator    = generator;
            _functionActivityFlushIntervalSeconds = functionActivityFlushIntervalSeconds;
            QueuedEvents = new ConcurrentDictionary <string, SystemMetricEvent>(StringComparer.OrdinalIgnoreCase);

            // Initialize the periodic log flush timer
            _metricsFlushTimer = new Timer(TimerFlush, null, metricsFlushIntervalMS, metricsFlushIntervalMS);

            _functionActivityTracker = new FunctionActivityTracker(_appServiceOptions, _eventGenerator, metricsPublisher, linuxContainerActivityPublisher, _functionActivityFlushIntervalSeconds, _logger);
        }
 internal void FunctionCompleted(FunctionStartedEvent completedEvent)
 {
     lock (_functionActivityTrackerLockObject)
     {
         if (instance != null)
         {
             instance.FunctionCompleted(completedEvent);
             if (!instance.IsActive)
             {
                 instance.StopEtwTaskAndRaiseFinishedEvent();
                 instance = null;
             }
         }
     }
 }
 public static void FunctionCompleted(FunctionStartedEvent completedEvent)
 {
     lock (functionActivityTrackerLockObject)
     {
         if (instance != null)
         {
             instance.FunctionCompleted(completedEvent);
             if (!instance.IsActive)
             {
                 instance.StopEtwTaskAndRaiseFinishedEvent();
                 instance = null;
             }
         }
     }
 }
 internal void FunctionStarted(FunctionStartedEvent startedEvent)
 {
     lock (_functionActivityTrackerLockObject)
     {
         if (instance == null)
         {
             instance = new FunctionActivityTracker(_eventGenerator, _functionActivityFlushIntervalSeconds);
         }
         instance.FunctionStarted(startedEvent);
     }
 }