151 references to LastMeasurement
Aspire.Confluent.Kafka.Tests (82)
MetricsTests.cs (82)
79Assert.Equal(100, collectorProducerQueueMessageCount.LastMeasurement!.Value); 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"); 83Assert.Equal(100, collectorConsumerQueueMessageCount.LastMeasurement!.Value); 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"); 87Assert.Equal(1638400, collectorProducerQueueSize.LastMeasurement!.Value); 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"); 91Assert.Equal(5, collectorNetworkTx.LastMeasurement!.Value); 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"); 96Assert.Equal(1638400, collectorNetworkTransmitted.LastMeasurement!.Value); 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"); 101Assert.Equal(5, collectorNetworkRx.LastMeasurement!.Value); 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"); 106Assert.Equal(1638400, collectorNetworkReceived.LastMeasurement!.Value); 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"); 111Assert.Equal(5, collectorMessageTx.LastMeasurement!.Value); 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"); 116Assert.Equal(1638400, collectorMessageTransmitted.LastMeasurement!.Value); 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"); 121Assert.Equal(5, collectorMessageRx.LastMeasurement!.Value); 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"); 126Assert.Equal(1638400, collectorMessageReceived.LastMeasurement!.Value); 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"); 196Assert.Equal(200, collectorProducerQueueMessageCount.LastMeasurement!.Value); 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"); 200Assert.Equal(200, collectorConsumerQueueMessageCount.LastMeasurement!.Value); 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"); 204Assert.Equal(3276800, collectorProducerQueueSize.LastMeasurement!.Value); 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"); 208Assert.Equal(5, collectorNetworkTx.LastMeasurement!.Value); 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"); 213Assert.Equal(1638400, collectorNetworkTransmitted.LastMeasurement!.Value); 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"); 218Assert.Equal(5, collectorNetworkRx.LastMeasurement!.Value); 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"); 223Assert.Equal(1638400, collectorNetworkReceived.LastMeasurement!.Value); 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"); 228Assert.Equal(5, collectorMessageTx.LastMeasurement!.Value); 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"); 233Assert.Equal(1638400, collectorMessageTransmitted.LastMeasurement!.Value); 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"); 238Assert.Equal(5, collectorMessageRx.LastMeasurement!.Value); 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"); 243Assert.Equal(1638400, collectorMessageReceived.LastMeasurement!.Value); 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");
Microsoft.AspNetCore.HeaderParsing.Tests (2)
HeaderParsingFeatureTests.cs (2)
150var latest = metricCollector.LastMeasurement; 208var latest = metricCollector.LastMeasurement;
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (1)
TelemetryHealthChecksPublisherTests.cs (1)
109var latest = healthyMetricCollector.LastMeasurement;
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (18)
Windows\WindowsContainerSnapshotProviderTests.cs (9)
233Assert.NotNull(metricCollector.LastMeasurement); 234Assert.True(double.IsNaN(metricCollector.LastMeasurement.Value)); 240Assert.Equal(10, metricCollector.LastMeasurement.Value); // Consumed 10% of the CPU. 247Assert.Equal(10, metricCollector.LastMeasurement.Value); // Still consuming 10% as gauge wasn't updated. 254Assert.Equal(10, metricCollector.LastMeasurement.Value); // Consumed 10% of the CPU. 296Assert.NotNull(metricCollector.LastMeasurement?.Value); 297Assert.Equal(10, metricCollector.LastMeasurement.Value); // Consuming 10% of the memory initially. 302Assert.Equal(10, metricCollector.LastMeasurement.Value); // Still consuming 10% as gauge wasn't updated. 307Assert.Equal(30, metricCollector.LastMeasurement.Value); // Consuming 30% of the memory afterwards.
Windows\WindowsSnapshotProviderTests.cs (9)
93Assert.NotNull(metricCollector.LastMeasurement); 94Assert.True(double.IsNaN(metricCollector.LastMeasurement.Value)); 99Assert.Equal(5, metricCollector.LastMeasurement?.Value); // Consuming 5% of the CPU (2 CPUs, 1000 ticks, 1ms). 106Assert.Equal(5, metricCollector.LastMeasurement?.Value); // Still consuming 5% of the CPU 126Assert.NotNull(metricCollector.LastMeasurement); 127Assert.Equal(10, metricCollector.LastMeasurement.Value); // Consuming 5% of the memory initially 135Assert.Equal(10, metricCollector.LastMeasurement.Value); // Still consuming 10% as gauge wasn't updated. 141Assert.Equal(30, metricCollector.LastMeasurement.Value); // Consuming 30% of the memory afterwards 150Assert.Equal(100, metricCollector.LastMeasurement.Value); // Consuming 100% of the memory
Microsoft.Extensions.Diagnostics.Testing.Tests (48)
Metrics\MetricCollectorTests.cs (48)
53Assert.Null(collector.LastMeasurement); 60Assert.NotNull(collector.LastMeasurement); 64Assert.Same(collector.GetMeasurementSnapshot().Last(), collector.LastMeasurement); 65Assert.Equal(3, collector.LastMeasurement.Value); 66Assert.Empty(collector.LastMeasurement.Tags); 67Assert.Equal(now, collector.LastMeasurement.Timestamp); 74Assert.Same(collector.GetMeasurementSnapshot().Last(), collector.LastMeasurement); 75Assert.Equal(2, collector.LastMeasurement.Value); 76Assert.Empty(collector.LastMeasurement.Tags); 77Assert.Equal(timeProvider.GetUtcNow(), collector.LastMeasurement.Timestamp); 82Assert.Null(collector.LastMeasurement); 83Assert.Null(collector.LastMeasurement); 99Assert.Null(collector.LastMeasurement); 105Assert.NotNull(collector.LastMeasurement); 109Assert.Same(collector.GetMeasurementSnapshot().Last(), collector.LastMeasurement); 110Assert.Equal(3, collector.LastMeasurement.Value); 111Assert.Empty(collector.LastMeasurement.Tags); 112Assert.Equal(now, collector.LastMeasurement.Timestamp); 119Assert.Same(collector.GetMeasurementSnapshot().Last(), collector.LastMeasurement); 120Assert.Equal(2, collector.LastMeasurement.Value); 121Assert.Empty(collector.LastMeasurement.Tags); 122Assert.Equal(timeProvider.GetUtcNow(), collector.LastMeasurement.Timestamp); 127Assert.Null(collector.LastMeasurement); 128Assert.Null(collector.LastMeasurement); 146Assert.Null(collector.LastMeasurement); 152Assert.NotNull(collector.LastMeasurement); 156Assert.Same(collector.GetMeasurementSnapshot().Last(), collector.LastMeasurement); 157Assert.Equal(3, collector.LastMeasurement.Value); 158Assert.Empty(collector.LastMeasurement.Tags); 159Assert.Equal(now, collector.LastMeasurement.Timestamp); 166Assert.Same(collector.GetMeasurementSnapshot().Last(), collector.LastMeasurement); 167Assert.Equal(2, collector.LastMeasurement.Value); 168Assert.Empty(collector.LastMeasurement.Tags); 169Assert.Equal(timeProvider.GetUtcNow(), collector.LastMeasurement.Timestamp); 174Assert.Null(collector.LastMeasurement); 175Assert.Null(collector.LastMeasurement); 177Assert.Null(collector2.LastMeasurement); 207Assert.Null(collector.LastMeasurement); 213Assert.NotNull(collector.LastMeasurement); 217Assert.Same(collector.GetMeasurementSnapshot().Last(), collector.LastMeasurement); 218Assert.Equal(3, collector.LastMeasurement.Value); 219Assert.Empty(collector.LastMeasurement.Tags); 220Assert.Equal(now, collector.LastMeasurement.Timestamp); 227Assert.Same(collector.GetMeasurementSnapshot().Last(), collector.LastMeasurement); 228Assert.Equal(2, collector.LastMeasurement.Value); 229Assert.Empty(collector.LastMeasurement.Tags); 230Assert.Equal(timeProvider.GetUtcNow(), collector.LastMeasurement.Timestamp); 363Assert.Throws<ObjectDisposedException>(() => collector.LastMeasurement);