1 write to Tags
Microsoft.Extensions.Diagnostics.Testing (1)
Metrics\CollectedMeasurement.cs (1)
34Tags = d;
297 references to Tags
Aspire.Confluent.Kafka.Tests (60)
MetricsTests.cs (60)
80Assert.Contains(collectorProducerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 81Assert.Contains(collectorProducerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 84Assert.Contains(collectorConsumerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 85Assert.Contains(collectorConsumerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 88Assert.Contains(collectorProducerQueueSize.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 89Assert.Contains(collectorProducerQueueSize.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 92Assert.Contains(collectorNetworkTx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 93Assert.Contains(collectorNetworkTx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 94Assert.Contains(collectorNetworkTx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 97Assert.Contains(collectorNetworkTransmitted.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 98Assert.Contains(collectorNetworkTransmitted.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 99Assert.Contains(collectorNetworkTransmitted.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 102Assert.Contains(collectorNetworkRx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 103Assert.Contains(collectorNetworkRx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 104Assert.Contains(collectorNetworkRx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 107Assert.Contains(collectorNetworkReceived.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 108Assert.Contains(collectorNetworkReceived.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 109Assert.Contains(collectorNetworkReceived.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 112Assert.Contains(collectorMessageTx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 113Assert.Contains(collectorMessageTx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 114Assert.Contains(collectorMessageTx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 117Assert.Contains(collectorMessageTransmitted.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 118Assert.Contains(collectorMessageTransmitted.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 119Assert.Contains(collectorMessageTransmitted.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 122Assert.Contains(collectorMessageRx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 123Assert.Contains(collectorMessageRx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 124Assert.Contains(collectorMessageRx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 127Assert.Contains(collectorMessageReceived.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 128Assert.Contains(collectorMessageReceived.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 129Assert.Contains(collectorMessageReceived.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 197Assert.Contains(collectorProducerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 198Assert.Contains(collectorProducerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 201Assert.Contains(collectorConsumerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 202Assert.Contains(collectorConsumerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 205Assert.Contains(collectorProducerQueueSize.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 206Assert.Contains(collectorProducerQueueSize.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 209Assert.Contains(collectorNetworkTx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 210Assert.Contains(collectorNetworkTx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 211Assert.Contains(collectorNetworkTx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 214Assert.Contains(collectorNetworkTransmitted.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 215Assert.Contains(collectorNetworkTransmitted.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 216Assert.Contains(collectorNetworkTransmitted.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 219Assert.Contains(collectorNetworkRx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 220Assert.Contains(collectorNetworkRx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 221Assert.Contains(collectorNetworkRx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 224Assert.Contains(collectorNetworkReceived.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 225Assert.Contains(collectorNetworkReceived.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 226Assert.Contains(collectorNetworkReceived.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 229Assert.Contains(collectorMessageTx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 230Assert.Contains(collectorMessageTx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 231Assert.Contains(collectorMessageTx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 234Assert.Contains(collectorMessageTransmitted.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 235Assert.Contains(collectorMessageTransmitted.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 236Assert.Contains(collectorMessageTransmitted.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 239Assert.Contains(collectorMessageRx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 240Assert.Contains(collectorMessageRx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 241Assert.Contains(collectorMessageRx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 244Assert.Contains(collectorMessageReceived.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 245Assert.Contains(collectorMessageReceived.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 246Assert.Contains(collectorMessageReceived.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer");
InMemory.FunctionalTests (73)
BadHttpRequestTests.cs (7)
186Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 250m => MetricsAssert.Equal(ConnectionEndReason.InvalidRequestLine, m.Tags)); 273m => MetricsAssert.Equal(ConnectionEndReason.InvalidHttpVersion, m.Tags)); 360Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(reason, m.Tags)); 433Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 502Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 560Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags));
ChunkedRequestTests.cs (1)
902Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.UnexpectedEndOfRequestContent, m.Tags));
ConnectionLimitTests.cs (1)
158m.Tags.TryGetValue(KestrelMetrics.ErrorTypeAttributeName, out var value);
ConnectionMiddlewareTests.cs (1)
175Assert.Equal(typeof(InvalidOperationException).FullName, m.Tags[KestrelMetrics.ErrorTypeAttributeName]);
Http2\TlsTests.cs (1)
80Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.InsufficientTlsVersion, m.Tags));
KeepAliveTimeoutTests.cs (6)
53Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.KeepAliveTimeout, m.Tags)); 86Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 131Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 176Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 201Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.KeepAliveTimeout, m.Tags)); 244Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags));
KestrelMetricsTests.cs (30)
97Assert.Equal("value!", (string)m.Tags["custom"]); 380Assert.Equal("value!", (string)m.Tags["custom"]); 381Assert.False(m.Tags.ContainsKey("test")); 739Assert.Equal("1.2", (string)m.Tags["tls.protocol.version"]); 740Assert.DoesNotContain("error.type", m.Tags.Keys); 747Assert.Equal("http", (string)measurement.Tags["network.protocol.name"]); 748Assert.Equal(httpVersion, (string)measurement.Tags["network.protocol.version"]); 899Assert.Equal(typeof(AuthenticationException).FullName, (string)m.Tags["error.type"]); 900Assert.DoesNotContain("tls.protocol.version", m.Tags.Keys); 920Assert.Equal(networkTransport, (string)measurement.Tags["network.transport"]); 921Assert.Equal(localAddress, (string)measurement.Tags["server.address"]); 924Assert.Equal(localPort, (int)measurement.Tags["server.port"]); 928Assert.DoesNotContain("server.port", measurement.Tags.Keys); 932Assert.Equal(networkType, (string)measurement.Tags["network.type"]); 936Assert.DoesNotContain("network.type", measurement.Tags.Keys); 940Assert.Equal("http", (string)measurement.Tags["network.protocol.name"]); 941Assert.Equal(httpVersion, (string)measurement.Tags["network.protocol.version"]); 945Assert.DoesNotContain("network.protocol.name", measurement.Tags.Keys); 946Assert.DoesNotContain("network.protocol.version", measurement.Tags.Keys); 950Assert.Equal(tlsProtocolVersion, (string)measurement.Tags["tls.protocol.version"]); 954Assert.DoesNotContain("tls.protocol.version", measurement.Tags.Keys); 958Assert.Equal(error, (string)measurement.Tags["error.type"]); 964Assert.DoesNotContain("error.type", measurement.Tags.Keys); 968throw new Exception($"Connection has unexpected error.type value: {measurement.Tags["error.type"]}", ex); 976Assert.Equal(networkTransport, (string)measurement.Tags["network.transport"]); 977Assert.Equal(localAddress, (string)measurement.Tags["server.address"]); 980Assert.Equal(localPort, (int)measurement.Tags["server.port"]); 984Assert.DoesNotContain("server.port", measurement.Tags.Keys); 988Assert.Equal(networkType, (string)measurement.Tags["network.type"]); 992Assert.DoesNotContain("network.type", measurement.Tags.Keys);
MaxRequestBodySizeTests.cs (2)
155Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.MaxRequestBodySizeExceeded, m.Tags)); 409Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.MaxRequestBodySizeExceeded, m.Tags));
MaxRequestLineSizeTests.cs (2)
52Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 80Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.InvalidRequestLine, m.Tags));
RequestBodyTimeoutTests.cs (3)
93Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.MinRequestBodyDataRate, m.Tags)); 146Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.ServerTimeout, m.Tags)); 220Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.MinRequestBodyDataRate, m.Tags));
RequestHeaderLimitsTests.cs (4)
50Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 87Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 115Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.MaxRequestHeadersTotalSizeExceeded, m.Tags)); 144Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.MaxRequestHeaderCountExceeded, m.Tags));
RequestHeadersTimeoutTests.cs (4)
49Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.RequestHeadersTimeout, m.Tags)); 85Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 114Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.RequestHeadersTimeout, m.Tags)); 148Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.RequestHeadersTimeout, m.Tags));
RequestTests.cs (2)
1229Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.UnexpectedEndOfRequestContent, m.Tags)); 2282Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.TlsNotSupported, m.Tags));
ResponseTests.cs (9)
210Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.WriteCanceled, m.Tags)); 708Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 988Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.ResponseContentLengthMismatch, m.Tags)); 1026Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.ResponseContentLengthMismatch, m.Tags)); 2466Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 2668Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 2713Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.ErrorAfterStartingResponse, m.Tags)); 2758Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.ErrorAfterStartingResponse, m.Tags)); 2841Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.AbortedByApp, m.Tags));
Interop.FunctionalTests (14)
Http2\Http2RequestTests.cs (7)
145Assert.Equal("http", (string)m.Tags["network.protocol.name"]); 146Assert.Equal("2", (string)m.Tags["network.protocol.version"]); 147Assert.Equal("tcp", (string)m.Tags["network.transport"]); 148Assert.Equal("ipv6", (string)m.Tags["network.type"]); 149Assert.Equal("::1", (string)m.Tags["server.address"]); 150Assert.Equal(host.GetPort(), (int)m.Tags["server.port"]); 151Assert.Equal("1.2", (string)m.Tags["tls.protocol.version"]);
Http3\Http3RequestTests.cs (7)
105Assert.Equal("ipv4", (string)m.Tags["network.type"]); 106Assert.Equal("http", (string)m.Tags["network.protocol.name"]); 107Assert.Equal("3", (string)m.Tags["network.protocol.version"]); 108Assert.Equal("udp", (string)m.Tags["network.transport"]); 109Assert.Equal("127.0.0.1", (string)m.Tags["server.address"]); 110Assert.Equal(host.GetPort(), (int)m.Tags["server.port"]); 111Assert.Equal("1.3", (string)m.Tags["tls.protocol.version"]);
Microsoft.AspNetCore.Diagnostics.Tests (22)
DeveloperExceptionPageMiddlewareTest.cs (6)
617Assert.Equal(500, (int)m.Tags["http.response.status_code"]); 618Assert.Equal("System.Exception", (string)m.Tags["error.type"]); 627Assert.Equal(exceptionName, (string)measurement.Tags["error.type"]); 628Assert.Equal(result, measurement.Tags["aspnetcore.diagnostics.exception.result"].ToString()); 631Assert.False(measurement.Tags.ContainsKey("aspnetcore.diagnostics.handler.type")); 635Assert.Equal(handler, (string)measurement.Tags["aspnetcore.diagnostics.handler.type"]);
ExceptionHandlerMiddlewareTest.cs (10)
349Assert.Equal(500, (int)m.Tags["http.response.status_code"]); 350Assert.Equal("System.Exception", (string)m.Tags["error.type"]); 351Assert.Equal("/path", (string)m.Tags["http.route"]); 416Assert.Equal(500, (int)m.Tags["http.response.status_code"]); 417Assert.Equal("System.Exception", (string)m.Tags["error.type"]); 418Assert.Equal("/new", (string)m.Tags["http.route"]); 451Assert.Equal(exceptionName, (string)measurement.Tags["error.type"]); 452Assert.Equal(result, measurement.Tags["aspnetcore.diagnostics.exception.result"].ToString()); 455Assert.False(measurement.Tags.ContainsKey("aspnetcore.diagnostics.handler.type")); 459Assert.Equal(handler, (string)measurement.Tags["aspnetcore.diagnostics.handler.type"]);
ExceptionHandlerTest.cs (6)
1039Assert.Equal(404, (int)m.Tags["http.response.status_code"]); 1040Assert.Equal("System.Exception", (string)m.Tags["error.type"]); 1109Assert.Equal(500, (int)m.Tags["http.response.status_code"]); 1110Assert.Equal("System.Exception", (string)m.Tags["error.type"]); 1171Assert.Equal(404, (int)m.Tags["http.response.status_code"]); 1172Assert.Equal("System.Exception", (string)m.Tags["error.type"]);
Microsoft.AspNetCore.HeaderParsing.Tests (4)
HeaderParsingFeatureTests.cs (4)
153latest.Tags["aspnetcore.header_parsing.header.name"].Should().Be("Date"); 154latest.Tags["error.type"].Should().Be("Unable to parse date time offset value."); 211latest.Tags["aspnetcore.header_parsing.header.name"].Should().Be(HeaderNames.CacheControl); 212latest.Tags["aspnetcore.header_parsing.cache_access.type"].Should().Be("Hit");
Microsoft.AspNetCore.Hosting.Tests (31)
HostingApplicationDiagnosticsTests.cs (25)
254Assert.Equal("http", m.Tags["url.scheme"]); 255Assert.Equal("POST", m.Tags["http.request.method"]); 270Assert.Equal("http", m.Tags["url.scheme"]); 271Assert.Equal("POST", m.Tags["http.request.method"]); 276Assert.Equal("http", m.Tags["url.scheme"]); 277Assert.Equal("POST", m.Tags["http.request.method"]); 313Assert.Equal("http", m.Tags["url.scheme"]); 314Assert.Equal("POST", m.Tags["http.request.method"]); 329Assert.Equal("http", m.Tags["url.scheme"]); 330Assert.Equal("POST", m.Tags["http.request.method"]); 335Assert.Equal("http", m.Tags["url.scheme"]); 336Assert.Equal("POST", m.Tags["http.request.method"]); 342Assert.Equal("hello/{name}", m.Tags["http.route"]); 373Assert.Equal("http", m.Tags["url.scheme"]); 374Assert.Equal("POST", m.Tags["http.request.method"]); 389Assert.Equal("http", m.Tags["url.scheme"]); 390Assert.Equal("POST", m.Tags["http.request.method"]); 395Assert.Equal("http", m.Tags["url.scheme"]); 396Assert.Equal("POST", m.Tags["http.request.method"]); 428Assert.Equal("http", m.Tags["url.scheme"]); 429Assert.Equal("POST", m.Tags["http.request.method"]); 444Assert.Equal("http", m.Tags["url.scheme"]); 445Assert.Equal("POST", m.Tags["http.request.method"]); 450Assert.Equal("http", m.Tags["url.scheme"]); 451Assert.Equal("POST", m.Tags["http.request.method"]);
HostingMetricsTests.cs (6)
95Assert.Equal(httpVersion, (string)measurement.Tags["network.protocol.version"]); 96Assert.Equal(statusCode, (int)measurement.Tags["http.response.status_code"]); 99Assert.False(measurement.Tags.ContainsKey("error.type")); 103Assert.Equal(exceptionName, (string)measurement.Tags["error.type"]); 107Assert.True((bool)measurement.Tags["aspnetcore.request.is_unhandled"]); 111Assert.False(measurement.Tags.ContainsKey("aspnetcore.request.is_unhandled"));
Microsoft.AspNetCore.Http.Connections.Tests (3)
HttpConnectionDispatcherTests.cs (3)
1169Assert.Equal(transportType.ToString(), (string)measurement.Tags["signalr.transport"]); 1175Assert.Equal(status.ToString(), (string)measurement.Tags["signalr.connection.status"]); 1176Assert.Equal(transportType.ToString(), (string)measurement.Tags["signalr.transport"]);
Microsoft.AspNetCore.RateLimiting.Tests (5)
RateLimitingMetricsTests.cs (5)
58Assert.Equal("global_limiter", (string)m.Tags["aspnetcore.rate_limiting.result"]); 117Assert.Equal("acquired", (string)m.Tags["aspnetcore.rate_limiting.result"]); 238Assert.Equal("acquired", (string)m.Tags["aspnetcore.rate_limiting.result"]); 314AssertTag(measurement.Tags, "aspnetcore.rate_limiting.policy", policy); 320AssertTag(measurement.Tags, "aspnetcore.rate_limiting.policy", policy);
Microsoft.AspNetCore.Routing.Tests (4)
RoutingMetricsTests.cs (4)
139Assert.Equal("failure", (string)measurement.Tags["aspnetcore.routing.match_status"]); 145Assert.Equal("success", (string)measurement.Tags["aspnetcore.routing.match_status"]); 146Assert.Equal(route, (string)measurement.Tags["http.route"]); 147Assert.Equal(fallback, (bool)measurement.Tags["aspnetcore.routing.is_fallback"]);
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (3)
TelemetryHealthChecksPublisherTests.cs (3)
114latest.Tags.Should().ContainKey("dotnet.health_check.status").WhoseValue.Should().Be(expectedMetricStatus); 142if (counter!.Tags["dotnet.health_check.name"]?.ToString() == healthy && 143counter!.Tags["dotnet.health_check.status"]?.ToString() == status)
Microsoft.Extensions.Diagnostics.Testing (4)
Metrics\CollectedMeasurement.cs (4)
63if (!Tags.TryGetValue(kvp.Key, out var value)) 86if (!Tags.ContainsKey(key)) 100public bool MatchesTags(params KeyValuePair<string, object?>[] tags) => ContainsTags(tags) && (Tags.Count == tags.Length); 107public bool MatchesTags(params string[] tags) => ContainsTags(Throw.IfNull(tags)) && (Tags.Count == tags.Length);
Microsoft.Extensions.Diagnostics.Testing.Tests (23)
Metrics\MeasurementExtensionsTests.cs (12)
31Assert.Equal(2, filtered[1].Tags.Count); 32Assert.True(filtered[1].Tags.ContainsKey("A")); 33Assert.True(filtered[1].Tags.ContainsKey("B")); 56Assert.Equal(2, filtered[1].Tags.Count); 57Assert.True(filtered[1].Tags.ContainsKey("A")); 58Assert.True(filtered[1].Tags.ContainsKey("B")); 81Assert.Equal(2, filtered[1].Tags.Count); 82Assert.True(filtered[1].Tags.ContainsKey("A")); 83Assert.True(filtered[1].Tags.ContainsKey("B")); 109Assert.Equal(2, filtered[1].Tags.Count); 110Assert.True(filtered[1].Tags.ContainsKey("A")); 111Assert.True(filtered[1].Tags.ContainsKey("B"));
Metrics\MetricCollectorTests.cs (11)
66Assert.Empty(collector.LastMeasurement.Tags); 76Assert.Empty(collector.LastMeasurement.Tags); 111Assert.Empty(collector.LastMeasurement.Tags); 121Assert.Empty(collector.LastMeasurement.Tags); 158Assert.Empty(collector.LastMeasurement.Tags); 168Assert.Empty(collector.LastMeasurement.Tags); 219Assert.Empty(collector.LastMeasurement.Tags); 229Assert.Empty(collector.LastMeasurement.Tags); 403Assert.Empty(snap[0].Tags); 407Assert.Empty(snap[1].Tags); 411Assert.Empty(snap[2].Tags);
Microsoft.Gen.Metrics.Generated.Tests (44)
MetricTests.cs (30)
57Assert.All(measurements, x => Assert.Empty(x.Tags)); 71Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val2") }, measurement.Tags.Select(x => (x.Key, x.Value))); 84Assert.All(measurements, x => Assert.Empty(x.Tags)); 98var tag = Assert.Single(measurement.Tags); 112Assert.All(measurements, x => Assert.Empty(x.Tags)); 126var tag = Assert.Single(measurement.Tags); 140Assert.All(measurements, x => Assert.Empty(x.Tags)); 154Assert.Equal(new (string, object?)[] { ("s1", "val_1"), ("s2", "val_2") }, measurement.Tags.Select(x => (x.Key, x.Value))); 174var tags = measurements[0].Tags.Select(x => (x.Key, x.Value)); 177tags = measurements[1].Tags.Select(x => (x.Key, x.Value)); 198var tags = measurements[0].Tags.Select(x => (x.Key, x.Value)); 201tags = measurements[1].Tags.Select(x => (x.Key, x.Value)); 253Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val2") }, measurement.Tags.Select(x => (x.Key, x.Value))); 259Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val2") }, measurement.Tags.Select(x => (x.Key, x.Value))); 266Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val4") }, measurement.Tags.Select(x => (x.Key, x.Value))); 278Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val2") }, measurement.Tags.Select(x => (x.Key, x.Value))); 284Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val2") }, measurement.Tags.Select(x => (x.Key, x.Value))); 291Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val4") }, measurement.Tags.Select(x => (x.Key, x.Value))); 303Assert.Empty(measurement.Tags); 316Assert.Empty(measurement.Tags); 329Assert.Equal(new (string, object?)[] { ("Dim1", "val1"), ("Dim_2", "val2"), ("Dim_3", "val3") }, measurement.Tags.Select(x => (x.Key, x.Value))); 342Assert.Equal(new (string, object?)[] { ("Dim1", "val1"), ("Dim_2", "val2"), ("Dim_3", "val3") }, measurement.Tags.Select(x => (x.Key, x.Value))); 372measurement.Tags.Select(x => (x.Key, x.Value))); 421measurement.Tags.Select(x => (x.Key, x.Value))); 444measurement.Tags.Select(x => (x.Key, x.Value))); 467measurement.Tags.Select(x => (x.Key, x.Value))); 515measurement.Tags.Select(x => (x.Key, x.Value))); 564measurement.Tags.Select(x => (x.Key, x.Value))); 587measurement.Tags.Select(x => (x.Key, x.Value))); 609measurement.Tags.Select(x => (x.Key, x.Value)));
MetricTests.Ext.cs (14)
43Assert.All(measurements, x => Assert.Empty(x.Tags)); 55Assert.Equal(new (string, object?)[] { ("s1", "val1"), ("s2", "val2") }, measurement.Tags.Select(x => (x.Key, x.Value))); 68Assert.All(measurements, x => Assert.Empty(x.Tags)); 81var tag = Assert.Single(measurement.Tags); 95Assert.All(measurements, x => Assert.Empty(x.Tags)); 108var tag = Assert.Single(measurement.Tags); 122Assert.All(measurements, x => Assert.Empty(x.Tags)); 135Assert.Equal(new (string, object?)[] { ("s1", "val_1"), ("s2", "val_2") }, measurement.Tags.Select(x => (x.Key, x.Value))); 184measurement.Tags.Select(x => (x.Key, x.Value))); 206measurement.Tags.Select(x => (x.Key, x.Value))); 228measurement.Tags.Select(x => (x.Key, x.Value))); 277measurement.Tags.Select(x => (x.Key, x.Value))); 299measurement.Tags.Select(x => (x.Key, x.Value))); 321measurement.Tags.Select(x => (x.Key, x.Value)));
Sockets.FunctionalTests (7)
src\Servers\Kestrel\test\FunctionalTests\RequestTests.cs (2)
627Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 727Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.AbortedByApp, m.Tags));
src\Servers\Kestrel\test\FunctionalTests\ResponseTests.cs (5)
256Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 463MetricsAssert.NoError(measurement.Tags); 599Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.MinResponseDataRate, m.Tags)); 847Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.MinResponseDataRate, m.Tags)); 1088Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags));