com.netflix.spectator.impl.AtomicDouble Java Examples

The following examples show how to use com.netflix.spectator.impl.AtomicDouble. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GaugeImpl.java    From mantis with Apache License 2.0 5 votes vote down vote up
public GaugeImpl(final MetricId metricId,
                 final Registry registry) {
    this.metricId = metricId;
    final Id spectatorId = metricId.getSpectatorId(registry);
    this.value = PolledMeter.using(registry)
            .withId(spectatorId)
            .monitorValue(new AtomicDouble());
    this.event = spectatorId.toString();
}
 
Example #2
Source File: SpectatorMetricServices.java    From spring-cloud-netflix-contrib with Apache License 2.0 5 votes vote down vote up
@Override
public void submit(String name, double dValue) {
	long value = ((Double) dValue).longValue();
	if (name.startsWith("histogram.")) {
		registry.distributionSummary(stripMetricName(name)).record(value);
	} else if (name.startsWith("timer.")) {
		registry.timer(stripMetricName(name)).record(value, TimeUnit.MILLISECONDS);
	} else {
		final Id id = registry.createId(name);
		final AtomicDouble gauge = getGaugeStorage(id);
		gauge.set(dValue);
		registry.register(new NumericGauge(id, gauge));
	}
}
 
Example #3
Source File: StatelessDistributionSummary.java    From spectator with Apache License 2.0 5 votes vote down vote up
/** Create a new instance. */
StatelessDistributionSummary(Id id, Clock clock, long ttl) {
  super(id, clock, ttl);
  count = new AtomicLong(0);
  totalAmount = new AtomicLong(0);
  totalOfSquares = new AtomicDouble(0.0);
  max = new AtomicLong(0);
  stats = new Id[] {
      id.withTags(Statistic.count),
      id.withTags(Statistic.totalAmount),
      id.withTags(Statistic.totalOfSquares),
      id.withTags(Statistic.max)
  };
}
 
Example #4
Source File: StatelessTimer.java    From spectator with Apache License 2.0 5 votes vote down vote up
/** Create a new instance. */
StatelessTimer(Id id, Clock clock, long ttl) {
  super(id, clock, ttl);
  count = new AtomicLong(0);
  totalTime = new AtomicDouble(0);
  totalOfSquares = new AtomicDouble(0.0);
  max = new AtomicDouble(0);
  stats = new Id[] {
      id.withTags(Statistic.count),
      id.withTags(Statistic.totalTime),
      id.withTags(Statistic.totalOfSquares),
      id.withTags(Statistic.max)
  };
}
 
Example #5
Source File: AtlasGauge.java    From spectator with Apache License 2.0 5 votes vote down vote up
/** Create a new instance. */
AtlasGauge(Registry registry, Id id, Clock clock, long ttl) {
  super(id, clock, ttl);
  this.value = new AtomicDouble(0.0);
  // Add the statistic for typing. Re-adding the tags from the id is to retain
  // the statistic from the id if it was already set
  this.stat = registry.createId(id.name())
      .withTag(Statistic.gauge)
      .withTag(DsType.gauge)
      .withTags(id.tags());
}
 
Example #6
Source File: ServoCounter.java    From spectator with Apache License 2.0 5 votes vote down vote up
/** Create a new instance. */
ServoCounter(Id id, Clock clock, DoubleCounter impl) {
  this.id = id;
  this.clock = clock;
  this.impl = impl;
  this.count = new AtomicDouble(0.0);
  this.lastUpdated = new AtomicLong(clock.wallTime());
}
 
Example #7
Source File: ServoGauge.java    From spectator with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new monitor that returns {@code value}.
 */
ServoGauge(Id id, Clock clock, MonitorConfig config) {
  super(config.withAdditionalTag(DataSourceType.GAUGE));
  this.id = id;
  this.clock = clock;
  this.value = new AtomicDouble(Double.NaN);
  this.lastUpdated = new AtomicLong(clock.wallTime());
}
 
Example #8
Source File: SpectatorMetricServices.java    From spring-cloud-netflix-contrib with Apache License 2.0 4 votes vote down vote up
private AtomicDouble getGaugeStorage(Id id) {
	final AtomicDouble newGauge = new AtomicDouble(0);
	final AtomicDouble existingGauge = gauges.putIfAbsent(id, newGauge);
	return existingGauge == null ? newGauge : existingGauge;
}
 
Example #9
Source File: StatelessMaxGauge.java    From spectator with Apache License 2.0 4 votes vote down vote up
/** Create a new instance. */
StatelessMaxGauge(Id id, Clock clock, long ttl) {
  super(id, clock, ttl);
  value = new AtomicDouble(0.0);
  stat = id.withTag(Statistic.max).withTags(id.tags());
}
 
Example #10
Source File: StatelessGauge.java    From spectator with Apache License 2.0 4 votes vote down vote up
/** Create a new instance. */
StatelessGauge(Id id, Clock clock, long ttl) {
  super(id, clock, ttl);
  value = new AtomicDouble(Double.NaN);
  stat = id.withTag(Statistic.gauge).withTags(id.tags());
}
 
Example #11
Source File: StatelessCounter.java    From spectator with Apache License 2.0 4 votes vote down vote up
/** Create a new instance. */
StatelessCounter(Id id, Clock clock, long ttl) {
  super(id, clock, ttl);
  count = new AtomicDouble(0.0);
  stat = id.withTag(Statistic.count).withTags(id.tags());
}
 
Example #12
Source File: DefaultCounter.java    From spectator with Apache License 2.0 4 votes vote down vote up
/** Create a new instance. */
DefaultCounter(Clock clock, Id id) {
  this.clock = clock;
  this.id = id;
  this.count = new AtomicDouble(0.0);
}
 
Example #13
Source File: DefaultGauge.java    From spectator with Apache License 2.0 4 votes vote down vote up
/** Create a new instance. */
DefaultGauge(Clock clock, Id id) {
  this.clock = clock;
  this.id = id;
  this.value = new AtomicDouble(Double.NaN);
}
 
Example #14
Source File: DefaultMaxGauge.java    From spectator with Apache License 2.0 4 votes vote down vote up
/** Create a new instance. */
DefaultMaxGauge(Clock clock, Id id) {
  this.clock = clock;
  this.id = id;
  this.value = new AtomicDouble(Double.NaN);
}