44package com .ca .docker ;
55
66import java .io .BufferedReader ;
7- import java .io .IOException ;
87import java .io .InputStream ;
98import java .io .InputStreamReader ;
10- import java .io .Reader ;
11- import java .math .BigDecimal ;
12- import java .math .BigInteger ;
13- import java .math .RoundingMode ;
149import java .net .HttpURLConnection ;
1510import java .net .URL ;
16- import java .nio .charset .Charset ;
1711import java .text .DecimalFormat ;
1812import java .util .ArrayList ;
1913import java .util .Date ;
20- import java .util .HashMap ;
2114import java .util .Iterator ;
2215import java .util .Map ;
23- import java .util .Map .Entry ;
2416import java .util .concurrent .ScheduledExecutorService ;
2517import java .util .concurrent .ScheduledThreadPoolExecutor ;
2618import java .util .concurrent .TimeUnit ;
3628import com .google .gson .Gson ;
3729import com .google .gson .JsonArray ;
3830import com .google .gson .JsonElement ;
39- import com .google .gson .JsonObject ;
4031import com .google .gson .JsonParser ;
4132import com .google .gson .JsonSyntaxException ;
4233
@@ -216,21 +207,15 @@ public MetricFeedBundle makeMetrics(final Object hci, String additionalPath)
216207 */
217208 private void makeMetrics (MetricFeedBundle mfb , String basePath , Object hci )
218209 {
219-
220- // TODO Auto-generated method stub
221- // if (hci instanceof HostInfo )
210+ Iterator <?> it = (( DockerInfo ) hci ). getDockerInfo (). entrySet ()
211+ . iterator ();
212+ while ( it . hasNext () )
222213 {
223- Iterator <?> it = ((DockerInfo ) hci ).getDockerInfo ().entrySet ()
224- .iterator ();
225- while (it .hasNext ())
226- {
227- final MetricPath metricPath = new MetricPath (basePath );
228- Map .Entry pair = (Map .Entry ) it .next ();
229- metricPath .addMetric ((String ) pair .getKey ());
230- makeMetric (metricPath .toString (), pair .getValue (), mfb );
231- it .remove ();
232- }
233- // makeMetric(metricPath.toString(), o, mfb);
214+ final MetricPath metricPath = new MetricPath (basePath );
215+ Map .Entry pair = (Map .Entry ) it .next ();
216+ metricPath .addMetric ((String ) pair .getKey ());
217+ makeMetric (metricPath .toString (), pair .getValue (), mfb );
218+ it .remove ();
234219 }
235220
236221 }
@@ -519,13 +504,15 @@ private Double getCPUPercentage(JsonNode node, String containerName)
519504
520505 return null ;
521506 }
507+
522508 /**
523509 * This returns the percentage of 2 numbers upto 3 decimals
510+ *
524511 * @param d1
525512 * @param d2
526513 * @return
527514 */
528- private static Double percentage (Double d1 , Double d2 )
515+ private static Double percentage (Double d1 , Double d2 )
529516 {
530517 DecimalFormat df = new DecimalFormat ();
531518 Double numerator = new Double (d1 ) * 100 ;
@@ -536,7 +523,8 @@ private static Double percentage(Double d1, Double d2)
536523 }
537524
538525 /**
539- * Identify the memory utilization percentage
526+ * Identify the memory utilization percentage
527+ *
540528 * @param node
541529 * @param names
542530 * @return
0 commit comments