diff --git a/eng/Dependencies.props b/eng/Dependencies.props
index 663aca404a22..0413b558a486 100644
--- a/eng/Dependencies.props
+++ b/eng/Dependencies.props
@@ -40,6 +40,8 @@ and are generated based on the last package release.
+
+
diff --git a/eng/SharedFramework.External.props b/eng/SharedFramework.External.props
index 2f7d2bdc3786..175c7848407a 100644
--- a/eng/SharedFramework.External.props
+++ b/eng/SharedFramework.External.props
@@ -21,6 +21,8 @@
+
+
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index e4dab862f9de..c251f994225a 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -41,280 +41,288 @@
https://github.com/dotnet/efcore
d3362f65007769fd1c8ef442743832d91c7a34cb
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
+
+
+ https://github.com/dotnet/runtime
+ 7cf329b773fa5ed544a9377587018713751c73e3
+
+
+ https://github.com/dotnet/runtime
+ 7cf329b773fa5ed544a9377587018713751c73e3
https://github.com/dotnet/source-build-externals
21d564f9e16f7986d8af0692258afb91a52dda80
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
https://github.com/dotnet/xdt
@@ -347,9 +355,9 @@
-
+
https://github.com/dotnet/runtime
- 1e421670a6456d9c5b924b7ffea14cab8559a2e9
+ 7cf329b773fa5ed544a9377587018713751c73e3
https://github.com/dotnet/arcade
diff --git a/eng/Versions.props b/eng/Versions.props
index 7d56ded18825..58ca8ed98253 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -63,75 +63,77 @@
-->
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
- 8.0.0-preview.5.23273.1
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
+ 8.0.0-preview.5.23274.13
8.0.0-preview.6.23273.4
8.0.0-preview.6.23273.4
diff --git a/src/Framework/test/TestData.cs b/src/Framework/test/TestData.cs
index 98de16bb3587..5e665cc06516 100644
--- a/src/Framework/test/TestData.cs
+++ b/src/Framework/test/TestData.cs
@@ -119,6 +119,8 @@ static TestData()
"Microsoft.Extensions.Configuration.Xml",
"Microsoft.Extensions.DependencyInjection",
"Microsoft.Extensions.DependencyInjection.Abstractions",
+ "Microsoft.Extensions.Diagnostics",
+ "Microsoft.Extensions.Diagnostics.Abstractions",
"Microsoft.Extensions.Diagnostics.HealthChecks",
"Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions",
"Microsoft.Extensions.FileProviders.Abstractions",
@@ -268,6 +270,8 @@ static TestData()
{ "Microsoft.Extensions.Configuration" },
{ "Microsoft.Extensions.DependencyInjection.Abstractions" },
{ "Microsoft.Extensions.DependencyInjection" },
+ { "Microsoft.Extensions.Diagnostics.Abstractions" },
+ { "Microsoft.Extensions.Diagnostics" },
{ "Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" },
{ "Microsoft.Extensions.Diagnostics.HealthChecks" },
{ "Microsoft.Extensions.Features" },
diff --git a/src/Hosting/Hosting/src/GenericHost/GenericWebHostBuilder.cs b/src/Hosting/Hosting/src/GenericHost/GenericWebHostBuilder.cs
index c4c5488e958e..45c7a0215aa6 100644
--- a/src/Hosting/Hosting/src/GenericHost/GenericWebHostBuilder.cs
+++ b/src/Hosting/Hosting/src/GenericHost/GenericWebHostBuilder.cs
@@ -14,6 +14,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.Extensions.Diagnostics.Metrics;
using Microsoft.Extensions.Hosting;
namespace Microsoft.AspNetCore.Hosting;
diff --git a/src/Hosting/Hosting/src/GenericHost/SlimWebHostBuilder.cs b/src/Hosting/Hosting/src/GenericHost/SlimWebHostBuilder.cs
index ff99aed202a7..693f39a497c7 100644
--- a/src/Hosting/Hosting/src/GenericHost/SlimWebHostBuilder.cs
+++ b/src/Hosting/Hosting/src/GenericHost/SlimWebHostBuilder.cs
@@ -11,6 +11,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.Extensions.Diagnostics.Metrics;
using Microsoft.Extensions.Hosting;
namespace Microsoft.AspNetCore.Hosting;
diff --git a/src/Hosting/Hosting/src/Internal/HostingMetrics.cs b/src/Hosting/Hosting/src/Internal/HostingMetrics.cs
index 87d3ddf796e5..5ab7ed20737e 100644
--- a/src/Hosting/Hosting/src/Internal/HostingMetrics.cs
+++ b/src/Hosting/Hosting/src/Internal/HostingMetrics.cs
@@ -5,7 +5,7 @@
using System.Diagnostics;
using System.Diagnostics.Metrics;
using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Metrics;
+using Microsoft.Extensions.Diagnostics.Metrics;
namespace Microsoft.AspNetCore.Hosting;
@@ -19,7 +19,7 @@ internal sealed class HostingMetrics : IDisposable
public HostingMetrics(IMeterFactory meterFactory)
{
- _meter = meterFactory.CreateMeter(MeterName);
+ _meter = meterFactory.Create(MeterName);
_currentRequestsCounter = _meter.CreateUpDownCounter(
"current-requests",
diff --git a/src/Hosting/Hosting/src/Microsoft.AspNetCore.Hosting.csproj b/src/Hosting/Hosting/src/Microsoft.AspNetCore.Hosting.csproj
index d981ca6501fb..49974f5104af 100644
--- a/src/Hosting/Hosting/src/Microsoft.AspNetCore.Hosting.csproj
+++ b/src/Hosting/Hosting/src/Microsoft.AspNetCore.Hosting.csproj
@@ -25,6 +25,7 @@
+
diff --git a/src/Hosting/Hosting/src/WebHostBuilder.cs b/src/Hosting/Hosting/src/WebHostBuilder.cs
index f21d3593697e..aff8235a7b80 100644
--- a/src/Hosting/Hosting/src/WebHostBuilder.cs
+++ b/src/Hosting/Hosting/src/WebHostBuilder.cs
@@ -12,6 +12,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.Extensions.Diagnostics.Metrics;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
diff --git a/src/Hosting/Hosting/test/HostingApplicationDiagnosticsTests.cs b/src/Hosting/Hosting/test/HostingApplicationDiagnosticsTests.cs
index b42bb72e1bce..e58eda72de6b 100644
--- a/src/Hosting/Hosting/test/HostingApplicationDiagnosticsTests.cs
+++ b/src/Hosting/Hosting/test/HostingApplicationDiagnosticsTests.cs
@@ -2,13 +2,15 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
+using System.Diagnostics.Metrics;
using System.Diagnostics.Tracing;
using System.Reflection;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Internal;
+using Microsoft.AspNetCore.Testing;
+using Microsoft.Extensions.Diagnostics.Metrics;
using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Metrics;
using Moq;
namespace Microsoft.AspNetCore.Hosting.Tests;
@@ -44,17 +46,15 @@ public async Task EventCountersAndMetricsValues()
});
var testMeterFactory1 = new TestMeterFactory();
- var testMeterRegister1 = new TestMeterRegistry(testMeterFactory1.Meters);
var testMeterFactory2 = new TestMeterFactory();
- var testMeterRegister2 = new TestMeterRegistry(testMeterFactory2.Meters);
var hostingApplication1 = CreateApplication(out var features1, eventSource: hostingEventSource, meterFactory: testMeterFactory1);
var hostingApplication2 = CreateApplication(out var features2, eventSource: hostingEventSource, meterFactory: testMeterFactory2);
- using var currentRequestsRecorder1 = new InstrumentRecorder(testMeterRegister1, HostingMetrics.MeterName, "current-requests");
- using var currentRequestsRecorder2 = new InstrumentRecorder(testMeterRegister2, HostingMetrics.MeterName, "current-requests");
- using var requestDurationRecorder1 = new InstrumentRecorder(testMeterRegister1, HostingMetrics.MeterName, "request-duration");
- using var requestDurationRecorder2 = new InstrumentRecorder(testMeterRegister2, HostingMetrics.MeterName, "request-duration");
+ using var currentRequestsRecorder1 = new InstrumentRecorder(testMeterFactory1, HostingMetrics.MeterName, "current-requests");
+ using var currentRequestsRecorder2 = new InstrumentRecorder(testMeterFactory2, HostingMetrics.MeterName, "current-requests");
+ using var requestDurationRecorder1 = new InstrumentRecorder(testMeterFactory1, HostingMetrics.MeterName, "request-duration");
+ using var requestDurationRecorder2 = new InstrumentRecorder(testMeterFactory2, HostingMetrics.MeterName, "request-duration");
// Act/Assert 1
var context1 = hostingApplication1.CreateContext(features1);
diff --git a/src/Hosting/Hosting/test/HostingApplicationTests.cs b/src/Hosting/Hosting/test/HostingApplicationTests.cs
index f3882d917f9e..37a0fe85ca15 100644
--- a/src/Hosting/Hosting/test/HostingApplicationTests.cs
+++ b/src/Hosting/Hosting/test/HostingApplicationTests.cs
@@ -2,17 +2,14 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections;
-using System.Collections.ObjectModel;
using System.Diagnostics;
-using System.Diagnostics.Metrics;
-using Microsoft.AspNetCore.Hosting.Fakes;
using Microsoft.AspNetCore.Hosting.Server.Abstractions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Diagnostics.Metrics;
using Microsoft.Extensions.Logging.Abstractions;
-using Microsoft.Extensions.Metrics;
using Moq;
using static Microsoft.AspNetCore.Hosting.HostingApplication;
diff --git a/src/Hosting/Hosting/test/HostingMetricsTests.cs b/src/Hosting/Hosting/test/HostingMetricsTests.cs
index 72877540bce7..bbea161096ca 100644
--- a/src/Hosting/Hosting/test/HostingMetricsTests.cs
+++ b/src/Hosting/Hosting/test/HostingMetricsTests.cs
@@ -9,8 +9,8 @@
using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Diagnostics.Metrics;
using Microsoft.Extensions.Logging.Abstractions;
-using Microsoft.Extensions.Metrics;
namespace Microsoft.AspNetCore.Hosting.Tests;
@@ -21,13 +21,12 @@ public void MultipleRequests()
{
// Arrange
var meterFactory = new TestMeterFactory();
- var meterRegistry = new TestMeterRegistry(meterFactory.Meters);
var hostingApplication = CreateApplication(meterFactory: meterFactory);
var httpContext = new DefaultHttpContext();
var meter = meterFactory.Meters.Single();
- using var requestDurationRecorder = new InstrumentRecorder(meterRegistry, HostingMetrics.MeterName, "request-duration");
- using var currentRequestsRecorder = new InstrumentRecorder(meterRegistry, HostingMetrics.MeterName, "current-requests");
+ using var requestDurationRecorder = new InstrumentRecorder(meterFactory, HostingMetrics.MeterName, "request-duration");
+ using var currentRequestsRecorder = new InstrumentRecorder(meterFactory, HostingMetrics.MeterName, "current-requests");
// Act/Assert
Assert.Equal(HostingMetrics.MeterName, meter.Name);
@@ -111,7 +110,6 @@ public async Task StartListeningDuringRequest_NotMeasured()
// Arrange
var syncPoint = new SyncPoint();
var meterFactory = new TestMeterFactory();
- var meterRegistry = new TestMeterRegistry(meterFactory.Meters);
var hostingApplication = CreateApplication(meterFactory: meterFactory, requestDelegate: async ctx =>
{
await syncPoint.WaitToContinue();
@@ -130,8 +128,8 @@ public async Task StartListeningDuringRequest_NotMeasured()
await syncPoint.WaitForSyncPoint().DefaultTimeout();
- using var requestDurationRecorder = new InstrumentRecorder(meterRegistry, HostingMetrics.MeterName, "request-duration");
- using var currentRequestsRecorder = new InstrumentRecorder(meterRegistry, HostingMetrics.MeterName, "current-requests");
+ using var requestDurationRecorder = new InstrumentRecorder(meterFactory, HostingMetrics.MeterName, "request-duration");
+ using var currentRequestsRecorder = new InstrumentRecorder(meterFactory, HostingMetrics.MeterName, "current-requests");
context1.HttpContext.Response.StatusCode = StatusCodes.Status200OK;
syncPoint.Continue();
@@ -148,13 +146,12 @@ public void IHttpMetricsTagsFeatureNotUsedFromFeatureCollection()
{
// Arrange
var meterFactory = new TestMeterFactory();
- var meterRegistry = new TestMeterRegistry(meterFactory.Meters);
var hostingApplication = CreateApplication(meterFactory: meterFactory);
var httpContext = new DefaultHttpContext();
var meter = meterFactory.Meters.Single();
- using var requestDurationRecorder = new InstrumentRecorder(meterRegistry, HostingMetrics.MeterName, "request-duration");
- using var currentRequestsRecorder = new InstrumentRecorder(meterRegistry, HostingMetrics.MeterName, "current-requests");
+ using var requestDurationRecorder = new InstrumentRecorder(meterFactory, HostingMetrics.MeterName, "request-duration");
+ using var currentRequestsRecorder = new InstrumentRecorder(meterFactory, HostingMetrics.MeterName, "current-requests");
// Act/Assert
Assert.Equal(HostingMetrics.MeterName, meter.Name);
diff --git a/src/Hosting/Hosting/test/Microsoft.AspNetCore.Hosting.Tests.csproj b/src/Hosting/Hosting/test/Microsoft.AspNetCore.Hosting.Tests.csproj
index 25a94cfc96a3..0fc87b4ba5c3 100644
--- a/src/Hosting/Hosting/test/Microsoft.AspNetCore.Hosting.Tests.csproj
+++ b/src/Hosting/Hosting/test/Microsoft.AspNetCore.Hosting.Tests.csproj
@@ -8,6 +8,7 @@
+
diff --git a/src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj b/src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj
index da6077afa1e8..6c763eeb07f6 100644
--- a/src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj
+++ b/src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj
@@ -54,29 +54,6 @@ Microsoft.AspNetCore.Http.HttpResponse
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Middleware/Diagnostics/test/UnitTests/DeveloperExceptionPageMiddlewareTest.cs b/src/Middleware/Diagnostics/test/UnitTests/DeveloperExceptionPageMiddlewareTest.cs
index ba3f469038e0..24a1ced4f4a5 100644
--- a/src/Middleware/Diagnostics/test/UnitTests/DeveloperExceptionPageMiddlewareTest.cs
+++ b/src/Middleware/Diagnostics/test/UnitTests/DeveloperExceptionPageMiddlewareTest.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
+using System.Diagnostics.Metrics;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
@@ -14,8 +15,8 @@
using Microsoft.AspNetCore.TestHost;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Diagnostics.Metrics;
using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Metrics;
namespace Microsoft.AspNetCore.Diagnostics;
@@ -540,9 +541,9 @@ public async Task UnhandledError_ExceptionNameTagAdded()
var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
var meterFactory = new TestMeterFactory();
- var meterRegistry = new TestMeterRegistry(meterFactory.Meters);
- var instrumentRecorder = new InstrumentRecorder(meterRegistry, "Microsoft.AspNetCore.Hosting", "request-duration");
- instrumentRecorder.Register(m =>
+ using var instrumentRecorder = new InstrumentRecorder(meterFactory, "Microsoft.AspNetCore.Hosting", "request-duration");
+ using var measurementReporter = new MeasurementReporter(meterFactory, "Microsoft.AspNetCore.Hosting", "request-duration");
+ measurementReporter.Register(m =>
{
tcs.SetResult();
});
diff --git a/src/Middleware/Diagnostics/test/UnitTests/ExceptionHandlerTest.cs b/src/Middleware/Diagnostics/test/UnitTests/ExceptionHandlerTest.cs
index 6b9cc6f9e42b..725343f8c0b3 100644
--- a/src/Middleware/Diagnostics/test/UnitTests/ExceptionHandlerTest.cs
+++ b/src/Middleware/Diagnostics/test/UnitTests/ExceptionHandlerTest.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
+using System.Diagnostics.Metrics;
using System.Net;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@@ -9,10 +10,10 @@
using Microsoft.AspNetCore.TestHost;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Diagnostics.Metrics;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
-using Microsoft.Extensions.Metrics;
namespace Microsoft.AspNetCore.Diagnostics;
@@ -917,9 +918,9 @@ public async Task UnhandledError_ExceptionNameTagAdded()
var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
var meterFactory = new TestMeterFactory();
- var meterRegistry = new TestMeterRegistry(meterFactory.Meters);
- var instrumentRecorder = new InstrumentRecorder(meterRegistry, "Microsoft.AspNetCore.Hosting", "request-duration");
- instrumentRecorder.Register(m =>
+ using var instrumentRecorder = new InstrumentRecorder(meterFactory, "Microsoft.AspNetCore.Hosting", "request-duration");
+ using var measurementReporter = new MeasurementReporter(meterFactory, "Microsoft.AspNetCore.Hosting", "request-duration");
+ measurementReporter.Register(m =>
{
tcs.SetResult();
});
diff --git a/src/Middleware/Diagnostics/test/UnitTests/Microsoft.AspNetCore.Diagnostics.Tests.csproj b/src/Middleware/Diagnostics/test/UnitTests/Microsoft.AspNetCore.Diagnostics.Tests.csproj
index b0a4f171d50f..d01bdacc7058 100644
--- a/src/Middleware/Diagnostics/test/UnitTests/Microsoft.AspNetCore.Diagnostics.Tests.csproj
+++ b/src/Middleware/Diagnostics/test/UnitTests/Microsoft.AspNetCore.Diagnostics.Tests.csproj
@@ -11,6 +11,8 @@
+
+
diff --git a/src/Middleware/RateLimiting/src/Microsoft.AspNetCore.RateLimiting.csproj b/src/Middleware/RateLimiting/src/Microsoft.AspNetCore.RateLimiting.csproj
index 27ac36e46a85..a15b1fe9bf8c 100644
--- a/src/Middleware/RateLimiting/src/Microsoft.AspNetCore.RateLimiting.csproj
+++ b/src/Middleware/RateLimiting/src/Microsoft.AspNetCore.RateLimiting.csproj
@@ -14,6 +14,7 @@
+
diff --git a/src/Middleware/RateLimiting/src/RateLimiterServiceCollectionExtensions.cs b/src/Middleware/RateLimiting/src/RateLimiterServiceCollectionExtensions.cs
index 09f6f7ba7c5c..404f6a5e9b8c 100644
--- a/src/Middleware/RateLimiting/src/RateLimiterServiceCollectionExtensions.cs
+++ b/src/Middleware/RateLimiting/src/RateLimiterServiceCollectionExtensions.cs
@@ -3,6 +3,7 @@
using Microsoft.AspNetCore.RateLimiting;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Diagnostics.Metrics;
namespace Microsoft.AspNetCore.Builder;
diff --git a/src/Middleware/RateLimiting/src/RateLimitingMetrics.cs b/src/Middleware/RateLimiting/src/RateLimitingMetrics.cs
index 96d69256eea3..e06d8c405487 100644
--- a/src/Middleware/RateLimiting/src/RateLimitingMetrics.cs
+++ b/src/Middleware/RateLimiting/src/RateLimitingMetrics.cs
@@ -4,7 +4,7 @@
using System.Diagnostics;
using System.Diagnostics.Metrics;
using System.Runtime.CompilerServices;
-using Microsoft.Extensions.Metrics;
+using Microsoft.Extensions.Diagnostics.Metrics;
namespace Microsoft.AspNetCore.RateLimiting;
@@ -21,7 +21,7 @@ internal sealed class RateLimitingMetrics : IDisposable
public RateLimitingMetrics(IMeterFactory meterFactory)
{
- _meter = meterFactory.CreateMeter(MeterName);
+ _meter = meterFactory.Create(MeterName);
_currentLeasedRequestsCounter = _meter.CreateUpDownCounter(
"current-leased-requests",
diff --git a/src/Middleware/RateLimiting/test/Microsoft.AspNetCore.RateLimiting.Tests.csproj b/src/Middleware/RateLimiting/test/Microsoft.AspNetCore.RateLimiting.Tests.csproj
index 22890a28eae9..7a307f93db64 100644
--- a/src/Middleware/RateLimiting/test/Microsoft.AspNetCore.RateLimiting.Tests.csproj
+++ b/src/Middleware/RateLimiting/test/Microsoft.AspNetCore.RateLimiting.Tests.csproj
@@ -9,6 +9,7 @@
-
+
+
diff --git a/src/Middleware/RateLimiting/test/RateLimitingMetricsTests.cs b/src/Middleware/RateLimiting/test/RateLimitingMetricsTests.cs
index 9f5f7388daf9..03b054d50725 100644
--- a/src/Middleware/RateLimiting/test/RateLimitingMetricsTests.cs
+++ b/src/Middleware/RateLimiting/test/RateLimitingMetricsTests.cs
@@ -10,9 +10,9 @@
using Microsoft.AspNetCore.Routing.Patterns;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Diagnostics.Metrics;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
-using Microsoft.Extensions.Metrics;
using Microsoft.Extensions.Options;
using Moq;
@@ -25,7 +25,6 @@ public async Task Metrics_Rejected()
{
// Arrange
var meterFactory = new TestMeterFactory();
- var meterRegistry = new TestMeterRegistry(meterFactory.Meters);
var options = CreateOptionsAccessor();
options.Value.GlobalLimiter = new TestPartitionedRateLimiter(new TestRateLimiter(false));
@@ -35,11 +34,11 @@ public async Task Metrics_Rejected()
var context = new DefaultHttpContext();
- using var leaseRequestDurationRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "leased-request-duration");
- using var currentLeaseRequestsRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "current-leased-requests");
- using var currentRequestsQueuedRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "current-queued-requests");
- using var queuedRequestDurationRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "queued-request-duration");
- using var leaseFailedRequestsRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "lease-failed-requests");
+ using var leaseRequestDurationRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "leased-request-duration");
+ using var currentLeaseRequestsRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "current-leased-requests");
+ using var currentRequestsQueuedRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "current-queued-requests");
+ using var queuedRequestDurationRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "queued-request-duration");
+ using var leaseFailedRequestsRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "lease-failed-requests");
// Act
await middleware.Invoke(context).DefaultTimeout();
@@ -66,7 +65,6 @@ public async Task Metrics_Success()
var syncPoint = new SyncPoint();
var meterFactory = new TestMeterFactory();
- var meterRegistry = new TestMeterRegistry(meterFactory.Meters);
var options = CreateOptionsAccessor();
options.Value.GlobalLimiter = new TestPartitionedRateLimiter(new TestRateLimiter(true));
@@ -83,11 +81,11 @@ public async Task Metrics_Success()
var context = new DefaultHttpContext();
context.Request.Method = "GET";
- using var leaseRequestDurationRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "leased-request-duration");
- using var currentLeaseRequestsRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "current-leased-requests");
- using var currentRequestsQueuedRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "current-queued-requests");
- using var queuedRequestDurationRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "queued-request-duration");
- using var leaseFailedRequestsRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "lease-failed-requests");
+ using var leaseRequestDurationRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "leased-request-duration");
+ using var currentLeaseRequestsRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "current-leased-requests");
+ using var currentRequestsQueuedRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "current-queued-requests");
+ using var queuedRequestDurationRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "queued-request-duration");
+ using var leaseFailedRequestsRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "lease-failed-requests");
// Act
var middlewareTask = middleware.Invoke(context);
@@ -122,7 +120,6 @@ public async Task Metrics_ListenInMiddleOfRequest_CurrentLeasesNotDecreased()
var syncPoint = new SyncPoint();
var meterFactory = new TestMeterFactory();
- var meterRegistry = new TestMeterRegistry(meterFactory.Meters);
var options = CreateOptionsAccessor();
options.Value.GlobalLimiter = new TestPartitionedRateLimiter(new TestRateLimiter(true));
@@ -144,11 +141,11 @@ public async Task Metrics_ListenInMiddleOfRequest_CurrentLeasesNotDecreased()
await syncPoint.WaitForSyncPoint().DefaultTimeout();
- using var leaseRequestDurationRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "leased-request-duration");
- using var currentLeaseRequestsRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "current-leased-requests");
- using var currentRequestsQueuedRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "current-queued-requests");
- using var queuedRequestDurationRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "queued-request-duration");
- using var leaseFailedRequestsRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "lease-failed-requests");
+ using var leaseRequestDurationRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "leased-request-duration");
+ using var currentLeaseRequestsRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "current-leased-requests");
+ using var currentRequestsQueuedRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "current-queued-requests");
+ using var queuedRequestDurationRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "queued-request-duration");
+ using var leaseFailedRequestsRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "lease-failed-requests");
syncPoint.Continue();
@@ -169,7 +166,6 @@ public async Task Metrics_Queued()
var syncPoint = new SyncPoint();
var meterFactory = new TestMeterFactory();
- var meterRegistry = new TestMeterRegistry(meterFactory.Meters);
var services = new ServiceCollection();
@@ -196,11 +192,11 @@ public async Task Metrics_Queued()
routeEndpointBuilder.Metadata.Add(new EnableRateLimitingAttribute("concurrencyPolicy"));
var endpoint = routeEndpointBuilder.Build();
- using var leaseRequestDurationRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "leased-request-duration");
- using var currentLeaseRequestsRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "current-leased-requests");
- using var currentRequestsQueuedRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "current-queued-requests");
- using var queuedRequestDurationRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "queued-request-duration");
- using var leaseFailedRequestsRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "lease-failed-requests");
+ using var leaseRequestDurationRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "leased-request-duration");
+ using var currentLeaseRequestsRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "current-leased-requests");
+ using var currentRequestsQueuedRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "current-queued-requests");
+ using var queuedRequestDurationRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "queued-request-duration");
+ using var leaseFailedRequestsRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "lease-failed-requests");
// Act
var context1 = new DefaultHttpContext();
@@ -241,7 +237,6 @@ public async Task Metrics_ListenInMiddleOfQueued_CurrentQueueNotDecreased()
var syncPoint = new SyncPoint();
var meterFactory = new TestMeterFactory();
- var meterRegistry = new TestMeterRegistry(meterFactory.Meters);
var services = new ServiceCollection();
@@ -284,11 +279,11 @@ public async Task Metrics_ListenInMiddleOfQueued_CurrentQueueNotDecreased()
// Start listening while the second request is queued.
- using var leaseRequestDurationRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "leased-request-duration");
- using var currentLeaseRequestsRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "current-leased-requests");
- using var currentRequestsQueuedRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "current-queued-requests");
- using var queuedRequestDurationRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "queued-request-duration");
- using var leaseFailedRequestsRecorder = new InstrumentRecorder(meterRegistry, RateLimitingMetrics.MeterName, "lease-failed-requests");
+ using var leaseRequestDurationRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "leased-request-duration");
+ using var currentLeaseRequestsRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "current-leased-requests");
+ using var currentRequestsQueuedRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "current-queued-requests");
+ using var queuedRequestDurationRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "queued-request-duration");
+ using var leaseFailedRequestsRecorder = new InstrumentRecorder(meterFactory, RateLimitingMetrics.MeterName, "lease-failed-requests");
Assert.Empty(currentRequestsQueuedRecorder.GetMeasurements());
Assert.Empty(queuedRequestDurationRecorder.GetMeasurements());
diff --git a/src/Middleware/RateLimiting/test/RateLimitingMiddlewareTests.cs b/src/Middleware/RateLimiting/test/RateLimitingMiddlewareTests.cs
index b64c7a258195..3ad783a694e9 100644
--- a/src/Middleware/RateLimiting/test/RateLimitingMiddlewareTests.cs
+++ b/src/Middleware/RateLimiting/test/RateLimitingMiddlewareTests.cs
@@ -8,7 +8,6 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Logging.Testing;
-using Microsoft.Extensions.Metrics;
using Microsoft.Extensions.Options;
using Moq;
diff --git a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelMetrics.cs b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelMetrics.cs
index 71102514ee60..8cfcc983b7b4 100644
--- a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelMetrics.cs
+++ b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelMetrics.cs
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.AspNetCore.Connections;
-using Microsoft.Extensions.Metrics;
+using Microsoft.Extensions.Diagnostics.Metrics;
using System.Diagnostics;
using System.Diagnostics.Metrics;
using System.Runtime.CompilerServices;
@@ -27,7 +27,7 @@ internal sealed class KestrelMetrics
public KestrelMetrics(IMeterFactory meterFactory)
{
- _meter = meterFactory.CreateMeter(MeterName);
+ _meter = meterFactory.Create(MeterName);
_currentConnectionsCounter = _meter.CreateUpDownCounter(
"current-connections",
diff --git a/src/Servers/Kestrel/Core/src/KestrelServer.cs b/src/Servers/Kestrel/Core/src/KestrelServer.cs
index cd8284a87304..54fc492304f8 100644
--- a/src/Servers/Kestrel/Core/src/KestrelServer.cs
+++ b/src/Servers/Kestrel/Core/src/KestrelServer.cs
@@ -11,7 +11,7 @@
using Microsoft.AspNetCore.Server.Kestrel.Https.Internal;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Metrics;
+using Microsoft.Extensions.Diagnostics.Metrics;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Server.Kestrel.Core;
@@ -71,9 +71,9 @@ public void Dispose()
// This factory used when type is created without DI. For example, via KestrelServer.
private sealed class DummyMeterFactory : IMeterFactory
{
- public Meter CreateMeter(string name) => new Meter(name);
+ public Meter Create(MeterOptions options) => new Meter(options);
- public Meter CreateMeter(MeterOptions options) => new Meter(options.Name, options.Version);
+ public void Dispose() { }
}
private sealed class SimpleHttpsConfigurationService : IHttpsConfigurationService
diff --git a/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj b/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj
index e4b328c02a61..cb48c665434f 100644
--- a/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj
+++ b/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj
@@ -20,6 +20,8 @@
+
+
@@ -37,6 +39,7 @@
+
diff --git a/src/Servers/Kestrel/Core/test/KestrelServerTests.cs b/src/Servers/Kestrel/Core/test/KestrelServerTests.cs
index 39eea7cbb2cc..e13e3717688e 100644
--- a/src/Servers/Kestrel/Core/test/KestrelServerTests.cs
+++ b/src/Servers/Kestrel/Core/test/KestrelServerTests.cs
@@ -16,7 +16,6 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Metrics;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;
using Microsoft.Net.Http.Headers;
diff --git a/src/Servers/Kestrel/Core/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests.csproj b/src/Servers/Kestrel/Core/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests.csproj
index 1bc7490209d6..34d9d34335dc 100644
--- a/src/Servers/Kestrel/Core/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests.csproj
+++ b/src/Servers/Kestrel/Core/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests.csproj
@@ -9,6 +9,7 @@
+
diff --git a/src/Servers/Kestrel/Kestrel/test/KestrelConfigurationLoaderTests.cs b/src/Servers/Kestrel/Kestrel/test/KestrelConfigurationLoaderTests.cs
index 1979300aa144..83777bc0e2aa 100644
--- a/src/Servers/Kestrel/Kestrel/test/KestrelConfigurationLoaderTests.cs
+++ b/src/Servers/Kestrel/Kestrel/test/KestrelConfigurationLoaderTests.cs
@@ -13,7 +13,6 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Metrics;
using Microsoft.Extensions.Primitives;
using Moq;
diff --git a/src/Servers/Kestrel/Kestrel/test/Microsoft.AspNetCore.Server.Kestrel.Tests.csproj b/src/Servers/Kestrel/Kestrel/test/Microsoft.AspNetCore.Server.Kestrel.Tests.csproj
index 99c9f591ee43..ea39d1e46d6f 100644
--- a/src/Servers/Kestrel/Kestrel/test/Microsoft.AspNetCore.Server.Kestrel.Tests.csproj
+++ b/src/Servers/Kestrel/Kestrel/test/Microsoft.AspNetCore.Server.Kestrel.Tests.csproj
@@ -7,6 +7,7 @@
+
diff --git a/src/Servers/Kestrel/perf/Microbenchmarks/Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks.csproj b/src/Servers/Kestrel/perf/Microbenchmarks/Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks.csproj
index acb6b02307c2..ae10ecd08351 100644
--- a/src/Servers/Kestrel/perf/Microbenchmarks/Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks.csproj
+++ b/src/Servers/Kestrel/perf/Microbenchmarks/Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks.csproj
@@ -10,6 +10,7 @@
+
diff --git a/src/Servers/Kestrel/shared/test/TestContextFactory.cs b/src/Servers/Kestrel/shared/test/TestContextFactory.cs
index 5413e4c13249..060457c4be2c 100644
--- a/src/Servers/Kestrel/shared/test/TestContextFactory.cs
+++ b/src/Servers/Kestrel/shared/test/TestContextFactory.cs
@@ -15,7 +15,6 @@
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
-using Microsoft.Extensions.Metrics;
namespace Microsoft.AspNetCore.Testing;
diff --git a/src/Servers/Kestrel/shared/test/TestServiceContext.cs b/src/Servers/Kestrel/shared/test/TestServiceContext.cs
index 49712725a9a9..0e6f8eb3b823 100644
--- a/src/Servers/Kestrel/shared/test/TestServiceContext.cs
+++ b/src/Servers/Kestrel/shared/test/TestServiceContext.cs
@@ -12,7 +12,6 @@
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
-using Microsoft.Extensions.Metrics;
namespace Microsoft.AspNetCore.Testing;
diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/ConnectionLimitTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/ConnectionLimitTests.cs
index 15393c8950e1..8ccbd261b97e 100644
--- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/ConnectionLimitTests.cs
+++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/ConnectionLimitTests.cs
@@ -15,7 +15,7 @@
using Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests.TestTransport;
using Microsoft.AspNetCore.Server.Kestrel.Tests;
using Microsoft.AspNetCore.Testing;
-using Microsoft.Extensions.Metrics;
+using Microsoft.Extensions.Diagnostics.Metrics;
using Xunit;
namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests;
@@ -102,7 +102,7 @@ public async Task UpgradedConnectionsCountsAgainstDifferentLimit()
public async Task RejectsConnectionsWhenLimitReached()
{
var testMeterFactory = new TestMeterFactory();
- using var rejectedConnections = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "rejected-connections");
+ using var rejectedConnections = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "rejected-connections");
const int max = 10;
var requestTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsConnectionMiddlewareTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsConnectionMiddlewareTests.cs
index 3362f78150ea..cd589224aa11 100644
--- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsConnectionMiddlewareTests.cs
+++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsConnectionMiddlewareTests.cs
@@ -1,8 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
-using System.Globalization;
-using System.Net;
using System.Net.Http;
using System.Net.Security;
using System.Security.Authentication;
@@ -24,7 +22,6 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
-using Microsoft.Extensions.Metrics;
using Moq;
namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests;
diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsTests.cs
index f0f223373bf4..4c252cb6ffbd 100644
--- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsTests.cs
+++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsTests.cs
@@ -1,14 +1,10 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
-using System;
-using System.Collections.Generic;
using System.Net.Security;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
@@ -24,10 +20,7 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Metrics;
-using Microsoft.Extensions.Options;
using Moq;
-using Xunit;
namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests;
diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/InMemory.FunctionalTests.csproj b/src/Servers/Kestrel/test/InMemory.FunctionalTests/InMemory.FunctionalTests.csproj
index 576463f85fca..7f5ed843519d 100644
--- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/InMemory.FunctionalTests.csproj
+++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/InMemory.FunctionalTests.csproj
@@ -10,6 +10,7 @@
+
diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/KestrelMetricsTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/KestrelMetricsTests.cs
index c0e8349a3bbb..86457feab09b 100644
--- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/KestrelMetricsTests.cs
+++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/KestrelMetricsTests.cs
@@ -18,7 +18,7 @@
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
using Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests.TestTransport;
using Microsoft.AspNetCore.Testing;
-using Microsoft.Extensions.Metrics;
+using Microsoft.Extensions.Diagnostics.Metrics;
namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests;
@@ -46,9 +46,9 @@ public async Task Http1Connection()
});
var testMeterFactory = new TestMeterFactory();
- using var connectionDuration = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "connection-duration");
- using var currentConnections = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "current-connections");
- using var queuedConnections = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "queued-connections");
+ using var connectionDuration = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "connection-duration");
+ using var currentConnections = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "current-connections");
+ using var queuedConnections = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "queued-connections");
var serviceContext = new TestServiceContext(LoggerFactory, metrics: new KestrelMetrics(testMeterFactory));
@@ -122,9 +122,9 @@ public async Task Http1Connection_BeginListeningAfterConnectionStarted()
// Wait for connection to start on the server.
await sync.WaitForSyncPoint();
- using var connectionDuration = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "connection-duration");
- using var currentConnections = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "current-connections");
- using var queuedConnections = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "queued-connections");
+ using var connectionDuration = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "connection-duration");
+ using var currentConnections = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "current-connections");
+ using var queuedConnections = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "queued-connections");
// Signal that connection can continue.
sync.Continue();
@@ -169,9 +169,9 @@ public async Task Http1Connection_IHttpConnectionTagsFeatureIgnoreFeatureSetOnTr
});
var testMeterFactory = new TestMeterFactory();
- using var connectionDuration = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "connection-duration");
- using var currentConnections = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "current-connections");
- using var queuedConnections = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "queued-connections");
+ using var connectionDuration = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "connection-duration");
+ using var currentConnections = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "current-connections");
+ using var queuedConnections = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "queued-connections");
var serviceContext = new TestServiceContext(LoggerFactory, metrics: new KestrelMetrics(testMeterFactory));
@@ -244,9 +244,9 @@ public async Task Http1Connection_Error()
});
var testMeterFactory = new TestMeterFactory();
- using var connectionDuration = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "connection-duration");
- using var currentConnections = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "current-connections");
- using var queuedConnections = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "queued-connections");
+ using var connectionDuration = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "connection-duration");
+ using var currentConnections = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "current-connections");
+ using var queuedConnections = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "queued-connections");
var serviceContext = new TestServiceContext(LoggerFactory, metrics: new KestrelMetrics(testMeterFactory));
@@ -287,9 +287,9 @@ public async Task Http1Connection_Upgrade()
var listenOptions = new ListenOptions(new IPEndPoint(IPAddress.Loopback, 0));
var testMeterFactory = new TestMeterFactory();
- using var connectionDuration = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "connection-duration");
- using var currentConnections = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "current-connections");
- using var currentUpgradedRequests = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "current-upgraded-connections");
+ using var connectionDuration = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "connection-duration");
+ using var currentConnections = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "current-connections");
+ using var currentUpgradedRequests = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "current-upgraded-connections");
var serviceContext = new TestServiceContext(LoggerFactory, metrics: new KestrelMetrics(testMeterFactory));
@@ -331,12 +331,12 @@ public async Task Http2Connection()
var requestsReceived = 0;
var testMeterFactory = new TestMeterFactory();
- using var connectionDuration = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "connection-duration");
- using var currentConnections = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "current-connections");
- using var queuedConnections = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "queued-connections");
- using var queuedRequests = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "queued-requests");
- using var tlsHandshakeDuration = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "tls-handshake-duration");
- using var currentTlsHandshakes = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), "Microsoft.AspNetCore.Server.Kestrel", "current-tls-handshakes");
+ using var connectionDuration = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "connection-duration");
+ using var currentConnections = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "current-connections");
+ using var queuedConnections = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "queued-connections");
+ using var queuedRequests = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "queued-requests");
+ using var tlsHandshakeDuration = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "tls-handshake-duration");
+ using var currentTlsHandshakes = new InstrumentRecorder(testMeterFactory, "Microsoft.AspNetCore.Server.Kestrel", "current-tls-handshakes");
await using (var server = new TestServer(context =>
{
diff --git a/src/Servers/Kestrel/test/Sockets.BindTests/Sockets.BindTests.csproj b/src/Servers/Kestrel/test/Sockets.BindTests/Sockets.BindTests.csproj
index 5d7992a557a7..a584f2368fdf 100644
--- a/src/Servers/Kestrel/test/Sockets.BindTests/Sockets.BindTests.csproj
+++ b/src/Servers/Kestrel/test/Sockets.BindTests/Sockets.BindTests.csproj
@@ -10,6 +10,7 @@
+
diff --git a/src/Servers/Kestrel/test/Sockets.FunctionalTests/Sockets.FunctionalTests.csproj b/src/Servers/Kestrel/test/Sockets.FunctionalTests/Sockets.FunctionalTests.csproj
index 2b8e9b81899c..4a45a7f70434 100644
--- a/src/Servers/Kestrel/test/Sockets.FunctionalTests/Sockets.FunctionalTests.csproj
+++ b/src/Servers/Kestrel/test/Sockets.FunctionalTests/Sockets.FunctionalTests.csproj
@@ -11,6 +11,7 @@
+
diff --git a/src/Shared/Metrics/DefaultMeterFactory.cs b/src/Shared/Metrics/DefaultMeterFactory.cs
deleted file mode 100644
index f6961526d1f7..000000000000
--- a/src/Shared/Metrics/DefaultMeterFactory.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System.Diagnostics.Metrics;
-using System.Linq;
-using Microsoft.Extensions.Options;
-
-namespace Microsoft.Extensions.Metrics;
-
-// TODO: Remove when Metrics DI intergration package is available https://github.com/dotnet/aspnetcore/issues/47618
-internal sealed class DefaultMeterFactory : IMeterFactory
-{
- private readonly IOptions _options;
- private readonly IMeterRegistry _meterRegistry;
- private readonly Dictionary _meters = new Dictionary();
-
- public DefaultMeterFactory(IOptions options, IMeterRegistry meterRegistry)
- {
- _options = options;
- _meterRegistry = meterRegistry;
- }
-
- public Meter CreateMeter(string name)
- {
- return CreateMeterCore(name, version: null, defaultTags: null);
- }
-
- public Meter CreateMeter(MeterOptions options)
- {
- return CreateMeterCore(options.Name, options.Version, options.DefaultTags);
- }
-
- private Meter CreateMeterCore(string name, string? version, IList>? defaultTags)
- {
- var tags = defaultTags?.ToArray();
- if (tags != null)
- {
- Array.Sort(tags, (t1, t2) => string.Compare(t1.Key, t2.Key, StringComparison.Ordinal));
- }
- var key = new MeterKey(name, version, tags);
-
- if (_meters.TryGetValue(key, out var meter))
- {
- return meter;
- }
-
- // TODO: Configure meter with default tags.
- meter = new Meter(name, version);
- _meters[key] = meter;
- _meterRegistry.Add(meter);
-
- return meter;
- }
-
- private readonly struct MeterKey : IEquatable
- {
- public MeterKey(string name, string? version, KeyValuePair[]? defaultTags)
- {
- Name = name;
- Version = version;
- DefaultTags = defaultTags;
- }
-
- public string Name { get; }
- public string? Version { get; }
- public IList>? DefaultTags { get; }
-
- public bool Equals(MeterKey other)
- {
- return Name == other.Name
- && Version == other.Version
- && TagsEqual(other);
- }
-
- private bool TagsEqual(MeterKey other)
- {
- if (DefaultTags is null && other.DefaultTags is null)
- {
- return true;
- }
- if (DefaultTags is not null && other.DefaultTags is not null && DefaultTags.SequenceEqual(other.DefaultTags))
- {
- return true;
- }
- return false;
- }
-
- public override bool Equals(object? obj)
- {
- return obj is MeterKey key && Equals(key);
- }
-
- public override int GetHashCode()
- {
- var hashCode = new HashCode();
- hashCode.Add(Name);
- hashCode.Add(Version);
- if (DefaultTags is not null)
- {
- foreach (var item in DefaultTags)
- {
- hashCode.Add(item);
- }
- }
-
- return hashCode.ToHashCode();
- }
- }
-}
diff --git a/src/Shared/Metrics/IMeterFactory.cs b/src/Shared/Metrics/IMeterFactory.cs
deleted file mode 100644
index 82563cc89701..000000000000
--- a/src/Shared/Metrics/IMeterFactory.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System.Diagnostics.Metrics;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace Microsoft.Extensions.Metrics;
-
-// TODO: Remove when Metrics DI intergration package is available https://github.com/dotnet/aspnetcore/issues/47618
-internal sealed class MetricsOptions
-{
- public IList> DefaultTags { get; } = new List>();
-}
-
-internal interface IMetricsBuilder
-{
- IServiceCollection Services { get; }
-}
-
-internal sealed class MetricsBuilder : IMetricsBuilder
-{
- public MetricsBuilder(IServiceCollection services) => Services = services;
- public IServiceCollection Services { get; }
-}
-
-internal sealed class MeterOptions
-{
- public required string Name { get; set; }
- public string? Version { get; set; }
- public IList>? DefaultTags { get; set; }
-}
-
-internal interface IMeterFactory
-{
- Meter CreateMeter(string name);
- Meter CreateMeter(MeterOptions options);
-}
-
-internal interface IMeterRegistry
-{
- void Add(Meter meter);
- bool Contains(Meter meter);
-}
-
-internal sealed class DefaultMeterRegistry : IMeterRegistry, IDisposable
-{
- private readonly object _lock = new object();
- private readonly List _meters = new List();
-
- public void Add(Meter meter)
- {
- lock (_lock)
- {
- _meters.Add(meter);
- }
- }
-
- public bool Contains(Meter meter)
- {
- lock (_lock)
- {
- return _meters.Contains(meter);
- }
- }
-
- public void Dispose()
- {
- lock (_lock)
- {
- foreach (var meter in _meters)
- {
- meter.Dispose();
- }
- _meters.Clear();
- }
- }
-}
diff --git a/src/Shared/Metrics/InstrumentRecorder.cs b/src/Shared/Metrics/InstrumentRecorder.cs
deleted file mode 100644
index 33fb51ea8f4e..000000000000
--- a/src/Shared/Metrics/InstrumentRecorder.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System.Diagnostics.Metrics;
-
-namespace Microsoft.Extensions.Metrics;
-
-// TODO: Remove when Metrics DI intergration package is available https://github.com/dotnet/aspnetcore/issues/47618
-internal sealed class InstrumentRecorder : IDisposable where T : struct
-{
- private readonly object _lock = new object();
- private readonly string _meterName;
- private readonly string _instrumentName;
- private readonly MeterListener _meterListener;
- private readonly List> _values;
- private readonly List>> _callbacks;
-
- public InstrumentRecorder(IMeterRegistry registry, string meterName, string instrumentName, object? state = null)
- {
- _meterName = meterName;
- _instrumentName = instrumentName;
- _callbacks = new List>>();
- _values = new List>();
- _meterListener = new MeterListener();
- _meterListener.InstrumentPublished = (instrument, listener) =>
- {
- if (instrument.Meter.Name == _meterName && registry.Contains(instrument.Meter) && instrument.Name == _instrumentName)
- {
- listener.EnableMeasurementEvents(instrument, state);
- }
- };
- _meterListener.SetMeasurementEventCallback(OnMeasurementRecorded);
- _meterListener.Start();
- }
-
- private void OnMeasurementRecorded(Instrument instrument, T measurement, ReadOnlySpan> tags, object? state)
- {
- lock (_lock)
- {
- var m = new Measurement(measurement, tags);
- _values.Add(m);
-
- // Should this happen in the lock?
- // Is there a better way to notify listeners that there are new measurements?
- foreach (var callback in _callbacks)
- {
- callback(m);
- }
- }
- }
-
- public void Register(Action> callback)
- {
- _callbacks.Add(callback);
- }
-
- public IReadOnlyList> GetMeasurements()
- {
- lock (_lock)
- {
- return _values.ToArray();
- }
- }
-
- public void Dispose()
- {
- _meterListener.Dispose();
- }
-}
diff --git a/src/Shared/Metrics/MetricsServiceExtensions.cs b/src/Shared/Metrics/MetricsServiceExtensions.cs
deleted file mode 100644
index f18fa7148476..000000000000
--- a/src/Shared/Metrics/MetricsServiceExtensions.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using Microsoft.Extensions.DependencyInjection.Extensions;
-using Microsoft.Extensions.Metrics;
-
-namespace Microsoft.Extensions.DependencyInjection;
-
-// TODO: Remove when Metrics DI intergration package is available https://github.com/dotnet/aspnetcore/issues/47618
-internal static class MetricsServiceExtensions
-{
- public static IServiceCollection AddMetrics(this IServiceCollection services)
- {
- ArgumentNullException.ThrowIfNull(services);
-
- services.TryAddSingleton();
- services.TryAddSingleton();
-
- return services;
- }
-
- public static IServiceCollection AddMetrics(this IServiceCollection services, Action configure)
- {
- ArgumentNullException.ThrowIfNull(services);
-
- services.AddMetrics();
- configure(new MetricsBuilder(services));
-
- return services;
- }
-
- public static IMetricsBuilder AddDefaultTag(this IMetricsBuilder builder, string name, object? value)
- {
- builder.Services.Configure(o => o.DefaultTags.Add(new KeyValuePair(name, value)));
- return builder;
- }
-}
diff --git a/src/Shared/Metrics/TestMeterFactory.cs b/src/Shared/Metrics/TestMeterFactory.cs
index 9f1f2495d247..9553f06dce04 100644
--- a/src/Shared/Metrics/TestMeterFactory.cs
+++ b/src/Shared/Metrics/TestMeterFactory.cs
@@ -2,43 +2,72 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics.Metrics;
+using Microsoft.Extensions.Diagnostics.Metrics;
-namespace Microsoft.Extensions.Metrics;
+namespace Microsoft.AspNetCore.Testing;
-// TODO: Remove when Metrics DI intergration package is available https://github.com/dotnet/aspnetcore/issues/47618
-internal class TestMeterFactory : IMeterFactory
+internal sealed class TestMeterFactory : IMeterFactory
{
public List Meters { get; } = new List();
- public Meter CreateMeter(string name)
+ public Meter Create(MeterOptions options)
{
- var meter = new Meter(name);
+ var meter = new Meter(options.Name, options.Version, Array.Empty>(), scope: this);
Meters.Add(meter);
return meter;
}
- public Meter CreateMeter(MeterOptions options)
+ public void Dispose()
{
- var meter = new Meter(options.Name, options.Version);
- Meters.Add(meter);
- return meter;
+ foreach (var meter in Meters)
+ {
+ meter.Dispose();
+ }
+
+ Meters.Clear();
}
}
-internal class TestMeterRegistry : IMeterRegistry
+internal sealed class MeasurementReporter : IDisposable where T : struct
{
- private readonly List _meters;
+ private readonly string _meterName;
+ private readonly string _instrumentName;
+ private readonly List>> _callbacks;
+ private readonly MeterListener _meterListener;
- public TestMeterRegistry() : this(new List())
+ public MeasurementReporter(IMeterFactory factory, string meterName, string instrumentName, object state = null)
{
+ _meterName = meterName;
+ _instrumentName = instrumentName;
+ _callbacks = new List>>();
+ _meterListener = new MeterListener();
+ _meterListener.InstrumentPublished = (instrument, listener) =>
+ {
+ if (instrument.Meter.Name == _meterName && instrument.Meter.Scope == factory && instrument.Name == _instrumentName)
+ {
+ listener.EnableMeasurementEvents(instrument, state);
+ }
+ };
+ _meterListener.SetMeasurementEventCallback(OnMeasurementRecorded);
+ _meterListener.Start();
}
- public TestMeterRegistry(List meters)
+ private void OnMeasurementRecorded(Instrument instrument, T measurement, ReadOnlySpan> tags, object state)
{
- _meters = meters;
+ var m = new Measurement(measurement, tags);
+ foreach (var callback in _callbacks)
+ {
+ callback(m);
+ }
}
- public void Add(Meter meter) => _meters.Add(meter);
+ public void Register(Action> callback)
+ {
+ _callbacks.Add(callback);
+ }
- public bool Contains(Meter meter) => _meters.Contains(meter);
+ public void Dispose()
+ {
+ _meterListener.Dispose();
+ }
}
diff --git a/src/SignalR/common/Http.Connections/src/Internal/HttpConnectionsMetrics.cs b/src/SignalR/common/Http.Connections/src/Internal/HttpConnectionsMetrics.cs
index 80807c5d0534..9637def5df6f 100644
--- a/src/SignalR/common/Http.Connections/src/Internal/HttpConnectionsMetrics.cs
+++ b/src/SignalR/common/Http.Connections/src/Internal/HttpConnectionsMetrics.cs
@@ -3,7 +3,7 @@
using System.Diagnostics;
using System.Diagnostics.Metrics;
-using Microsoft.Extensions.Metrics;
+using Microsoft.Extensions.Diagnostics.Metrics;
namespace Microsoft.AspNetCore.Http.Connections.Internal;
@@ -32,7 +32,7 @@ internal sealed class HttpConnectionsMetrics : IDisposable
public HttpConnectionsMetrics(IMeterFactory meterFactory)
{
- _meter = meterFactory.CreateMeter(MeterName);
+ _meter = meterFactory.Create(MeterName);
_currentConnectionsCounter = _meter.CreateUpDownCounter(
"current-connections",
diff --git a/src/SignalR/common/Http.Connections/src/Microsoft.AspNetCore.Http.Connections.csproj b/src/SignalR/common/Http.Connections/src/Microsoft.AspNetCore.Http.Connections.csproj
index e6ee74ec7735..03cbb1beac26 100644
--- a/src/SignalR/common/Http.Connections/src/Microsoft.AspNetCore.Http.Connections.csproj
+++ b/src/SignalR/common/Http.Connections/src/Microsoft.AspNetCore.Http.Connections.csproj
@@ -36,6 +36,7 @@
+
diff --git a/src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs b/src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs
index 9d16f32f4a6b..d08c52699d7c 100644
--- a/src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs
+++ b/src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs
@@ -36,7 +36,6 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
-using Microsoft.Extensions.Metrics;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;
using Microsoft.IdentityModel.Tokens;
@@ -1091,9 +1090,9 @@ public async Task Metrics()
using (StartVerifiableLog())
{
var testMeterFactory = new TestMeterFactory();
- using var connectionDuration = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), HttpConnectionsMetrics.MeterName, "connection-duration");
- using var currentConnections = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), HttpConnectionsMetrics.MeterName, "current-connections");
- using var currentTransports = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), HttpConnectionsMetrics.MeterName, "current-transports");
+ using var connectionDuration = new InstrumentRecorder(testMeterFactory, HttpConnectionsMetrics.MeterName, "connection-duration");
+ using var currentConnections = new InstrumentRecorder(testMeterFactory, HttpConnectionsMetrics.MeterName, "current-connections");
+ using var currentTransports = new InstrumentRecorder(testMeterFactory, HttpConnectionsMetrics.MeterName, "current-transports");
var metrics = new HttpConnectionsMetrics(testMeterFactory);
var manager = CreateConnectionManager(LoggerFactory, metrics);
diff --git a/src/SignalR/common/Http.Connections/test/HttpConnectionManagerTests.cs b/src/SignalR/common/Http.Connections/test/HttpConnectionManagerTests.cs
index ff067e567f4a..d2a9ca4adbb6 100644
--- a/src/SignalR/common/Http.Connections/test/HttpConnectionManagerTests.cs
+++ b/src/SignalR/common/Http.Connections/test/HttpConnectionManagerTests.cs
@@ -13,7 +13,6 @@
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Metrics;
using Microsoft.Extensions.Options;
using Xunit;
@@ -430,8 +429,8 @@ public void Metrics()
using (StartVerifiableLog())
{
var testMeterFactory = new TestMeterFactory();
- using var connectionDuration = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), HttpConnectionsMetrics.MeterName, "connection-duration");
- using var currentConnections = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), HttpConnectionsMetrics.MeterName, "current-connections");
+ using var connectionDuration = new InstrumentRecorder(testMeterFactory, HttpConnectionsMetrics.MeterName, "connection-duration");
+ using var currentConnections = new InstrumentRecorder(testMeterFactory, HttpConnectionsMetrics.MeterName, "current-connections");
var connectionManager = CreateConnectionManager(LoggerFactory, metrics: new HttpConnectionsMetrics(testMeterFactory));
var connection = connectionManager.CreateConnection();
@@ -459,8 +458,8 @@ public void Metrics_ListenStartAfterConnection_Empty()
var connectionManager = CreateConnectionManager(LoggerFactory, metrics: new HttpConnectionsMetrics(testMeterFactory));
var connection = connectionManager.CreateConnection();
- using var connectionDuration = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), HttpConnectionsMetrics.MeterName, "connection-duration");
- using var currentConnections = new InstrumentRecorder(new TestMeterRegistry(testMeterFactory.Meters), HttpConnectionsMetrics.MeterName, "current-connections");
+ using var connectionDuration = new InstrumentRecorder(testMeterFactory, HttpConnectionsMetrics.MeterName, "connection-duration");
+ using var currentConnections = new InstrumentRecorder(testMeterFactory, HttpConnectionsMetrics.MeterName, "current-connections");
Assert.NotNull(connection.ConnectionId);
diff --git a/src/SignalR/common/Http.Connections/test/Microsoft.AspNetCore.Http.Connections.Tests.csproj b/src/SignalR/common/Http.Connections/test/Microsoft.AspNetCore.Http.Connections.Tests.csproj
index 552dad1c1e05..28671b344a4f 100644
--- a/src/SignalR/common/Http.Connections/test/Microsoft.AspNetCore.Http.Connections.Tests.csproj
+++ b/src/SignalR/common/Http.Connections/test/Microsoft.AspNetCore.Http.Connections.Tests.csproj
@@ -8,6 +8,7 @@
+
diff --git a/src/SignalR/server/SignalR/src/SignalRDependencyInjectionExtensions.cs b/src/SignalR/server/SignalR/src/SignalRDependencyInjectionExtensions.cs
index ed613ec73f96..628fee8b5f12 100644
--- a/src/SignalR/server/SignalR/src/SignalRDependencyInjectionExtensions.cs
+++ b/src/SignalR/server/SignalR/src/SignalRDependencyInjectionExtensions.cs
@@ -5,6 +5,7 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.Extensions.Diagnostics.Metrics;
using Microsoft.Extensions.Options;
namespace Microsoft.Extensions.DependencyInjection;