@Override public double getFiveMinuteRate() { return meter.getFiveMinuteRate(); }
@Override public double getFiveMinuteRate() { return meter.getFiveMinuteRate(); }
@Override protected Ratio getRatio() { return RatioGauge.Ratio.of(success.getFiveMinuteRate(), attempts.getFiveMinuteRate()); } }
@Override public Map<String, Object> getMovingAverages() { Map<String, Object> movingAverages = new HashMap<>(); Map<String, Object> oneMinute = new HashMap<>(); oneMinute.put(PROCESSED, processed.getOneMinuteRate()); oneMinute.put(PROCESSED_WITH_ERROR, processedWithError.getOneMinuteRate()); oneMinute.put(UNPARSEABLE, unparseable.getOneMinuteRate()); oneMinute.put(THROWN_AWAY, thrownAway.getOneMinuteRate()); Map<String, Object> fiveMinute = new HashMap<>(); fiveMinute.put(PROCESSED, processed.getFiveMinuteRate()); fiveMinute.put(PROCESSED_WITH_ERROR, processedWithError.getFiveMinuteRate()); fiveMinute.put(UNPARSEABLE, unparseable.getFiveMinuteRate()); fiveMinute.put(THROWN_AWAY, thrownAway.getFiveMinuteRate()); Map<String, Object> fifteenMinute = new HashMap<>(); fifteenMinute.put(PROCESSED, processed.getFifteenMinuteRate()); fifteenMinute.put(PROCESSED_WITH_ERROR, processedWithError.getFifteenMinuteRate()); fifteenMinute.put(UNPARSEABLE, unparseable.getFifteenMinuteRate()); fifteenMinute.put(THROWN_AWAY, thrownAway.getFifteenMinuteRate()); movingAverages.put(ONE_MINUTE_NAME, oneMinute); movingAverages.put(FIVE_MINUTE_NAME, fiveMinute); movingAverages.put(FIFTEEN_MINUTE_NAME, fifteenMinute); return movingAverages; } }
public static Map<String, Object> buildMeterMap(Meter m) { Map<String, Object> metrics = Maps.newHashMap(); if (m == null) { return metrics; } Map<String, Object> rate = Maps.newHashMap(); rate.put("one_minute", m.getOneMinuteRate()); rate.put("five_minute", m.getFiveMinuteRate()); rate.put("fifteen_minute", m.getFifteenMinuteRate()); rate.put("total", m.getCount()); rate.put("mean", m.getMeanRate()); metrics.put("rate_unit", "events/second"); metrics.put("rate", rate); return metrics; }
public MeterRates(Meter meter) { this(meter.getOneMinuteRate(), meter.getFiveMinuteRate(), meter.getFifteenMinuteRate()); }
@Override public Collection<Either<JobSpec, URI>> parseJobSpec(byte[] message) throws IOException { InputStream is = new ByteArrayInputStream(message); this.versionWriter.readSchemaVersioningInformation(new DataInputStream(is)); Decoder decoder = DecoderFactory.get().binaryDecoder(is, this.decoder.get()); try { T decodedMessage = this.reader.get().read(null, decoder); return parseJobSpec(decodedMessage); } catch (AvroRuntimeException | IOException exc) { this.messageParseFailures.mark(); if (this.messageParseFailures.getFiveMinuteRate() < 1) { log.warn("Unable to decode input message.", exc); } else { log.warn("Unable to decode input message."); } return Lists.newArrayList(); } }
public static Meter meter(long count) { final Meter meter = mock(Meter.class); when(meter.getCount()).thenReturn(count); when(meter.getMeanRate()).thenReturn(2.0); when(meter.getOneMinuteRate()).thenReturn(3.0); when(meter.getFiveMinuteRate()).thenReturn(4.0); when(meter.getFifteenMinuteRate()).thenReturn(5.0); return meter; }
private void printMeter(Meter meter) { this.outputBufferPrintStream.printf(locale, " count = %d%n", meter.getCount()); this.outputBufferPrintStream.printf(locale, " mean rate = %2.2f events/%s%n", convertRate(meter.getMeanRate()), getRateUnit()); this.outputBufferPrintStream.printf(locale, " 1-minute rate = %2.2f events/%s%n", convertRate(meter.getOneMinuteRate()), getRateUnit()); this.outputBufferPrintStream.printf(locale, " 5-minute rate = %2.2f events/%s%n", convertRate(meter.getFiveMinuteRate()), getRateUnit()); this.outputBufferPrintStream.printf(locale, " 15-minute rate = %2.2f events/%s%n", convertRate(meter.getFifteenMinuteRate()), getRateUnit()); }
meter.getFiveMinuteRate(), meter.getFifteenMinuteRate());
private void printMeter(Meter meter) { printIfEnabled(MetricAttribute.COUNT, String.format(locale, " count = %d", meter.getCount())); printIfEnabled(MetricAttribute.MEAN_RATE, String.format(locale, " mean rate = %2.2f events/%s", convertRate(meter.getMeanRate()), getRateUnit())); printIfEnabled(MetricAttribute.M1_RATE, String.format(locale, " 1-minute rate = %2.2f events/%s", convertRate(meter.getOneMinuteRate()), getRateUnit())); printIfEnabled(MetricAttribute.M5_RATE, String.format(locale, " 5-minute rate = %2.2f events/%s", convertRate(meter.getFiveMinuteRate()), getRateUnit())); printIfEnabled(MetricAttribute.M15_RATE, String.format(locale, " 15-minute rate = %2.2f events/%s", convertRate(meter.getFifteenMinuteRate()), getRateUnit())); }
private void reportMeter(long timestamp, String name, Meter meter) { report(timestamp, name, "count,mean_rate,m1_rate,m5_rate,m15_rate,rate_unit", meterFormat, meter.getCount(), convertRate(meter.getMeanRate()), convertRate(meter.getOneMinuteRate()), convertRate(meter.getFiveMinuteRate()), convertRate(meter.getFifteenMinuteRate()), getRateUnit()); }
when(meter.getMeanRate()).thenReturn(meanRate); when(meter.getOneMinuteRate()).thenReturn(oneMinRate); when(meter.getFiveMinuteRate()).thenReturn(fiveMinRate); when(meter.getFifteenMinuteRate()).thenReturn(fifteenMinRate);
private void logMeter(String name, Meter meter) { loggerProxy.log(marker, "type={}, name={}, count={}, mean_rate={}, m1={}, m5={}, m15={}, rate_unit={}", "METER", prefix(name), meter.getCount(), convertRate(meter.getMeanRate()), convertRate(meter.getOneMinuteRate()), convertRate(meter.getFiveMinuteRate()), convertRate(meter.getFifteenMinuteRate()), getRateUnit()); }
public TimelockServiceStatus getStatus() { Map<String, Meter> meters = metricRegistry.getMeters(); if (!meters.containsKey(AtlasDbMetricNames.TIMELOCK_SUCCESSFUL_REQUEST) || !meters.containsKey(AtlasDbMetricNames.TIMELOCK_FAILED_REQUEST)) { throw new IllegalStateException("Timelock client metrics is not properly set"); } double successfulRequestRate = meters.get(AtlasDbMetricNames.TIMELOCK_SUCCESSFUL_REQUEST).getFiveMinuteRate(); double failedRequestRate = meters.get(AtlasDbMetricNames.TIMELOCK_FAILED_REQUEST).getFiveMinuteRate(); if (successfulRequestRate >= failedRequestRate) { return TimelockServiceStatus.HEALTHY; } else { return TimelockServiceStatus.UNHEALTHY; } } }
@Override public double getNodesTraversedPerSecond() { return meter.getFiveMinuteRate(); } }
protected Ratio getRatio() { double req = requests.getFiveMinuteRate(); double mis = misses.getFiveMinuteRate(); return Ratio.of(req - mis, req); } });
private void printMeter(Meter meter) { output.printf(locale, " count = %d%n", meter.getCount()); output.printf(locale, " mean rate = %2.2f events/%s%n", convertRate(meter.getMeanRate()), getRateUnit()); output.printf(locale, " 1-minute rate = %2.2f events/%s%n", convertRate(meter.getOneMinuteRate()), getRateUnit()); output.printf(locale, " 5-minute rate = %2.2f events/%s%n", convertRate(meter.getFiveMinuteRate()), getRateUnit()); output.printf(locale, " 15-minute rate = %2.2f events/%s%n", convertRate(meter.getFifteenMinuteRate()), getRateUnit()); }
private void reportMeter(long timestamp, String name, Meter meter) { report(timestamp, name, "count,mean_rate,m1_rate,m5_rate,m15_rate,rate_unit", "%d,%f,%f,%f,%f,events/%s", meter.getCount(), convertRate(meter.getMeanRate()), convertRate(meter.getOneMinuteRate()), convertRate(meter.getFiveMinuteRate()), convertRate(meter.getFifteenMinuteRate()), getRateUnit()); }
private BsonDocument generateMeter(Meter meter) { BsonDocument document = new BsonDocument(); document.append("count", new BsonInt64(meter.getCount())); document.append("m15_rate", new BsonDouble(meter.getFifteenMinuteRate() * rateFactor)); document.append("m1_rate", new BsonDouble(meter.getOneMinuteRate() * rateFactor)); document.append("m5_rate", new BsonDouble(meter.getFiveMinuteRate() * rateFactor)); document.append("mean_rate", new BsonDouble(meter.getMeanRate() * rateFactor)); document.append("units", new BsonString("calls/" + singularRateUnitString)); return document; }