Exemple #1
0
        public virtual void TestTag()
        {
            MetricsTag tag = Interns.Tag("t", "t desc", "t value");

            NUnit.Framework.Assert.AreSame("same tag", tag, Interns.Tag("t", "t desc", "t value"
                                                                        ));
        }
        /// <summary>
        /// Instantiates a new
        /// <see cref="MutableQuantiles"/>
        /// for a metric that rolls itself
        /// over on the specified time interval.
        /// </summary>
        /// <param name="name">of the metric</param>
        /// <param name="description">long-form textual description of the metric</param>
        /// <param name="sampleName">type of items in the stream (e.g., "Ops")</param>
        /// <param name="valueName">type of the values</param>
        /// <param name="interval">rollover interval (in seconds) of the estimator</param>
        public MutableQuantiles(string name, string description, string sampleName, string
                                valueName, int interval)
        {
            string ucName = StringUtils.Capitalize(name);
            string usName = StringUtils.Capitalize(sampleName);
            string uvName = StringUtils.Capitalize(valueName);
            string desc   = StringUtils.Uncapitalize(description);
            string lsName = StringUtils.Uncapitalize(sampleName);
            string lvName = StringUtils.Uncapitalize(valueName);

            numInfo = Interns.Info(ucName + "Num" + usName, string.Format("Number of %s for %s with %ds interval"
                                                                          , lsName, desc, interval));
            // Construct the MetricsInfos for the quantiles, converting to percentiles
            quantileInfos = new MetricsInfo[quantiles.Length];
            string nameTemplate = ucName + "%dthPercentile" + uvName;
            string descTemplate = "%d percentile " + lvName + " with " + interval + " second interval for "
                                  + desc;

            for (int i = 0; i < quantiles.Length; i++)
            {
                int percentile = (int)(100 * quantiles[i].quantile);
                quantileInfos[i] = Interns.Info(string.Format(nameTemplate, percentile), string.Format
                                                    (descTemplate, percentile));
            }
            estimator     = new SampleQuantiles(quantiles);
            this.interval = interval;
            scheduler.ScheduleAtFixedRate(new MutableQuantiles.RolloverSample(this), interval
                                          , interval, TimeUnit.Seconds);
        }
        public virtual void TestFields()
        {
            TestMetricsAnnotations.MyMetrics metrics = new TestMetricsAnnotations.MyMetrics();
            MetricsSource source = MetricsAnnotations.MakeSource(metrics);

            metrics.c1.Incr();
            metrics.c2.Incr();
            metrics.g1.Incr();
            metrics.g2.Incr();
            metrics.g3.Incr();
            metrics.r1.Add(1);
            metrics.s1.Add(1);
            metrics.rs1.Add("rs1", 1);
            MetricsRecordBuilder rb = MetricsAsserts.GetMetrics(source);

            Org.Mockito.Mockito.Verify(rb).AddCounter(Interns.Info("C1", "C1"), 1);
            Org.Mockito.Mockito.Verify(rb).AddCounter(Interns.Info("Counter2", "Counter2 desc"
                                                                   ), 1L);
            Org.Mockito.Mockito.Verify(rb).AddGauge(Interns.Info("G1", "G1"), 1);
            Org.Mockito.Mockito.Verify(rb).AddGauge(Interns.Info("G2", "G2"), 1);
            Org.Mockito.Mockito.Verify(rb).AddGauge(Interns.Info("G3", "g3 desc"), 1L);
            Org.Mockito.Mockito.Verify(rb).AddCounter(Interns.Info("R1NumOps", "Number of ops for r1"
                                                                   ), 1L);
            Org.Mockito.Mockito.Verify(rb).AddGauge(Interns.Info("R1AvgTime", "Average time for r1"
                                                                 ), 1.0);
            Org.Mockito.Mockito.Verify(rb).AddCounter(Interns.Info("S1NumOps", "Number of ops for s1"
                                                                   ), 1L);
            Org.Mockito.Mockito.Verify(rb).AddGauge(Interns.Info("S1AvgTime", "Average time for s1"
                                                                 ), 1.0);
            Org.Mockito.Mockito.Verify(rb).AddCounter(Interns.Info("Rs1NumOps", "Number of ops for rs1"
                                                                   ), 1L);
            Org.Mockito.Mockito.Verify(rb).AddGauge(Interns.Info("Rs1AvgTime", "Average time for rs1"
                                                                 ), 1.0);
        }
