예제 #1
0
        public void should_add_class_tags_to_registered_metric()
        {
            var annottated           = new Annottated();
            ICompositeMetric metrics = AppMetrics.RegisterObject(annottated);

            Assert.That(HasTag(metrics.Config.Tags, "global-tag-name"), Is.True);
        }
예제 #2
0
        public void should_register_metric_fields()
        {
            var annottated           = new Annottated();
            ICompositeMetric metrics = AppMetrics.RegisterObject(annottated);

            Assert.That(metrics.Metrics.Count, Is.EqualTo(1));
        }
예제 #3
0
 IMetric GetMetricWithTag(ICompositeMetric metric, string value)
 {
     return
         (metric
          .Metrics
          .First(
              x =>
              x.Config.Tags.FirstOrDefault(t => t.Value == value) != null));
 }
예제 #4
0
        public void should_add_field_tags_to_regitered_metrics()
        {
            var annottated           = new Annottated();
            ICompositeMetric metrics = AppMetrics.RegisterObject(annottated);

            IMetric timer = metrics.Metrics.First();

            Assert.That(HasTag(timer.Config.Tags, "my-tag-name"), Is.True);
            Assert.That(HasTag(timer.Config.Tags, "my-second-tag-name"), Is.True);
        }
예제 #5
0
            public CompositeMetricWrapper(Tags tags, ICompositeMetric composite)
                : base(composite.Config.WithAdditionalTags(tags))
            {
                List <IMetric> wrapped =
                    composite
                    .Metrics
                    .Select(x => Wrap(x, Config.Tags))
                    .ToList();

                Metrics = new ReadOnlyCollection <IMetric>(wrapped);
            }
 public CompositMetricTransformer(ICompositeMetric metric,
                                  Func <ICollection <IMetric>, ICollection <IMetric> > transform)
 {
     metric_    = metric;
     transform_ = transform;
 }
예제 #7
0
 IMetric GetMetricWithTag(ICompositeMetric metric, string value) {
   return
     metric
       .Metrics
       .First(
         x =>
           x.Config.Tags.FirstOrDefault(t => t.Value == value) != null);
 }