Esempio n. 1
0
        public void TestPerformanceCounterValuesAreCorrectlyRetrievedUsingPerformanceCounterFromJsonGauge()
        {
            PerformanceCounterFromJsonGauge gauge = new PerformanceCounterFromJsonGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes", "privateBytes", AzureWebApEnvironmentVariables.App, new CacheHelperTests());
            MetricTelemetry metric = gauge.GetValueAndReset();

            Assert.IsTrue(metric.Value > 0);
        }
Esempio n. 2
0
        public void SumUpGaugeGetValueAndResetWorking()
        {
            SumUpGauge twoTimesPrivateBytes = new SumUpGauge("twoTimesPrivateBytes",
                                                             new PerformanceCounterFromJsonGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes * 2", "privateBytes", AzureWebApEnvironmentVariables.App, new CacheHelperTests()),
                                                             new PerformanceCounterFromJsonGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes", "privateBytes", AzureWebApEnvironmentVariables.App, new CacheHelperTests()));

            PerformanceCounterFromJsonGauge privateBytes = new PerformanceCounterFromJsonGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes", "privateBytes", AzureWebApEnvironmentVariables.App, new CacheHelperTests());

            MetricTelemetry expectedTelemetry = privateBytes.GetValueAndReset();
            MetricTelemetry actualTelemetry   = twoTimesPrivateBytes.GetValueAndReset();

            // twoTimesPrivateBytes is -greater than (privateBytes * 1.85) but lower than (privateBytes * 2.15).
            Assert.IsTrue((expectedTelemetry.Value * 1.85) < actualTelemetry.Value && (expectedTelemetry.Value * 2.15) > actualTelemetry.Value);
        }