Example #1
0
        public IEnumerable <ApdexValueSource> SetupApdexScores()
        {
            var apdexValue = new ApdexValue(0.9, 170, 20, 10, 200);
            var apdex      = new ApdexValueSource("test_apdex", ConstantValue.Provider(apdexValue), Tags);

            return(new[] { apdex });
        }
Example #2
0
        private IEnumerable <ApdexValueSource> SetupApdexScores()
        {
            var apdexValue = new ApdexValue(0.9, 170, 20, 10, 200);
            var apdex      = new ApdexValueSource(ApdexNameDefault, ConstantValue.Provider(apdexValue), Tags);

            return(new[] { apdex });
        }
Example #3
0
 public static void AddApdexValues(this ApdexValue apdex, IDictionary <string, object> values)
 {
     values.Add("samples", apdex.SampleSize);
     values.Add("score", apdex.Score);
     values.Add("satisfied", apdex.Satisfied);
     values.Add("tolerating", apdex.Tolerating);
     values.Add("frustrating", apdex.Frustrating);
 }
Example #4
0
        public IEnumerable <ApdexValueSource> SetupApdexScores()
        {
            var apdexValue = new ApdexValue(0.9, 170, 20, 10, 200);
            var apdex      = new ApdexValueSource(ApdexNameDefault, ConstantValue.Provider(apdexValue), Tags);

            var apdexValueWithGroup = new ApdexValue(0.9, 170, 20, 10, 200);
            var apdexWithGroup      = new ApdexValueSource(ApdexNameWithGroup, GroupDefault, ConstantValue.Provider(apdexValueWithGroup), Tags);

            return(new[] { apdex, apdexWithGroup });
        }
 public static void AddApdexValues(
     this ApdexValue apdex,
     IDictionary <string, object> values,
     IDictionary <ApdexValueDataKeys, string> dataKeys)
 {
     values.Add(dataKeys[ApdexValueDataKeys.Samples], apdex.SampleSize);
     values.AddIfNotNanOrInfinity(dataKeys[ApdexValueDataKeys.Score], apdex.Score);
     values.Add(dataKeys[ApdexValueDataKeys.Satisfied], apdex.Satisfied);
     values.Add(dataKeys[ApdexValueDataKeys.Tolerating], apdex.Tolerating);
     values.Add(dataKeys[ApdexValueDataKeys.Frustrating], apdex.Frustrating);
 }
Example #6
0
        public static void AddApdexValues(
            this ApdexValue apdex,
            IDictionary <string, object> values,
            IDictionary <ApdexFields, string> fields)
        {
            if (values == null)
            {
                return;
            }

            fields.TryAddValuesForKey(values, ApdexFields.Samples, apdex.SampleSize);
            fields.TryAddValuesForKeyIfNotNanOrInfinity(values, ApdexFields.Score, apdex.Score);
            fields.TryAddValuesForKey(values, ApdexFields.Satisfied, apdex.Satisfied);
            fields.TryAddValuesForKey(values, ApdexFields.Tolerating, apdex.Tolerating);
            fields.TryAddValuesForKey(values, ApdexFields.Frustrating, apdex.Frustrating);
        }
        public void apdex_default_data_keys_should_provide_corresponding_values()
        {
            // Arrange
            var value = new ApdexValue(1, 2, 3, 4, 5);
            var data  = new Dictionary <string, object>();

            // Act
            value.AddApdexValues(data, DataKeys.Apdex);

            // Assert
            data[DataKeys.Apdex[ApdexValueDataKeys.Score]].Should().Be(1.0);
            data[DataKeys.Apdex[ApdexValueDataKeys.Satisfied]].Should().Be(2);
            data[DataKeys.Apdex[ApdexValueDataKeys.Tolerating]].Should().Be(3);
            data[DataKeys.Apdex[ApdexValueDataKeys.Frustrating]].Should().Be(4);
            data[DataKeys.Apdex[ApdexValueDataKeys.Samples]].Should().Be(5);
        }
        public void apdex_can_use_custom_data_keys_and_should_provide_corresponding_values()
        {
            // Arrange
            var value    = new ApdexValue(1, 2, 3, 4, 5);
            var data     = new Dictionary <string, object>();
            var dataKeys = new MetricValueDataKeys(
                apdex: new Dictionary <ApdexValueDataKeys, string>
            {
                { ApdexValueDataKeys.Samples, "size_of_sample" }
            });

            // Act
            value.AddApdexValues(data, dataKeys.Apdex);

            // Assert
            data.ContainsKey(DataKeys.Apdex[ApdexValueDataKeys.Samples]).Should().BeFalse();
            data["size_of_sample"].Should().Be(5);
        }
        public static ApdexValueSource ToMetricValueSource(this ApdexScore source)
        {
            var counterValue = new ApdexValue(source.Score, source.Satisfied, source.Tolerating, source.Frustrating, source.SampleSize);

            return(new ApdexValueSource(source.Name, ConstantValue.Provider(counterValue), source.Tags));
        }
        internal static void CopyTo(this ApdexValue value, MetricTelemetry mt)
        {
            var all = value.Satisfied + value.Tolerating + value.Frustrating;

            mt.Sum = (value.Satisfied + ((double)value.Tolerating / 2)) / all;
        }