• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Metric类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Metric的典型用法代码示例。如果您正苦于以下问题:C# Metric类的具体用法?C# Metric怎么用?C# Metric使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Metric类属于命名空间,在下文中一共展示了Metric类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Log

 private static void Log(StringBuilder builder, Metric metric, List<object> metricValues)
 {
     if (metricValues == null || metricValues.Count == 0)
         LogHelper(builder, metric);
     else
         LogHelper(builder, metric, metricValues.ToArray());
 }
开发者ID:NathanSDunn,项目名称:aws-sdk-unity,代码行数:7,代码来源:Metrics.cs


示例2: RestClient_posts_metrics

        public async void RestClient_posts_metrics()
        {
            var metricName = GetUniqueMetricName();

            var dataPoint = new DataPoint(DateTime.UtcNow.MillisecondsSinceEpoch(), 5L);

            var metric = new Metric(metricName)
                .AddTag("route_id", "1")
                .AddDataPoint(dataPoint);

            await _client.AddMetricsAsync(new[] {metric});

            var query = new QueryBuilder()
                .SetStart(TimeSpan.FromSeconds(5))
                .AddQueryMetric(new QueryMetric(metricName));

            Thread.Sleep(TimeSpan.FromSeconds(2));

            var response = await _client.QueryMetricsAsync(query);

            response.Queries.Should().HaveCount(1);
            response.Queries[0].SampleSize.Should().Be(1);
            response.Queries[0].Results.Should().HaveCount(1);
            response.Queries[0].Results[0].DataPoints.Single().ShouldBeEquivalentTo(dataPoint);
        }
开发者ID:syncromatics,项目名称:KairosDbClientDotNet,代码行数:25,代码来源:RestClientTests.cs


示例3: PerformanceCounterMonitor

        /// <summary>
        ///		Create a new <see cref="PerformanceCounterMonitor"/> actor.
        /// </summary>
        /// <param name="seriesName">
        ///		The name of the data series that tracks the performance counter's value.
        /// </param>
        /// <param name="performanceCounterFactory">
        ///		A factory delegate that creates the <see cref="PerformanceCounter"/> to monitor.
        /// </param>
        public PerformanceCounterMonitor(string seriesName, Func<PerformanceCounter> performanceCounterFactory)
        {
            if (String.IsNullOrWhiteSpace(seriesName))
                throw new ArgumentException("Argument cannot be null, empty, or entirely componsed of whitespace: 'seriesName'.", nameof(seriesName));

            if (performanceCounterFactory == null)
                throw new ArgumentNullException(nameof(performanceCounterFactory));

            _seriesName = seriesName;
            _performanceCounterFactory = performanceCounterFactory;
            _cancelPublishing = new Cancelable(Context.System.Scheduler);

            Receive<GatherMetrics>(_ =>
            {
                Metric metric = new Metric(
                    _seriesName,
                    _performanceCounter.NextValue()
                );
                foreach (IActorRef subscriber in _subscribers)
                    subscriber.Tell(metric);
            });
            Receive<SubscribePerformanceCounter>(request =>
            {
                _subscribers.Add(request.Subscriber);
            });
            Receive<UnsubscribePerformanceCounter>(request =>
            {
                _subscribers.Remove(request.Subscriber);
            });
        }
开发者ID:tintoy,项目名称:akkadotnet-bootcamp-unit2,代码行数:39,代码来源:PerformanceCounterMonitor.cs


示例4: QueryMetricsAsync_uses_sum_aggregator

        public async void QueryMetricsAsync_uses_sum_aggregator()
        {
            var metricName = GetUniqueMetricName();

            var time = DateTime.UtcNow.MillisecondsSinceEpoch();

            var dataPoint = new DataPoint(time, 10L);
            var dataPoint2 = new DataPoint(time + 1, 30L);

            var metric = new Metric(metricName)
                .AddTag("route_id", "1")
                .AddDataPoint(dataPoint2)
                .AddDataPoint(dataPoint);

            await _client.AddMetricsAsync(new[] { metric });

            var queryMetric = new QueryMetric(metricName)
                .AddAggregator(new SumAggregator(1, TimeUnit.Minutes));

            var query = new QueryBuilder()
                .SetStart(TimeSpan.FromSeconds(10))
                .AddQueryMetric(queryMetric);

            Thread.Sleep(TimeSpan.FromSeconds(2));

            var response = await _client.QueryMetricsAsync(query);

            response.Queries.Should().HaveCount(1);
            response.Queries[0].Results.Should().HaveCount(1);
            response.Queries[0].Results[0].DataPoints.Single().Value.Should().Be(40L);
        }
