当前位置: 首页>>代码示例>>C#>>正文


C# TelemetryClient.TrackAggregateMetric方法代码示例

本文整理汇总了C#中Microsoft.ApplicationInsights.TelemetryClient.TrackAggregateMetric方法的典型用法代码示例。如果您正苦于以下问题:C# TelemetryClient.TrackAggregateMetric方法的具体用法?C# TelemetryClient.TrackAggregateMetric怎么用?C# TelemetryClient.TrackAggregateMetric使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.ApplicationInsights.TelemetryClient的用法示例。


在下文中一共展示了TelemetryClient.TrackAggregateMetric方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MaximumNumberOfAggregations

        public void MaximumNumberOfAggregations()
        {
            var propertyValues = new string[] { "Value1", "Value2", "Value3", "Value4", "Value4", "Value5", null, "Value6", "Value6", "Value7", "Value8" };

            var client = new TelemetryClient();

            for (int i = 1; i <= 2; i++)
            {
                for (int p1 = 0; p1 < propertyValues.Count(); p1++)
                {
                    for (int p2 = 0; p2 < propertyValues.Count(); p2++)
                    {
                        for (int p3 = 0; p3 < propertyValues.Count(); p3++)
                        {
                            client.TrackAggregateMetric("My Counter", 50 * i, propertyValues[p1], propertyValues[p2], propertyValues[p3]);
                        }
                    }
                }
            }

            Assert.AreEqual(1, AggregateMetrics.aggregationSets.Count);

            AggregationSet aggregationSet;
            AggregateMetrics.aggregationSets.TryGetValue(AggregateMetrics.aggregationSets.Keys.First(), out aggregationSet);

            Assert.AreEqual(5, aggregationSet.property1Values.Count);
            Assert.AreEqual(5, aggregationSet.property2Values.Count);
            Assert.AreEqual(5, aggregationSet.property3Values.Count);

            var aggregations = aggregationSet.RemoveAggregations();

            Assert.AreEqual((Constants.MaxPropertyCardinality + 2) * (Constants.MaxPropertyCardinality + 2) * (Constants.MaxPropertyCardinality + 2), aggregations.Count);
        }
开发者ID:xornand,项目名称:ApplicationInsights-SDK-Labs,代码行数:33,代码来源:AggregationSetLimitsTests.cs

示例2: Aggregation

        public void Aggregation()
        {
            var client = new TelemetryClient();

            client.TrackAggregateMetric("Test", 123.00);

            // Wait for aggregation timer
            Thread.Sleep(AggregateMetricsTelemetryModule.FlushInterval);
        }
开发者ID:xornand,项目名称:ApplicationInsights-SDK-Labs,代码行数:9,代码来源:CounterCollectionTests.cs

示例3: Property1ValuesAreLimitedToMaxCardinality

        public void Property1ValuesAreLimitedToMaxCardinality()
        {
            var propertyValues = new List<string>();
            propertyValues.Add("Value1");
            propertyValues.Add("Value2");
            propertyValues.Add("Value3");
            propertyValues.Add("Value4");
            propertyValues.Add("Value4");
            propertyValues.Add("Value4");
            propertyValues.Add("Value5");
            propertyValues.Add("Value6");
            propertyValues.Add("Value6");
            propertyValues.Add("Value7");

            var client = new TelemetryClient();
            foreach (string prop in propertyValues)
            {
                client.TrackAggregateMetric("MyCounter", 123.00, prop);
            }

            Assert.AreEqual(1, AggregateMetrics.aggregationSets.Count);

            AggregationSet aggregationSet;
            AggregateMetrics.aggregationSets.TryGetValue(AggregateMetrics.aggregationSets.Keys.First(), out aggregationSet);

            var aggregations = aggregationSet.RemoveAggregations();

            Assert.AreEqual(5, aggregationSet.property1Values.Count);
            Assert.AreEqual(6, aggregations.Count);

            propertyValues.Add("other");

            foreach (MetricsBag counterData in aggregations.Values)
            {
                Assert.IsTrue(propertyValues.Contains(counterData.Property1));
            }
        }
开发者ID:xornand,项目名称:ApplicationInsights-SDK-Labs,代码行数:37,代码来源:AggregationSetLimitsTests.cs

示例4: SimpleTrackCounterTwoProperties

        public void SimpleTrackCounterTwoProperties()
        {
            var client = new TelemetryClient();

            client.TrackAggregateMetric("Test", 123.00, "Machine1", "Role1");
        }
开发者ID:xornand,项目名称:ApplicationInsights-SDK-Labs,代码行数:6,代码来源:CounterCollectionTests.cs

示例5: SimpleTrackCounterSingleProperty

        public void SimpleTrackCounterSingleProperty()
        {
            var client = new TelemetryClient();

            client.TrackAggregateMetric("Test", 123.00, "Machine1");
        }
开发者ID:xornand,项目名称:ApplicationInsights-SDK-Labs,代码行数:6,代码来源:CounterCollectionTests.cs

示例6: SimpleTrackCounter

        public void SimpleTrackCounter()
        {
            var client = new TelemetryClient();

            client.TrackAggregateMetric("Test", 123.00);
        }
开发者ID:xornand,项目名称:ApplicationInsights-SDK-Labs,代码行数:6,代码来源:CounterCollectionTests.cs

示例7: NullName

        public void NullName()
        {
            var client = new TelemetryClient();

            client.TrackAggregateMetric(null, 123.00);
        }
开发者ID:xornand,项目名称:ApplicationInsights-SDK-Labs,代码行数:6,代码来源:CounterCollectionTests.cs

示例8: EmptyName

        public void EmptyName()
        {
            var client = new TelemetryClient();

            client.TrackAggregateMetric("", 123.00);
        }
开发者ID:xornand,项目名称:ApplicationInsights-SDK-Labs,代码行数:6,代码来源:CounterCollectionTests.cs


注:本文中的Microsoft.ApplicationInsights.TelemetryClient.TrackAggregateMetric方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。