Exemple #4
0
        public virtual void TestInfoOverflow()
        {
            MetricsInfo i0 = Interns.Info("m0", "m desc");

            for (int i = 0; i < MaxInfoNames + 1; ++i)
            {
                Interns.Info("m" + i, "m desc");
                if (i < MaxInfoNames)
                {
                    NUnit.Framework.Assert.AreSame("m0 is still there", i0, Interns.Info("m0", "m desc"
                                                                                         ));
                }
            }
            NUnit.Framework.Assert.AreNotSame("m0 is gone", i0, Interns.Info("m0", "m desc"));
            MetricsInfo i1 = Interns.Info("m1", "m desc");

            for (int i_1 = 0; i_1 < MaxInfoDescs; ++i_1)
            {
                Interns.Info("m1", "m desc" + i_1);
                if (i_1 < MaxInfoDescs - 1)
                {
                    NUnit.Framework.Assert.AreSame("i1 is still there", i1, Interns.Info("m1", "m desc"
                                                                                         ));
                }
            }
            NUnit.Framework.Assert.AreNotSame("i1 is gone", i1, Interns.Info("m1", "m desc"));
        }
Exemple #5
0
        public virtual void TestTagOverflow()
        {
            MetricsTag t0 = Interns.Tag("t0", "t desc", "t value");

            for (int i = 0; i < MaxTagNames + 1; ++i)
            {
                Interns.Tag("t" + i, "t desc", "t value");
                if (i < MaxTagNames)
                {
                    NUnit.Framework.Assert.AreSame("t0 still there", t0, Interns.Tag("t0", "t desc",
                                                                                     "t value"));
                }
            }
            NUnit.Framework.Assert.AreNotSame("t0 is gone", t0, Interns.Tag("t0", "t desc", "t value"
                                                                            ));
            MetricsTag t1 = Interns.Tag("t1", "t desc", "t value");

            for (int i_1 = 0; i_1 < MaxTagValues; ++i_1)
            {
                Interns.Tag("t1", "t desc", "t value" + i_1);
                if (i_1 < MaxTagValues - 1)
                {
                    NUnit.Framework.Assert.AreSame("t1 is still there", t1, Interns.Tag("t1", "t desc"
                                                                                        , "t value"));
                }
            }
            NUnit.Framework.Assert.AreNotSame("t1 is gone", t1, Interns.Tag("t1", "t desc", "t value"
                                                                            ));
        }
 public virtual void GetMetrics(MetricsCollector collector, bool all)
 {
     collector.AddRecord("foo").SetContext("foocontext").AddCounter(Interns.Info("C1",
                                                                                 "C1 desc"), 1).EndRecord().AddRecord("bar").SetContext("barcontext").AddGauge(Interns.Info
                                                                                                                                                                   ("G1", "G1 desc"), 1);
     registry.Snapshot(collector.AddRecord(registry.Info()), all);
 }
Exemple #7
0
        protected internal virtual MetricsInfo GetInfo(Type cls, Metrics annotation)
        {
            string name  = annotation.Name();
            string about = annotation.About();
            string name2 = name.IsEmpty() ? cls.Name : name;

            return(Interns.Info(name2, about.IsEmpty() ? name2 : about));
        }
        public virtual void TestClasses()
        {
            MetricsRecordBuilder rb = MetricsAsserts.GetMetrics(MetricsAnnotations.MakeSource
                                                                    (new TestMetricsAnnotations.MyMetrics3()));
            MetricsCollector collector = rb.Parent();

            Org.Mockito.Mockito.Verify(collector).AddRecord(Interns.Info("MyMetrics3", "My metrics"
                                                                         ));
            Org.Mockito.Mockito.Verify(rb).Add(Interns.Tag(MsInfo.Context, "foo"));
        }
Exemple #9
0
 /// <summary>Add a tag to the metrics</summary>
 /// <param name="info">metadata of the tag</param>
 /// <param name="value">of the tag</param>
 /// <param name="override">existing tag if true</param>
 /// <returns>the registry (for keep adding tags etc.)</returns>
 public virtual Org.Apache.Hadoop.Metrics2.Lib.MetricsRegistry Tag(MetricsInfo info
                                                                   , string value, bool @override)
 {
     lock (this)
     {
         if (!@override)
         {
             CheckTagName(info.Name());
         }
         tagsMap[info.Name()] = Interns.Tag(info, value);
         return(this);
     }
 }
