Esempio n. 1
0
        private static void PackMetricWithSetItems <T, TU>(
            IMetricPayloadBuilder <T> payloadBuilder,
            Func <string, string, string> metricNameFormatter,
            string context,
            MetricValueSourceBase <TU> valueSource,
            MetricTags setItemTags,
            IDictionary <string, object> itemData,
            string metricSetItemSuffix)
        {
            var keys   = itemData.Keys.ToList();
            var values = keys.Select(k => itemData[k]);
            var tags   = ConcatMetricTags(valueSource, setItemTags);

            if (valueSource.IsMultidimensional)
            {
                payloadBuilder.Pack(
                    metricNameFormatter(context, valueSource.MultidimensionalName + metricSetItemSuffix),
                    keys,
                    values,
                    tags);

                return;
            }

            payloadBuilder.Pack(metricNameFormatter(context, valueSource.Name + metricSetItemSuffix), keys, values, tags);
        }
Esempio n. 2
0
        private static void PackMetricValue <T, TU>(
            IMetricPayloadBuilder <T> payloadBuilder,
            Func <string, string, string> metricNameFormatter,
            string context,
            MetricValueSourceBase <TU> valueSource,
            object value)
        {
            var tags = ConcatMetricTags(valueSource);

            if (valueSource.IsMultidimensional)
            {
                payloadBuilder.Pack(
                    metricNameFormatter(context, valueSource.MultidimensionalName),
                    value,
                    tags);

                return;
            }

            payloadBuilder.Pack(metricNameFormatter(context, valueSource.Name), value, tags);
        }
Esempio n. 3
0
        private static void PackMetric <T1, T2>(
            IMetricPayloadBuilder <T1> payloadBuilder,
            Func <string, string, string> metricNameFormatter,
            string context,
            MetricValueSourceBase <T2> valueSource,
            IDictionary <string, object> data)
        {
            var keys   = data.Keys.ToList();
            var values = keys.Select(k => data[k]);
            var tags   = ConcatMetricTags(valueSource);

            if (valueSource.IsMultidimensional)
            {
                payloadBuilder.Pack(
                    metricNameFormatter(context, valueSource.MultidimensionalName),
                    keys,
                    values,
                    tags);

                return;
            }

            payloadBuilder.Pack(metricNameFormatter(context, valueSource.Name), keys, values, tags);
        }