1 write to Tags
Microsoft.Extensions.Diagnostics.Testing (1)
Metrics\CollectedMeasurement.cs (1)
34Tags = d;
341 references to Tags
Aspire.Confluent.Kafka.Tests (60)
Aspire8MetricsTests.cs (60)
79Assert.Contains(collectorProducerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 80Assert.Contains(collectorProducerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 83Assert.Contains(collectorConsumerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 84Assert.Contains(collectorConsumerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 87Assert.Contains(collectorProducerQueueSize.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 88Assert.Contains(collectorProducerQueueSize.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 91Assert.Contains(collectorNetworkTx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 92Assert.Contains(collectorNetworkTx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 93Assert.Contains(collectorNetworkTx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 96Assert.Contains(collectorNetworkTransmitted.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 97Assert.Contains(collectorNetworkTransmitted.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 98Assert.Contains(collectorNetworkTransmitted.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 101Assert.Contains(collectorNetworkRx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 102Assert.Contains(collectorNetworkRx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 103Assert.Contains(collectorNetworkRx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 106Assert.Contains(collectorNetworkReceived.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 107Assert.Contains(collectorNetworkReceived.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 108Assert.Contains(collectorNetworkReceived.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 111Assert.Contains(collectorMessageTx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 112Assert.Contains(collectorMessageTx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 113Assert.Contains(collectorMessageTx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 116Assert.Contains(collectorMessageTransmitted.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 117Assert.Contains(collectorMessageTransmitted.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 118Assert.Contains(collectorMessageTransmitted.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 121Assert.Contains(collectorMessageRx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 122Assert.Contains(collectorMessageRx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 123Assert.Contains(collectorMessageRx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 126Assert.Contains(collectorMessageReceived.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 127Assert.Contains(collectorMessageReceived.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 128Assert.Contains(collectorMessageReceived.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 194Assert.Contains(collectorProducerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 195Assert.Contains(collectorProducerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 198Assert.Contains(collectorConsumerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 199Assert.Contains(collectorConsumerQueueMessageCount.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 202Assert.Contains(collectorProducerQueueSize.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 203Assert.Contains(collectorProducerQueueSize.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 206Assert.Contains(collectorNetworkTx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 207Assert.Contains(collectorNetworkTx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 208Assert.Contains(collectorNetworkTx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 211Assert.Contains(collectorNetworkTransmitted.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 212Assert.Contains(collectorNetworkTransmitted.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 213Assert.Contains(collectorNetworkTransmitted.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 216Assert.Contains(collectorNetworkRx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 217Assert.Contains(collectorNetworkRx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 218Assert.Contains(collectorNetworkRx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 221Assert.Contains(collectorNetworkReceived.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 222Assert.Contains(collectorNetworkReceived.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 223Assert.Contains(collectorNetworkReceived.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 226Assert.Contains(collectorMessageTx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 227Assert.Contains(collectorMessageTx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 228Assert.Contains(collectorMessageTx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 231Assert.Contains(collectorMessageTransmitted.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 232Assert.Contains(collectorMessageTransmitted.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 233Assert.Contains(collectorMessageTransmitted.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 236Assert.Contains(collectorMessageRx.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 237Assert.Contains(collectorMessageRx.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 238Assert.Contains(collectorMessageRx.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer"); 241Assert.Contains(collectorMessageReceived.LastMeasurement!.Tags, t => t.Key == "messaging.client_id" && t.Value!.ToString() == "rdkafka"); 242Assert.Contains(collectorMessageReceived.LastMeasurement!.Tags, t => t.Key == "name" && t.Value!.ToString() == "rdkafka#producer-1"); 243Assert.Contains(collectorMessageReceived.LastMeasurement!.Tags, t => t.Key == "type" && t.Value!.ToString() == "producer");
InMemory.FunctionalTests (73)
BadHttpRequestTests.cs (7)
189Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 253m => MetricsAssert.Equal(ConnectionEndReason.InvalidRequestLine, m.Tags)); 276m => MetricsAssert.Equal(ConnectionEndReason.InvalidHttpVersion, m.Tags)); 363Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(reason, m.Tags)); 436Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 505Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags)); 563Assert.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"]); 385Assert.Equal("value!", (string)m.Tags["custom"]); 386Assert.False(m.Tags.ContainsKey("test")); 752Assert.Equal("1.2", (string)m.Tags["tls.protocol.version"]); 753Assert.DoesNotContain("error.type", m.Tags.Keys); 760Assert.Equal("http", (string)measurement.Tags["network.protocol.name"]); 761Assert.Equal(httpVersion, (string)measurement.Tags["network.protocol.version"]); 912Assert.Equal(typeof(AuthenticationException).FullName, (string)m.Tags["error.type"]); 913Assert.DoesNotContain("tls.protocol.version", m.Tags.Keys); 933Assert.Equal(networkTransport, (string)measurement.Tags["network.transport"]); 934Assert.Equal(localAddress, (string)measurement.Tags["server.address"]); 937Assert.Equal(localPort, (int)measurement.Tags["server.port"]); 941Assert.DoesNotContain("server.port", measurement.Tags.Keys); 945Assert.Equal(networkType, (string)measurement.Tags["network.type"]); 949Assert.DoesNotContain("network.type", measurement.Tags.Keys); 953Assert.Equal("http", (string)measurement.Tags["network.protocol.name"]); 954Assert.Equal(httpVersion, (string)measurement.Tags["network.protocol.version"]); 958Assert.DoesNotContain("network.protocol.name", measurement.Tags.Keys); 959Assert.DoesNotContain("network.protocol.version", measurement.Tags.Keys); 963Assert.Equal(tlsProtocolVersion, (string)measurement.Tags["tls.protocol.version"]); 967Assert.DoesNotContain("tls.protocol.version", measurement.Tags.Keys); 971Assert.Equal(error, (string)measurement.Tags["error.type"]); 977Assert.DoesNotContain("error.type", measurement.Tags.Keys); 981throw new Exception($"Connection has unexpected error.type value: {measurement.Tags["error.type"]}", ex); 989Assert.Equal(networkTransport, (string)measurement.Tags["network.transport"]); 990Assert.Equal(localAddress, (string)measurement.Tags["server.address"]); 993Assert.Equal(localPort, (int)measurement.Tags["server.port"]); 997Assert.DoesNotContain("server.port", measurement.Tags.Keys); 1001Assert.Equal(networkType, (string)measurement.Tags["network.type"]); 1005Assert.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)
106Assert.Equal("ipv4", (string)m.Tags["network.type"]); 107Assert.Equal("http", (string)m.Tags["network.protocol.name"]); 108Assert.Equal("3", (string)m.Tags["network.protocol.version"]); 109Assert.Equal("udp", (string)m.Tags["network.transport"]); 110Assert.Equal("127.0.0.1", (string)m.Tags["server.address"]); 111Assert.Equal(host.GetPort(), (int)m.Tags["server.port"]); 112Assert.Equal("1.3", (string)m.Tags["tls.protocol.version"]);
Microsoft.AspNetCore.Authentication.Test (24)
AuthenticationMetricsTest.cs (24)
38Assert.Equal("custom", (string)measurement.Tags["aspnetcore.authentication.scheme"]); 39Assert.Equal("success", (string)measurement.Tags["aspnetcore.authentication.result"]); 40Assert.False(measurement.Tags.ContainsKey("error.type")); 66Assert.Equal("custom", (string)measurement.Tags["aspnetcore.authentication.scheme"]); 67Assert.Equal("failure", (string)measurement.Tags["aspnetcore.authentication.result"]); 68Assert.Equal("Microsoft.AspNetCore.Authentication.AuthenticationFailureException", (string)measurement.Tags["error.type"]); 94Assert.Equal("custom", (string)measurement.Tags["aspnetcore.authentication.scheme"]); 95Assert.Equal("none", (string)measurement.Tags["aspnetcore.authentication.result"]); 96Assert.False(measurement.Tags.ContainsKey("error.type")); 123Assert.Equal("custom", (string)measurement.Tags["aspnetcore.authentication.scheme"]); 124Assert.Equal("System.InvalidOperationException", (string)measurement.Tags["error.type"]); 125Assert.False(measurement.Tags.ContainsKey("aspnetcore.authentication.result")); 148Assert.Equal("custom", (string)measurement.Tags["aspnetcore.authentication.scheme"]); 175Assert.Equal("custom", (string)measurement.Tags["aspnetcore.authentication.scheme"]); 176Assert.Equal("System.InvalidOperationException", (string)measurement.Tags["error.type"]); 199Assert.Equal("custom", (string)measurement.Tags["aspnetcore.authentication.scheme"]); 226Assert.Equal("custom", (string)measurement.Tags["aspnetcore.authentication.scheme"]); 227Assert.Equal("System.InvalidOperationException", (string)measurement.Tags["error.type"]); 250Assert.Equal("custom", (string)measurement.Tags["aspnetcore.authentication.scheme"]); 277Assert.Equal("custom", (string)measurement.Tags["aspnetcore.authentication.scheme"]); 278Assert.Equal("System.InvalidOperationException", (string)measurement.Tags["error.type"]); 301Assert.Equal("custom", (string)measurement.Tags["aspnetcore.authentication.scheme"]); 328Assert.Equal("custom", (string)measurement.Tags["aspnetcore.authentication.scheme"]); 329Assert.Equal("System.InvalidOperationException", (string)measurement.Tags["error.type"]);
Microsoft.AspNetCore.Authorization.Test (20)
AuthorizationMetricsTest.cs (20)
33Assert.Equal("Basic", (string)measurement.Tags["aspnetcore.authorization.policy"]); 34Assert.Equal("success", (string)measurement.Tags["aspnetcore.authorization.result"]); 35Assert.True((bool)measurement.Tags["user.is_authenticated"]); 58Assert.Equal("Basic", (string)measurement.Tags["aspnetcore.authorization.policy"]); 59Assert.Equal("failure", (string)measurement.Tags["aspnetcore.authorization.result"]); 60Assert.False((bool)measurement.Tags["user.is_authenticated"]); 83Assert.Equal("UnknownPolicy", (string)measurement.Tags["aspnetcore.authorization.policy"]); 84Assert.Equal("System.InvalidOperationException", (string)measurement.Tags["error.type"]); 85Assert.False((bool)measurement.Tags["user.is_authenticated"]); 86Assert.False(measurement.Tags.ContainsKey("aspnetcore.authorization.result")); 112Assert.Equal("success", (string)measurement.Tags["aspnetcore.authorization.result"]); 113Assert.False((bool)measurement.Tags["user.is_authenticated"]); 114Assert.False(measurement.Tags.ContainsKey("aspnetcore.authorization.policy")); 137Assert.Equal("failure", (string)measurement.Tags["aspnetcore.authorization.result"]); 138Assert.False((bool)measurement.Tags["user.is_authenticated"]); 139Assert.False(measurement.Tags.ContainsKey("aspnetcore.authorization.policy")); 166Assert.Equal("System.InvalidOperationException", (string)measurement.Tags["error.type"]); 167Assert.False((bool)measurement.Tags["user.is_authenticated"]); 168Assert.False(measurement.Tags.ContainsKey("aspnetcore.authorization.policy")); 169Assert.False(measurement.Tags.ContainsKey("aspnetcore.authorization.result"));
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)
264Assert.Equal("http", m.Tags["url.scheme"]); 265Assert.Equal("POST", m.Tags["http.request.method"]); 280Assert.Equal("http", m.Tags["url.scheme"]); 281Assert.Equal("POST", m.Tags["http.request.method"]); 286Assert.Equal("http", m.Tags["url.scheme"]); 287Assert.Equal("POST", m.Tags["http.request.method"]); 323Assert.Equal("http", m.Tags["url.scheme"]); 324Assert.Equal("POST", m.Tags["http.request.method"]); 339Assert.Equal("http", m.Tags["url.scheme"]); 340Assert.Equal("POST", m.Tags["http.request.method"]); 345Assert.Equal("http", m.Tags["url.scheme"]); 346Assert.Equal("POST", m.Tags["http.request.method"]); 352Assert.Equal("hello/{name}", m.Tags["http.route"]); 383Assert.Equal("http", m.Tags["url.scheme"]); 384Assert.Equal("POST", m.Tags["http.request.method"]); 399Assert.Equal("http", m.Tags["url.scheme"]); 400Assert.Equal("POST", m.Tags["http.request.method"]); 405Assert.Equal("http", m.Tags["url.scheme"]); 406Assert.Equal("POST", m.Tags["http.request.method"]); 438Assert.Equal("http", m.Tags["url.scheme"]); 439Assert.Equal("POST", m.Tags["http.request.method"]); 454Assert.Equal("http", m.Tags["url.scheme"]); 455Assert.Equal("POST", m.Tags["http.request.method"]); 460Assert.Equal("http", m.Tags["url.scheme"]); 461Assert.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); 600Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.MinResponseDataRate, m.Tags)); 848Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.Equal(ConnectionEndReason.MinResponseDataRate, m.Tags)); 1089Assert.Collection(connectionDuration.GetMeasurementSnapshot(), m => MetricsAssert.NoError(m.Tags));