Exemple #10
0
 protected internal virtual MetricsInfo GetInfo(Metric annotation, string defaultName
                                                )
 {
     string[] value = annotation.Value();
     if (value.Length == 2)
     {
         return(Interns.Info(value[0], value[1]));
     }
     if (value.Length == 1)
     {
         return(Interns.Info(defaultName, value[0]));
     }
     return(Interns.Info(defaultName, defaultName));
 }
        public virtual void TestMethods()
        {
            TestMetricsAnnotations.MyMetrics2 metrics = new TestMetricsAnnotations.MyMetrics2
                                                            ();
            MetricsSource        source = MetricsAnnotations.MakeSource(metrics);
            MetricsRecordBuilder rb     = MetricsAsserts.GetMetrics(source);

            Org.Mockito.Mockito.Verify(rb).AddGauge(Interns.Info("G1", "G1"), 1);
            Org.Mockito.Mockito.Verify(rb).AddGauge(Interns.Info("G2", "G2"), 2L);
            Org.Mockito.Mockito.Verify(rb).AddGauge(Interns.Info("G3", "G3"), 3.0f);
            Org.Mockito.Mockito.Verify(rb).AddGauge(Interns.Info("G4", "G4"), 4.0);
            Org.Mockito.Mockito.Verify(rb).AddCounter(Interns.Info("C1", "C1"), 1);
            Org.Mockito.Mockito.Verify(rb).AddCounter(Interns.Info("C2", "C2"), 2L);
            Org.Mockito.Mockito.Verify(rb).Tag(Interns.Info("T1", "T1"), "t1");
        }
Exemple #12
0
        public virtual void TestAddByName()
        {
            MetricsRecordBuilder rb = MetricsAsserts.MockMetricsRecordBuilder();
            MetricsRegistry      r  = new MetricsRegistry("test");

            r.Add("s1", 42);
            r.Get("s1").Snapshot(rb);
            Org.Mockito.Mockito.Verify(rb).AddCounter(Interns.Info("S1NumOps", "Number of ops for s1"
                                                                   ), 1L);
            Org.Mockito.Mockito.Verify(rb).AddGauge(Interns.Info("S1AvgTime", "Average time for s1"
                                                                 ), 42.0);
            r.NewCounter("c1", "test add", 1);
            r.NewGauge("g1", "test add", 1);
            ExpectMetricsException("Unsupported add", new _Runnable_114(r));
            ExpectMetricsException("Unsupported add", new _Runnable_119(r));
        }
Exemple #13
0
        /// <summary>
        /// Ensure that quantile estimates from
        /// <see cref="MutableQuantiles"/>
        /// are within
        /// specified error bounds.
        /// </summary>
        /// <exception cref="System.Exception"/>
        public virtual void TestMutableQuantilesError()
        {
            MetricsRecordBuilder mb       = MetricsAsserts.MockMetricsRecordBuilder();
            MetricsRegistry      registry = new MetricsRegistry("test");
            // Use a 5s rollover period
            MutableQuantiles quantiles = registry.NewQuantiles("foo", "stat", "Ops", "Latency"
                                                               , 5);
            // Push some values in and wait for it to publish
            long start = Runtime.NanoTime() / 1000000;

            for (long i = 1; i <= 1000; i++)
            {
                quantiles.Add(i);
                quantiles.Add(1001 - i);
            }
            long end = Runtime.NanoTime() / 1000000;

            Thread.Sleep(6000 - (end - start));
            registry.Snapshot(mb, false);
            // Print out the snapshot
            IDictionary <Quantile, long> previousSnapshot = quantiles.previousSnapshot;

            foreach (KeyValuePair <Quantile, long> item in previousSnapshot)
            {
                System.Console.Out.WriteLine(string.Format("Quantile %.2f has value %d", item.Key
                                                           .quantile, item.Value));
            }
            // Verify the results are within our requirements
            Org.Mockito.Mockito.Verify(mb).AddGauge(Interns.Info("FooNumOps", "Number of ops for stat with 5s interval"
                                                                 ), (long)2000);
            Quantile[] quants = MutableQuantiles.quantiles;
            string     name   = "Foo%dthPercentileLatency";
            string     desc   = "%d percentile latency with 5 second interval for stat";

            foreach (Quantile q in quants)
            {
                int    percentile = (int)(100 * q.quantile);
                int    error      = (int)(1000 * q.error);
                string n          = string.Format(name, percentile);
                string d          = string.Format(desc, percentile);
                long   expected   = (long)(q.quantile * 1000);
                Org.Mockito.Mockito.Verify(mb).AddGauge(Matchers.Eq(Interns.Info(n, d)), AdditionalMatchers.Leq
                                                            (expected + error));
                Org.Mockito.Mockito.Verify(mb).AddGauge(Matchers.Eq(Interns.Info(n, d)), AdditionalMatchers.Geq
                                                            (expected - error));
            }
        }
