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


C# Metric类代码示例

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


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


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