@Test public void defaultStatusTest() throws Exception { SingerStatus status = new SingerStatus(new Random().nextLong()); SingerStatus status2 = new SingerStatus(status.toString()); assertEquals(status, status2); }
@Override public String toString() { TreeMap<String, String> kvs = new TreeMap<>(); kvs.put(VERSION_KEY, this.version); kvs.put(HOSTNAME_KEY, this.hostName); kvs.put(JVM_UPTIME_KEY, Long.toString(this.jvmUptime)); kvs.put(TIMESTAMP_KEY, Long.toString(this.timestamp)); kvs.put(PROCESSOR_EXCEPTIONS_KEY, Long.toString(this.numExceptions)); kvs.put(NUM_LOG_STREAMS_KEY, Long.toString(this.numLogStreams)); kvs.put(NUM_STUCK_LOG_STREAMS_KEY, Long.toString(this.numStuckLogStreams)); Gson gson = new Gson(); kvs.put(KAFKA_WRITES_KEY, gson.toJson(this.kafkaWrites)); kvs.put(CURRENT_LATENCY_KEY, Double.toString(this.currentLatency)); kvs.put(LATENCY_KEY, gson.toJson(this.latency)); kvs.put(SKIPPED_BYTES_KEY, gson.toJson(this.skippedBytes)); String json = gson.toJson(kvs); return json; }
SingerStatus { @Override public String toString() { TreeMap<String, String> kvs = new TreeMap<>(); kvs.put(VERSION_KEY, this.version); kvs.put(HOSTNAME_KEY, this.hostName); kvs.put(JVM_UPTIME_KEY, Long.toString(this.jvmUptime)); kvs.put(TIMESTAMP_KEY, Long.toString(this.timestamp)); kvs.put(PROCESSOR_EXCEPTIONS_KEY, Long.toString(this.numExceptions)); kvs.put(NUM_LOG_STREAMS_KEY, Long.toString(this.numLogStreams)); kvs.put(NUM_STUCK_LOG_STREAMS_KEY, Long.toString(this.numStuckLogStreams)); Gson gson = new Gson(); kvs.put(KAFKA_WRITES_KEY, gson.toJson(this.kafkaWrites)); kvs.put(CURRENT_LATENCY_KEY, Double.toString(this.currentLatency)); kvs.put(LATENCY_KEY, gson.toJson(this.latency)); kvs.put(SKIPPED_BYTES_KEY, gson.toJson(this.skippedBytes)); String json = gson.toJson(kvs); return json; } }
SingerStatus { @Override public String toString() { TreeMap<String, String> kvs = new TreeMap<>(); kvs.put(VERSION_KEY, this.version); kvs.put(HOSTNAME_KEY, this.hostName); kvs.put(JVM_UPTIME_KEY, Long.toString(this.jvmUptime)); kvs.put(TIMESTAMP_KEY, Long.toString(this.timestamp)); kvs.put(PROCESSOR_EXCEPTIONS_KEY, Long.toString(this.numExceptions)); kvs.put(NUM_LOG_STREAMS_KEY, Long.toString(this.numLogStreams)); kvs.put(NUM_STUCK_LOG_STREAMS_KEY, Long.toString(this.numStuckLogStreams)); Gson gson = new Gson(); kvs.put(KAFKA_WRITES_KEY, gson.toJson(this.kafkaWrites)); kvs.put(CURRENT_LATENCY_KEY, Double.toString(this.currentLatency)); kvs.put(LATENCY_KEY, gson.toJson(this.latency)); kvs.put(SKIPPED_BYTES_KEY, gson.toJson(this.skippedBytes)); String json = gson.toJson(kvs); return json; } SingerStatus(long ts);  SingerStatus(String json); @VisibleForTesting  SingerStatus(java.util.Map<String, String> kvs); }
SingerStatus { @Override public String toString() { TreeMap<String, String> kvs = new TreeMap<>(); kvs.put(VERSION_KEY, this.version); kvs.put(HOSTNAME_KEY, this.hostName); kvs.put(JVM_UPTIME_KEY, Long.toString(this.jvmUptime)); kvs.put(TIMESTAMP_KEY, Long.toString(this.timestamp)); kvs.put(PROCESSOR_EXCEPTIONS_KEY, Long.toString(this.numExceptions)); kvs.put(NUM_LOG_STREAMS_KEY, Long.toString(this.numLogStreams)); kvs.put(NUM_STUCK_LOG_STREAMS_KEY, Long.toString(this.numStuckLogStreams)); Gson gson = new Gson(); kvs.put(KAFKA_WRITES_KEY, gson.toJson(this.kafkaWrites)); kvs.put(CURRENT_LATENCY_KEY, Double.toString(this.currentLatency)); kvs.put(LATENCY_KEY, gson.toJson(this.latency)); kvs.put(SKIPPED_BYTES_KEY, gson.toJson(this.skippedBytes)); String json = gson.toJson(kvs); return json; } SingerStatus(long ts);  SingerStatus(String json); @VisibleForTesting  SingerStatus(java.util.Map<String, String> kvs); @Override String toString(); @Override boolean equals(Object o); String getVersion(); String getHostName(); long getJvmUptime(); long getTimestamp(); long getNumExceptions(); long getNumLogStreams(); long getNumStuckLogStreams(); TreeMap<String, String> getKafkaWrites(); TreeMap<String, String> getLatency(); TreeMap<String, String> getSkippedBytes(); }
SingerStatus { @Override public String toString() { TreeMap<String, String> kvs = new TreeMap<>(); kvs.put(VERSION_KEY, this.version); kvs.put(HOSTNAME_KEY, this.hostName); kvs.put(JVM_UPTIME_KEY, Long.toString(this.jvmUptime)); kvs.put(TIMESTAMP_KEY, Long.toString(this.timestamp)); kvs.put(PROCESSOR_EXCEPTIONS_KEY, Long.toString(this.numExceptions)); kvs.put(NUM_LOG_STREAMS_KEY, Long.toString(this.numLogStreams)); kvs.put(NUM_STUCK_LOG_STREAMS_KEY, Long.toString(this.numStuckLogStreams)); Gson gson = new Gson(); kvs.put(KAFKA_WRITES_KEY, gson.toJson(this.kafkaWrites)); kvs.put(CURRENT_LATENCY_KEY, Double.toString(this.currentLatency)); kvs.put(LATENCY_KEY, gson.toJson(this.latency)); kvs.put(SKIPPED_BYTES_KEY, gson.toJson(this.skippedBytes)); String json = gson.toJson(kvs); return json; } SingerStatus(long ts);  SingerStatus(String json); @VisibleForTesting  SingerStatus(java.util.Map<String, String> kvs); @Override String toString(); @Override boolean equals(Object o); String getVersion(); String getHostName(); long getJvmUptime(); long getTimestamp(); long getNumExceptions(); long getNumLogStreams(); long getNumStuckLogStreams(); TreeMap<String, String> getKafkaWrites(); TreeMap<String, String> getLatency(); TreeMap<String, String> getSkippedBytes(); static String SINGER_VERSION; final String hostName; }