@Test public void jsonConversionSkipsZeroMeasurements() throws Exception { HealthStatsMetrics metrics = new HealthStatsMetrics(); metrics.measurements.put(234, new ArrayMap<String, Long>()); metrics.measurements.get(234).put("abcd", 0L); assertThat(metrics.toJSONObject().length()).isEqualTo(0); }
public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsMetrics();  HealthStatsMetrics(HealthStats healthStats);  HealthStatsMetrics(HealthStatsMetrics metrics); }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsMetrics();  HealthStatsMetrics(HealthStats healthStats);  HealthStatsMetrics(HealthStatsMetrics metrics); @Override HealthStatsMetrics sum(
      @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output); @Override HealthStatsMetrics diff(
      @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output); @Override HealthStatsMetrics set(HealthStatsMetrics b); HealthStatsMetrics set(HealthStats healthStats); @Override String toString(); static String getKeyName(int key); JSONObject toJSONObject(); @Override boolean equals(Object o); @Override int hashCode(); }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsMetrics();  HealthStatsMetrics(HealthStats healthStats);  HealthStatsMetrics(HealthStatsMetrics metrics); @Override HealthStatsMetrics sum(
      @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output); @Override HealthStatsMetrics diff(
      @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output); @Override HealthStatsMetrics set(HealthStatsMetrics b); HealthStatsMetrics set(HealthStats healthStats); @Override String toString(); static String getKeyName(int key); JSONObject toJSONObject(); @Override boolean equals(Object o); @Override int hashCode(); public String dataType; final SparseArray<Long> measurement; final SparseArray<TimerMetrics> timer; final SparseArray<ArrayMap<String, Long>> measurements; final SparseArray<ArrayMap<String, TimerMetrics>> timers; final SparseArray<ArrayMap<String, HealthStatsMetrics>> stats; }