Exemple #14
0
        /// <summary>
        /// Test that
        /// <see cref="MutableQuantiles"/>
        /// rolls the window over at the specified
        /// interval.
        /// </summary>
        /// <exception cref="System.Exception"/>
        public virtual void TestMutableQuantilesRollover()
        {
            MetricsRecordBuilder mb       = MetricsAsserts.MockMetricsRecordBuilder();
            MetricsRegistry      registry = new MetricsRegistry("test");
            // Use a 5s rollover period
            MutableQuantiles quantiles = registry.NewQuantiles("foo", "stat", "Ops", "Latency"
                                                               , 5);

            Quantile[] quants = MutableQuantiles.quantiles;
            string     name   = "Foo%dthPercentileLatency";
            string     desc   = "%d percentile latency with 5 second interval for stat";
            // Push values for three intervals
            long start = Runtime.NanoTime() / 1000000;

            for (int i = 1; i <= 3; i++)
            {
                // Insert the values
                for (long j = 1; j <= 1000; j++)
                {
                    quantiles.Add(i);
                }
                // Sleep until 1s after the next 5s interval, to let the metrics
                // roll over
                long sleep = (start + (5000 * i) + 1000) - (Runtime.NanoTime() / 1000000);
                Thread.Sleep(sleep);
                // Verify that the window reset, check it has the values we pushed in
                registry.Snapshot(mb, false);
                foreach (Quantile q in quants)
                {
                    int    percentile = (int)(100 * q.quantile);
                    string n          = string.Format(name, percentile);
                    string d          = string.Format(desc, percentile);
                    Org.Mockito.Mockito.Verify(mb).AddGauge(Interns.Info(n, d), (long)i);
                }
            }
            // Verify the metrics were added the right number of times
            Org.Mockito.Mockito.Verify(mb, Org.Mockito.Mockito.Times(3)).AddGauge(Interns.Info
                                                                                      ("FooNumOps", "Number of ops for stat with 5s interval"), (long)1000);
            foreach (Quantile q_1 in quants)
            {
                int    percentile = (int)(100 * q_1.quantile);
                string n          = string.Format(name, percentile);
                string d          = string.Format(desc, percentile);
                Org.Mockito.Mockito.Verify(mb, Org.Mockito.Mockito.Times(3)).AddGauge(Matchers.Eq
                                                                                          (Interns.Info(n, d)), Matchers.AnyLong());
            }
        }
