update WebMetric test for RC1 (#30350)

pull/30376/head
Tim Deschryver 2023-09-15 22:36:33 +02:00 committed by GitHub
parent 5752b78a36
commit 889f52c423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -1,8 +1,7 @@
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.Metrics;
using Microsoft.VisualStudio.TestPlatform.TestHost;
using Microsoft.Extensions.Telemetry.Testing.Metering;
using System.Diagnostics.Metrics;
// <snippet_TestClass>
public class BasicTests : IClassFixture<WebApplicationFactory<Program>>
@ -17,7 +16,7 @@ public class BasicTests : IClassFixture<WebApplicationFactory<Program>>
var client = _factory.CreateClient();
var meterFactory = _factory.Services.GetRequiredService<IMeterFactory>();
var collector = new MetricCollector<double>(meterFactory,
"Microsoft.AspNetCore.Hosting", "http-server-request-duration");
"Microsoft.AspNetCore.Hosting", "http.server.request.duration");
// Act
var response = await client.GetAsync("/");
@ -29,9 +28,9 @@ public class BasicTests : IClassFixture<WebApplicationFactory<Program>>
Assert.Collection(collector.GetMeasurementSnapshot(),
measurement =>
{
Assert.Equal("http", measurement.Tags["scheme"]);
Assert.Equal("GET", measurement.Tags["method"]);
Assert.Equal("/", measurement.Tags["route"]);
Assert.Equal("http", measurement.Tags["url.scheme"]);
Assert.Equal("GET", measurement.Tags["http.request.method"]);
Assert.Equal("/", measurement.Tags["http.route"]);
});
}
}