@@ -318,54 +318,54 @@ protected override void OnEventCommand(EventCommandEventArgs command)
318318 // This is the convention for initializing counters in the RuntimeEventSource (lazily on the first enable command).
319319 // They aren't disabled afterwards...
320320
321- _connectionsPerSecondCounter ??= new IncrementingPollingCounter ( "connections-per-second" , this , ( ) => _totalConnections )
321+ _connectionsPerSecondCounter ??= new IncrementingPollingCounter ( "connections-per-second" , this , ( ) => Volatile . Read ( ref _totalConnections ) )
322322 {
323323 DisplayName = "Connection Rate" ,
324324 DisplayRateTimeScale = TimeSpan . FromSeconds ( 1 )
325325 } ;
326326
327- _totalConnectionsCounter ??= new PollingCounter ( "total-connections" , this , ( ) => _totalConnections )
327+ _totalConnectionsCounter ??= new PollingCounter ( "total-connections" , this , ( ) => Volatile . Read ( ref _totalConnections ) )
328328 {
329329 DisplayName = "Total Connections" ,
330330 } ;
331331
332- _tlsHandshakesPerSecondCounter ??= new IncrementingPollingCounter ( "tls-handshakes-per-second" , this , ( ) => _totalTlsHandshakes )
332+ _tlsHandshakesPerSecondCounter ??= new IncrementingPollingCounter ( "tls-handshakes-per-second" , this , ( ) => Volatile . Read ( ref _totalTlsHandshakes ) )
333333 {
334334 DisplayName = "TLS Handshake Rate" ,
335335 DisplayRateTimeScale = TimeSpan . FromSeconds ( 1 )
336336 } ;
337337
338- _totalTlsHandshakesCounter ??= new PollingCounter ( "total-tls-handshakes" , this , ( ) => _totalTlsHandshakes )
338+ _totalTlsHandshakesCounter ??= new PollingCounter ( "total-tls-handshakes" , this , ( ) => Volatile . Read ( ref _totalTlsHandshakes ) )
339339 {
340340 DisplayName = "Total TLS Handshakes" ,
341341 } ;
342342
343- _currentTlsHandshakesCounter ??= new PollingCounter ( "current-tls-handshakes" , this , ( ) => _currentTlsHandshakes )
343+ _currentTlsHandshakesCounter ??= new PollingCounter ( "current-tls-handshakes" , this , ( ) => Volatile . Read ( ref _currentTlsHandshakes ) )
344344 {
345345 DisplayName = "Current TLS Handshakes"
346346 } ;
347347
348- _failedTlsHandshakesCounter ??= new PollingCounter ( "failed-tls-handshakes" , this , ( ) => _failedTlsHandshakes )
348+ _failedTlsHandshakesCounter ??= new PollingCounter ( "failed-tls-handshakes" , this , ( ) => Volatile . Read ( ref _failedTlsHandshakes ) )
349349 {
350350 DisplayName = "Failed TLS Handshakes"
351351 } ;
352352
353- _currentConnectionsCounter ??= new PollingCounter ( "current-connections" , this , ( ) => _currentConnections )
353+ _currentConnectionsCounter ??= new PollingCounter ( "current-connections" , this , ( ) => Volatile . Read ( ref _currentConnections ) )
354354 {
355355 DisplayName = "Current Connections"
356356 } ;
357357
358- _connectionQueueLengthCounter ??= new PollingCounter ( "connection-queue-length" , this , ( ) => _connectionQueueLength )
358+ _connectionQueueLengthCounter ??= new PollingCounter ( "connection-queue-length" , this , ( ) => Volatile . Read ( ref _connectionQueueLength ) )
359359 {
360360 DisplayName = "Connection Queue Length"
361361 } ;
362362
363- _httpRequestQueueLengthCounter ??= new PollingCounter ( "request-queue-length" , this , ( ) => _httpRequestQueueLength )
363+ _httpRequestQueueLengthCounter ??= new PollingCounter ( "request-queue-length" , this , ( ) => Volatile . Read ( ref _httpRequestQueueLength ) )
364364 {
365365 DisplayName = "Request Queue Length"
366366 } ;
367367
368- _currrentUpgradedHttpRequestsCounter ??= new PollingCounter ( "current-upgraded-requests" , this , ( ) => _currentUpgradedHttpRequests )
368+ _currrentUpgradedHttpRequestsCounter ??= new PollingCounter ( "current-upgraded-requests" , this , ( ) => Volatile . Read ( ref _currentUpgradedHttpRequests ) )
369369 {
370370 DisplayName = "Current Upgraded Requests (WebSockets)"
371371 } ;
0 commit comments