开发者ID:syncromatics,项目名称:KairosDbClientDotNet,代码行数:31,代码来源:RestClientTests.cs


示例5: Publish

 public async Task Publish(Metric[] metrics)
 {
     foreach (var metric in metrics)
     {
         Publish(metric);
     }
 }
开发者ID:domaslasauskas,项目名称:Metricano,代码行数:7,代码来源:ConsolePublisher.cs


示例6: ViewDidLoad

        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();

            AddPullToRefresh ();

            // add the nav button.
            UIBarButtonItem addButton = new UIBarButtonItem (UIBarButtonSystemItem.Add);
            addButton.Clicked += async (sender, e) => {

                var addController = new AddCheckinViewController();
                this.NavigationController.PushViewController(addController,true);
                _dataSource.Clear();

                var result = await Buddy.RecordMetricAsync("adding_checkin", null, TimeSpan.FromDays(1));

                if (result.IsSuccess) {
                    _timedMetric = result.Value;
                }
            };

            this.NavigationItem.RightBarButtonItem = addButton;

            UIBarButtonItem logoutButton = new UIBarButtonItem ("Logout", UIBarButtonItemStyle.Plain, 
                async (s, e) => {
                    await Buddy.LogoutUserAsync();
                });

            this.NavigationItem.LeftBarButtonItem = logoutButton;

            _dataSource = new CheckinDataSource (this);
            this.checkinTable.Source = _dataSource;
        }
开发者ID:jeacott,项目名称:Buddy-DotNET-SDK,代码行数:33,代码来源:HomeScreenViewController.cs


示例7: IsMetricMatch

        public bool IsMetricMatch(Metric metric)
        {
            if (metric == null)
                return false;

            return this.typeCheck.IsMatch(metric.Type)
                && this.backend.SupportedTypes.Contains(metric.Type, StringComparer.OrdinalIgnoreCase);
        }
开发者ID:belegoth,项目名称:LogMonitor,代码行数:8,代码来源:OutputTarget.cs


示例8: TracerFactory

 public TracerFactory(string metricName, string name, string transactionNamingPriority, Metric metric)
     : this()
 {
     this.Name = name;
     this.TransactionNamingPriority = transactionNamingPriority;
     this.MetricName = metricName;
     this.Metric = metric;
 }
开发者ID:Pablissimo,项目名称:nrconfig,代码行数:8,代码来源:TracerFactory.cs


示例9: IsRouted

 public static Action<StatrContext> IsRouted(Metric metric)
 {
     return context =>
     {
         var router = context.Container.Resolve<IMetricRouter>();
         router.Route(metric);
     };
 }
开发者ID:jonnii,项目名称:statr,代码行数:8,代码来源:TheMetric.cs


示例10: NotifyMetric

 public void NotifyMetric(Metric metric)
 {
     var handler = MetricReceived;
     if (handler != null)
     {
         handler(this, new MetricEventArgs(metric));
     }
 }
开发者ID:charlieridley,项目名称:statr,代码行数:8,代码来源:MetricRoute.cs


示例11: InstrumentationTarget

 public InstrumentationTarget(IMethodDetails target, string metricName, string name, string transactionNamingPriority, Metric metric)
 {
     this.Target = target;
     this.MetricName = metricName;
     this.Name = name;
     this.TransactionNamingPriority = transactionNamingPriority;
     this.Metric = metric;
 }
开发者ID:Pablissimo,项目名称:nrconfig,代码行数:8,代码来源:InstrumentationTarget.cs


示例12: TryAppend

 public bool TryAppend(Metric metric, Encoding encoding)
 {
     try {
         position += metric.GetBytes(encoding, bytes, position);
         return true;
     } catch(ArgumentException) {
         return false;
     }
 }