Exemple #15
0
        public virtual void TestSnapshot()
        {
            MetricsRecordBuilder mb       = MetricsAsserts.MockMetricsRecordBuilder();
            MetricsRegistry      registry = new MetricsRegistry("test");

            registry.NewCounter("c1", "int counter", 1);
            registry.NewCounter("c2", "long counter", 2L);
            registry.NewGauge("g1", "int gauge", 3);
            registry.NewGauge("g2", "long gauge", 4L);
            registry.NewStat("s1", "stat", "Ops", "Time", true).Add(0);
            registry.NewRate("s2", "stat", false).Add(0);
            registry.Snapshot(mb, true);
            MutableStat s2 = (MutableStat)registry.Get("s2");

            s2.Snapshot(mb, true);
            // should get the same back.
            s2.Add(1);
            s2.Snapshot(mb, true);
            // should get new interval values back
            Org.Mockito.Mockito.Verify(mb).AddCounter(Interns.Info("c1", "int counter"), 1);
            Org.Mockito.Mockito.Verify(mb).AddCounter(Interns.Info("c2", "long counter"), 2L);
            Org.Mockito.Mockito.Verify(mb).AddGauge(Interns.Info("g1", "int gauge"), 3);
            Org.Mockito.Mockito.Verify(mb).AddGauge(Interns.Info("g2", "long gauge"), 4L);
            Org.Mockito.Mockito.Verify(mb).AddCounter(Interns.Info("S1NumOps", "Number of ops for stat"
                                                                   ), 1L);
            Org.Mockito.Mockito.Verify(mb).AddGauge(Matchers.Eq(Interns.Info("S1AvgTime", "Average time for stat"
                                                                             )), AdditionalMatchers.Eq(0.0, Epsilon));
            Org.Mockito.Mockito.Verify(mb).AddGauge(Matchers.Eq(Interns.Info("S1StdevTime", "Standard deviation of time for stat"
                                                                             )), AdditionalMatchers.Eq(0.0, Epsilon));
            Org.Mockito.Mockito.Verify(mb).AddGauge(Matchers.Eq(Interns.Info("S1IMinTime", "Interval min time for stat"
                                                                             )), AdditionalMatchers.Eq(0.0, Epsilon));
            Org.Mockito.Mockito.Verify(mb).AddGauge(Matchers.Eq(Interns.Info("S1IMaxTime", "Interval max time for stat"
                                                                             )), AdditionalMatchers.Eq(0.0, Epsilon));
            Org.Mockito.Mockito.Verify(mb).AddGauge(Matchers.Eq(Interns.Info("S1MinTime", "Min time for stat"
                                                                             )), AdditionalMatchers.Eq(0.0, Epsilon));
            Org.Mockito.Mockito.Verify(mb).AddGauge(Matchers.Eq(Interns.Info("S1MaxTime", "Max time for stat"
                                                                             )), AdditionalMatchers.Eq(0.0, Epsilon));
            Org.Mockito.Mockito.Verify(mb, Org.Mockito.Mockito.Times(2)).AddCounter(Interns.Info
                                                                                        ("S2NumOps", "Number of ops for stat"), 1L);
            Org.Mockito.Mockito.Verify(mb, Org.Mockito.Mockito.Times(2)).AddGauge(Matchers.Eq
                                                                                      (Interns.Info("S2AvgTime", "Average time for stat")), AdditionalMatchers.Eq(0.0,
                                                                                                                                                                  Epsilon));
            Org.Mockito.Mockito.Verify(mb).AddCounter(Interns.Info("S2NumOps", "Number of ops for stat"
                                                                   ), 2L);
            Org.Mockito.Mockito.Verify(mb).AddGauge(Matchers.Eq(Interns.Info("S2AvgTime", "Average time for stat"
                                                                             )), AdditionalMatchers.Eq(1.0, Epsilon));
        }
Exemple #16
0
        /// <summary>
        /// Test that
        /// <see cref="MutableQuantiles"/>
        /// rolls over correctly even if no items
        /// have been added to the window
        /// </summary>
        /// <exception cref="System.Exception"/>
        public virtual void TestMutableQuantilesEmptyRollover()
        {
            MetricsRecordBuilder mb       = MetricsAsserts.MockMetricsRecordBuilder();
            MetricsRegistry      registry = new MetricsRegistry("test");
            // Use a 5s rollover period
            MutableQuantiles quantiles = registry.NewQuantiles("foo", "stat", "Ops", "Latency"
                                                               , 5);

            // Check it initially
            quantiles.Snapshot(mb, true);
            Org.Mockito.Mockito.Verify(mb).AddGauge(Interns.Info("FooNumOps", "Number of ops for stat with 5s interval"
                                                                 ), (long)0);
            Thread.Sleep(6000);
            quantiles.Snapshot(mb, false);
            Org.Mockito.Mockito.Verify(mb, Org.Mockito.Mockito.Times(2)).AddGauge(Interns.Info
                                                                                      ("FooNumOps", "Number of ops for stat with 5s interval"), (long)0);
        }
        public virtual void TestHybrid()
        {
            TestMetricsAnnotations.HybridMetrics metrics = new TestMetricsAnnotations.HybridMetrics
                                                               ();
            MetricsSource source = MetricsAnnotations.MakeSource(metrics);

            NUnit.Framework.Assert.AreSame(metrics, source);
            metrics.C0.Incr();
            MetricsRecordBuilder rb        = MetricsAsserts.GetMetrics(source);
            MetricsCollector     collector = rb.Parent();

            Org.Mockito.Mockito.Verify(collector).AddRecord("foo");
            Org.Mockito.Mockito.Verify(collector).AddRecord("bar");
            Org.Mockito.Mockito.Verify(collector).AddRecord(Interns.Info("HybridMetrics", "HybridMetrics"
                                                                         ));
            Org.Mockito.Mockito.Verify(rb).SetContext("foocontext");
            Org.Mockito.Mockito.Verify(rb).AddCounter(Interns.Info("C1", "C1 desc"), 1);
            Org.Mockito.Mockito.Verify(rb).SetContext("barcontext");
            Org.Mockito.Mockito.Verify(rb).AddGauge(Interns.Info("G1", "G1 desc"), 1);
            Org.Mockito.Mockito.Verify(rb).Add(Interns.Tag(MsInfo.Context, "hybrid"));
            Org.Mockito.Mockito.Verify(rb).AddCounter(Interns.Info("C0", "C0 desc"), 1);
            Org.Mockito.Mockito.Verify(rb).AddGauge(Interns.Info("G0", "G0"), 0);
        }
Exemple #18
0
        /// <summary>Construct a sample statistics metric</summary>
        /// <param name="name">of the metric</param>
        /// <param name="description">of the metric</param>
        /// <param name="sampleName">of the metric (e.g. "Ops")</param>
        /// <param name="valueName">of the metric (e.g. "Time", "Latency")</param>
        /// <param name="extended">create extended stats (stdev, min/max etc.) by default.</param>
        public MutableStat(string name, string description, string sampleName, string valueName
                           , bool extended)
        {
            string ucName = StringUtils.Capitalize(name);
            string usName = StringUtils.Capitalize(sampleName);
            string uvName = StringUtils.Capitalize(valueName);
            string desc   = StringUtils.Uncapitalize(description);
            string lsName = StringUtils.Uncapitalize(sampleName);
            string lvName = StringUtils.Uncapitalize(valueName);

            numInfo = Interns.Info(ucName + "Num" + usName, "Number of " + lsName + " for " +
                                   desc);
            avgInfo = Interns.Info(ucName + "Avg" + uvName, "Average " + lvName + " for " + desc
                                   );
            stdevInfo = Interns.Info(ucName + "Stdev" + uvName, "Standard deviation of " + lvName
                                     + " for " + desc);
            iMinInfo = Interns.Info(ucName + "IMin" + uvName, "Interval min " + lvName + " for "
                                    + desc);
            iMaxInfo = Interns.Info(ucName + "IMax" + uvName, "Interval max " + lvName + " for "
                                    + desc);
            minInfo       = Interns.Info(ucName + "Min" + uvName, "Min " + lvName + " for " + desc);
            maxInfo       = Interns.Info(ucName + "Max" + uvName, "Max " + lvName + " for " + desc);
            this.extended = extended;
        }
Exemple #19
0
 /// <summary>Construct the registry with a record name</summary>
 /// <param name="name">of the record of the metrics</param>
 public MetricsRegistry(string name)
 {
     metricsInfo = Interns.Info(name, name);
 }
Exemple #20
0
 /// <summary>Add a tag to the metrics</summary>
 /// <param name="name">of the tag</param>
 /// <param name="description">of the tag</param>
 /// <param name="value">of the tag</param>
 /// <param name="override">existing tag if true</param>
 /// <returns>the registry (for keep adding tags)</returns>
 public virtual Org.Apache.Hadoop.Metrics2.Lib.MetricsRegistry Tag(string name, string
                                                                   description, string value, bool @override)
 {
     return(Tag(Interns.Info(name, description), value, @override));
 }
Exemple #21
0
 /// <summary>Create a mutable long integer counter</summary>
 /// <param name="name">of the metric</param>
 /// <param name="desc">metric description</param>
 /// <param name="iVal">initial value</param>
 /// <returns>a new counter object</returns>
 public virtual MutableCounterLong NewCounter(string name, string desc, long iVal)
 {
     return(NewCounter(Interns.Info(name, desc), iVal));
 }
Exemple #22
0
        public virtual void TestInfo()
        {
            MetricsInfo info = Interns.Info("m", "m desc");

            NUnit.Framework.Assert.AreSame("same info", info, Interns.Info("m", "m desc"));
        }
Exemple #23
0
 internal static MetricsInfo MetricInfo(MethodInfo method)
 {
     return(Interns.Info(NameFrom(method), "Metric for " + method.Name));
 }
Exemple #24
0
 /// <summary>Create a mutable long integer gauge</summary>
 /// <param name="name">of the metric</param>
 /// <param name="desc">metric description</param>
 /// <param name="iVal">initial value</param>
 /// <returns>a new gauge object</returns>
 public virtual MutableGaugeLong NewGauge(string name, string desc, long iVal)
 {
     return(NewGauge(Interns.Info(name, desc), iVal));
 }