예제 #1
0
        public void MissingHarvestLimit_ShouldNotGenerateHarvestLimitMetrics()
        {
            var eventHarvestConfig = new EventHarvestConfig
            {
                HarvestLimits = null
            };

            ConnectRespondsWithEventHarvestConfig(eventHarvestConfig);

            _connectionHandler.Connect();

            ShouldNotGenerateAnyEventHarvestSupportabilityMetrics();
        }
예제 #2
0
        public void ShouldGenerateReportPeriodSupportabilityMetric()
        {
            var eventHarvestConfig = new EventHarvestConfig
            {
                ReportPeriodMs = 5
            };

            ConnectRespondsWithEventHarvestConfig(eventHarvestConfig);

            _connectionHandler.Connect();

            ShouldGenerateSupportabilityMetric(MetricNames.SupportabilityEventHarvestReportPeriod, 5);
        }
예제 #3
0
        public void MissingReportPeriod_ShouldNotGenerateSupportabilityMetrics()
        {
            var eventHarvestConfig = new EventHarvestConfig
            {
                ReportPeriodMs = null
            };

            ConnectRespondsWithEventHarvestConfig(eventHarvestConfig);

            _connectionHandler.Connect();

            ShouldNotGenerateAnyEventHarvestSupportabilityMetrics();
        }
예제 #4
0
        public void ShouldGenerateHarvestLimitSupportabilityMetric(string eventType, string expectedMetricName)
        {
            var eventHarvestConfig = new EventHarvestConfig
            {
                ReportPeriodMs = 5000,
                HarvestLimits  = new Dictionary <string, int> {
                    { eventType, 10 }
                }
            };

            ConnectRespondsWithEventHarvestConfig(eventHarvestConfig);

            _connectionHandler.Connect();

            ShouldGenerateSupportabilityMetric(MetricNames.SupportabilityEventHarvestReportPeriod, 5000);
            ShouldGenerateSupportabilityMetric(expectedMetricName, 10);
        }
예제 #5
0
        public void MissingReportPeriod_ShouldNotGenerateHarvestLimitMetrics()
        {
            var eventHarvestConfig = new EventHarvestConfig
            {
                HarvestLimits = new Dictionary <string, int>
                {
                    { EventHarvestConfig.ErrorEventHarvestLimitKey, 1 },
                    { EventHarvestConfig.CustomEventHarvestLimitKey, 2 },
                    { EventHarvestConfig.TransactionEventHarvestLimitKey, 3 },
                    { EventHarvestConfig.SpanEventHarvestLimitKey, 4 }
                }
            };

            ConnectRespondsWithEventHarvestConfig(eventHarvestConfig);

            _connectionHandler.Connect();

            ShouldNotGenerateAnyEventHarvestSupportabilityMetrics();
        }
예제 #6
0
        private void GenerateFasterEventHarvestConfigMetrics(EventHarvestConfig eventHarvestConfig)
        {
            if (eventHarvestConfig == null)
            {
                return;
            }

            if (!eventHarvestConfig.ReportPeriodMs.HasValue)
            {
                return;
            }

            _agentHealthReporter.ReportSupportabilityCountMetric(MetricNames.SupportabilityEventHarvestReportPeriod, eventHarvestConfig.ReportPeriodMs.Value);

            var fasterEventHarvestEnabledTypes = new List <string>();

            if (GenerateHarvestLimitMetricIfAvailable(MetricNames.SupportabilityEventHarvestErrorEventHarvestLimit, eventHarvestConfig.ErrorEventHarvestLimit()))
            {
                fasterEventHarvestEnabledTypes.Add("Error events");
            }

            if (GenerateHarvestLimitMetricIfAvailable(MetricNames.SupportabilityEventHarvestCustomEventHarvestLimit, eventHarvestConfig.CustomEventHarvestLimit()))
            {
                fasterEventHarvestEnabledTypes.Add("Custom events");
            }

            if (GenerateHarvestLimitMetricIfAvailable(MetricNames.SupportabilityEventHarvestTransactionEventHarvestLimit, eventHarvestConfig.TransactionEventHarvestLimit()))
            {
                fasterEventHarvestEnabledTypes.Add("Transaction events");
            }

            if (GenerateHarvestLimitMetricIfAvailable(MetricNames.SupportabilityEventHarvestSpanEventHarvestLimit, eventHarvestConfig.SpanEventHarvestLimit()))
            {
                fasterEventHarvestEnabledTypes.Add("Span events");
            }

            if (fasterEventHarvestEnabledTypes.Count > 0)
            {
                Log.InfoFormat("The following events will be harvested every {1}ms: {0}", string.Join(", ", fasterEventHarvestEnabledTypes), eventHarvestConfig.ReportPeriodMs);
            }
        }