Ejemplo n.º 1
0
        StatsTimer(Builder builder) : base(builder.Config, builder.Context)
        {
            unit_ = builder.TimeUnit;

            // remove the count from the histogram, because we need to add a
            // tag for the time unit and this tag will make no sense for count
            // values.
            var snapshot_config =
                new SnapshotConfig.Builder(builder.SnapshotConfig)
                .WithCount(false)
                .Build();

            MetricConfig unit_config = builder
                                       .Config
                                       .WithAdditionalTag("unit", unit_.Name());

            MetricContext context = builder.Context;

            histogram_ = new Histogram(unit_config, snapshot_config, builder.Resevoir,
                                       context);

            Tag tag = MetricType.Counter.AsTag();

            count_ = new Counter(unit_config.WithAdditionalTag(tag), context);

            metrics_ = new ReadOnlyCollection <IMetric>(
                new IMetric[] {
                count_, new CompositMetricTransformer(histogram_, ConvertToUnit)
            });
        }
Ejemplo n.º 2
0
 public Builder(MetricConfig config)
 {
     Config         = config;
     TimeUnit       = TimeUnit.Seconds;
     Context        = MetricContext.ForCurrentProcess;
     Resevoir       = new ExponentiallyDecayingResevoir();
     SnapshotConfig = new SnapshotConfig.Builder().Build();
 }