diff --git a/src/EFCore/Infrastructure/EntityFrameworkMetricsData.cs b/src/EFCore/Infrastructure/EntityFrameworkMetricsData.cs index e3c5edeff6e..5bd6a6aa176 100644 --- a/src/EFCore/Infrastructure/EntityFrameworkMetricsData.cs +++ b/src/EFCore/Infrastructure/EntityFrameworkMetricsData.cs @@ -47,7 +47,7 @@ public static void ReportDbContextDisposing() /// /// Number of currently active instances. /// - public static int GetActiveDbContexts() + internal static int GetActiveDbContexts() => Volatile.Read(ref _activeDbContexts); /// @@ -59,7 +59,7 @@ public static void ReportQueryExecuting() /// /// Cumulative count of queries executed. /// - public static long GetTotalQueriesExecuted() + internal static long GetTotalQueriesExecuted() => Interlocked.Read(ref _totalQueriesExecuted); /// @@ -71,7 +71,7 @@ public static void ReportSavingChanges() /// /// Cumulative count of changes saved. /// - public static long GetTotalSaveChanges() + internal static long GetTotalSaveChanges() => Interlocked.Read(ref _totalSaveChanges); /// @@ -95,7 +95,7 @@ public static void ReportCompiledQueryCacheMiss() /// /// Gets number of hits and misses and also the computed hit rate for the compiled query cache. /// - public static (int hits, int misses, double hitRate) GetCompiledQueryCacheHitRate() + internal static (int hits, int misses, double hitRate) GetCompiledQueryCacheHitRate() => _compiledQueryCacheInfo.CalculateHitsMissesHitRate(false); /// @@ -113,7 +113,7 @@ public static void ReportExecutionStrategyOperationFailure() /// /// Cumulative number of failed operation executed by an . /// - public static long GetTotalExecutionStrategyOperationFailures() + internal static long GetTotalExecutionStrategyOperationFailures() => Interlocked.Read(ref _totalExecutionStrategyOperationFailures); /// @@ -125,7 +125,7 @@ public static void ReportOptimisticConcurrencyFailure() /// /// Cumulative number of optimistic concurrency failures. /// - public static long GetTotalOptimisticConcurrencyFailures() + internal static long GetTotalOptimisticConcurrencyFailures() => Interlocked.Read(ref _totalOptimisticConcurrencyFailures); [StructLayout(LayoutKind.Explicit)]