开发者ID:drunkcod,项目名称:StatsSharp,代码行数:9,代码来源:Dgram.cs


示例13: InstrumentAttribute

        public InstrumentAttribute(string metricName, string name, string transactionNamingPriority, Metric metric)
        {
            this.Scopes = InstrumentationScopes.All;

            this.Name = name;
            this.TransactionNamingPriority = transactionNamingPriority;
            this.MetricName = metricName;
            this.Metric = metric;
        }
开发者ID:Pablissimo,项目名称:nrconfig,代码行数:9,代码来源:InstrumentAttribute.cs


示例14: parsing

		public void parsing(string input, string name, string value, MetricType type) {
			var result = new Metric();
			Check.That(
				() => Metric.TryParse(input, out result),
				() => result.Name == name,
				() => result.Value.ToString() == value,
				() => result.Value.Type == type
			);
		}
开发者ID:drunkcod,项目名称:StatsSharp,代码行数:9,代码来源:MetricSpec.cs


示例15: Timer

        public Timer(
            Metric.Client.ITimingCompletionRecorder timingCompletionRecorder,
            string key)
        {
            this.c_timingCompletionRecorder = timingCompletionRecorder;
            this.c_key = key;

            this.c_stopWatch = Stopwatch.StartNew();
        }
开发者ID:pmcgrath,项目名称:metrics,代码行数:9,代码来源:Timer.cs


示例16: Parse

        public Metric Parse(string block)
        {
            var metric = new Metric {
                Name = ExtractName(block),
                Value = resultCounter.Matches(block).Count,
                Warning = block.Contains("<h3>Warning:"),
                Error = block.Contains("<h3>Error:")
            };

            return metric;
        }
开发者ID:RichardSlater,项目名称:NitriqTeamCity,代码行数:11,代码来源:MetricParser.cs


示例17: Aggregate

        public AggregatedMetric Aggregate(AggregatedMetric original, Metric metric)
        {
            var countMetric = metric;

            return new AggregatedMetric
            {
                LastValue = countMetric.Value,
                NumMetrics = ++original.NumMetrics,
                Value = original.Value + countMetric.Value
            };
        }
开发者ID:jonnii,项目名称:statr,代码行数:11,代码来源:AccumulateAggregationStrategy.cs


示例18: SendMetric

 public static void SendMetric(Metric metric, object metricObject)
 {
     try
     {
         AnalyticsSoapClient client = new AnalyticsSoapClient();
         client.UpdateAnalyticAsync(getGuid(), metric.ToString(), metricObject.ToString());
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.StackTrace);
     }
 }
开发者ID:LimeyJohnson,项目名称:RandomProjects,代码行数:12,代码来源:Analytics.cs


示例19: Submit

        public void Submit(Metric metric, string metricsPrefix)
        {
            if (this.disposed)
                throw new ObjectDisposedException(typeof(StatsDBackend).Name);

            if (!supportedTypes.Contains(metric.Type, StringComparer.OrdinalIgnoreCase))
                throw new ArgumentException("Metric type not supported.", "metric");

            this.graphiteChannel.Report(
                Helper.BuildKey(metric.Key, metricsPrefix),
                (int)metric.Value);
        }
开发者ID:belegoth,项目名称:LogMonitor,代码行数:12,代码来源:GraphiteBackend.cs


示例20: ShouldCallFormatterOnceWhenPassedOneStatistic

        public void ShouldCallFormatterOnceWhenPassedOneStatistic()
        {
            var statistics = new Metric[] {
                new Metric { Name = "Test Metric" }
            };

            var builder = new TeamCityInfoBuilder(_formatterMock.Object);

            builder.AddStatistics(statistics);

            _formatterMock.Verify(m => m.Format(It.IsAny<string>()), Times.Once());
        }
开发者ID:RichardSlater,项目名称:NitriqTeamCity,代码行数:12,代码来源:WhenTestingTeamCityInfoBuilder.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MetricDB类代码示例发布时间:2022-05-24
下一篇:
C# MethodType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap