Пример #1
0
        /**
         * Creates a new instance of the counter.
         */
        internal DoubleCounter(MonitorConfig config, Clock clock)
            : base(config.withAdditionalTag(DataSourceType.NORMALIZED))
        {
            // This class will reset the value so it is not a monotonically increasing value as
            // expected for type=COUNTER. This class looks like a counter to the user and a gauge to
            // the publishing pipeline receiving the value.

            count = new StepLong(0L, clock);
        }
Пример #2
0
        public override bool Equals(Object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null || !(obj is MonitorConfig))
            {
                return(false);
            }
            MonitorConfig m = (MonitorConfig)obj;

            return(name.Equals(m.getName()) &&
                   tags.Equals(m.getTags()) &&
                   policy.Equals(m.getPublishingPolicy()));
        }
Пример #3
0
 /**
  * Creates a new instance.
  *
  * @param config    config settings associated with the metric
  * @param timestamp point in time when the metric value was sampled
  * @param value     value of the metric
  */
 public Metric(MonitorConfig config, long timestamp, Object value)
 {
     this.config = Preconditions.checkNotNull(config, "config");
     this.timestamp = timestamp;
     this.value = Preconditions.checkNotNull(value, "value");
 }
Пример #4
0
 /**
  * Create a new composite.
  *
  * @param config   configuration for the composite. It is recommended that the configuration
  *                 shares common tags with the sub-monitors, but it is not enforced.
  * @param monitors list of sub-monitors
  */
 public BasicCompositeMonitor(MonitorConfig config, List <IMonitor> monitors)
     : base(config)
 {
     this.monitors = new List <IMonitor>(monitors);
 }
Пример #5
0
 /**
  * Creates a new instance of the counter.
  */
 public BasicInformational(MonitorConfig config)
     : base(config.withAdditionalTag(DataSourceType.INFORMATIONAL))
 {
 }
Пример #6
0
 /**
  * Creates a new instance of the gauge.
  *
  * @param config   configuration for this monitor
  * @param function a function used to fetch the value on demand
  */
 public BasicGauge(MonitorConfig config, Callable <T> function)
     : base(config.withAdditionalTag(DataSourceType.GAUGE))
 {
     this.function = function;
 }
Пример #7
0
 /**
  * Create a new builder initialized with the specified config.
  */
 public Builder(MonitorConfig config) : this(config.getName())
 {
     withTags(config.getTags());
     withPublishingPolicy(config.getPublishingPolicy());
 }
Пример #8
0
 /**
  * Creates a new instance of the gauge using a specific clock. Useful for unit testing.
  */
 internal MaxGauge(MonitorConfig config, Clock clock)
     : base(config.withAdditionalTag(DataSourceType.GAUGE))
 {
     max = new StepLong(0L, clock);
 }
Пример #9
0
 /**
  * Creates a new instance of the gauge.
  */
 public MaxGauge(MonitorConfig config)
     : this(config, ClockWithOffset.INSTANCE)
 {
 }
Пример #10
0
 /**
  * Creates a new instance of the counter.
  */
 public BasicCounter(MonitorConfig config)
     : base(config.withAdditionalTag(DataSourceType.COUNTER))
 {
 }
Пример #11
0
 /**
  * Create a new builder initialized with the specified config.
  */
 public Builder(MonitorConfig config) : this(config.getName())
 {
     withTags(config.getTags());
     withPublishingPolicy(config.getPublishingPolicy());
 }
Пример #12
0
 /**
  * Returns a copy of the current MonitorConfig.
  */
 private MonitorConfig.Builder copy()
 {
     return(MonitorConfig.builder(name).withTags(tags).withPublishingPolicy(policy));
 }
Пример #13
0
 /**
  * Creates a new instance of the counter.
  */
 public StepCounter(MonitorConfig config)
     : this(config, ClockWithOffset.INSTANCE)
 {
 }