/** * 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); }
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())); }
/** * 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"); }
/** * 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); }
/** * Creates a new instance of the counter. */ public BasicInformational(MonitorConfig config) : base(config.withAdditionalTag(DataSourceType.INFORMATIONAL)) { }
/** * 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; }
/** * Create a new builder initialized with the specified config. */ public Builder(MonitorConfig config) : this(config.getName()) { withTags(config.getTags()); withPublishingPolicy(config.getPublishingPolicy()); }
/** * 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); }
/** * Creates a new instance of the gauge. */ public MaxGauge(MonitorConfig config) : this(config, ClockWithOffset.INSTANCE) { }
/** * Creates a new instance of the counter. */ public BasicCounter(MonitorConfig config) : base(config.withAdditionalTag(DataSourceType.COUNTER)) { }
/** * Returns a copy of the current MonitorConfig. */ private MonitorConfig.Builder copy() { return(MonitorConfig.builder(name).withTags(tags).withPublishingPolicy(policy)); }
/** * Creates a new instance of the counter. */ public StepCounter(MonitorConfig config) : this(config, ClockWithOffset.INSTANCE) { }