Source:
public void testMultiplotQueryWithEnum() throws Exception { long start = System.currentTimeMillis() - TIME_DIFF; long end = System.currentTimeMillis() + TIME_DIFF; String prefix = getPrefix(); final String tenant_id = "99988877"; final String metric_name = prefix + "call_xyz_api"; HttpResponse response = postMetric(tenant_id, postAggregatedMultiPath, "sample_multi_enums_payload.json", prefix); assertEquals( "Should get status 200 from ingestion server for POST", 200, response.getStatusLine().getStatusCode() ); EntityUtils.consume(response.getEntity()); HttpResponse query_response = queryMultiplot(tenant_id, start, end, "", "FULL", "enum_values", String.format("['%s']", metric_name)); assertEquals( "Should get status 200 from query server for multiplot POST", 200, query_response.getStatusLine().getStatusCode() ); String responseContent = EntityUtils.toString(query_response.getEntity(), "UTF-8"); JsonParser jsonParser = new JsonParser(); JsonObject responseObject = jsonParser.parse(responseContent).getAsJsonObject(); JsonArray metrics = responseObject.getAsJsonArray( "metrics" ); assertEquals( 1, metrics.size() ); JsonObject metric = metrics.get( 0 ).getAsJsonObject(); assertEquals( "unknown", metric.get( "unit" ).getAsString() ); assertEquals( metric_name, metric.get( "metric" ).getAsString() ); assertEquals( "enum", metric.get( "type" ).getAsString() ); JsonArray data = metric.getAsJsonArray( "data" ); assertEquals( 2, data.size() ); JsonObject data1 = data.get( 0 ).getAsJsonObject(); assertTrue( data1.has( "timestamp" ) ); assertEquals( 1, data1.getAsJsonObject( "enum_values" ).get( "OK" ).getAsInt() ); }

Target:
public void testMultiplotQueryWithEnum() throws Exception { long start = System.currentTimeMillis() - TIME_DIFF; long end = System.currentTimeMillis() + TIME_DIFF; String postfix = getPostfix(); final String tenant_id = "99988877"; final String metric_name = "call_xyz_api" + postfix; HttpResponse response = postMetric(tenant_id, postAggregatedMultiPath, "sample_multi_enums_payload.json", postfix); assertEquals( "Should get status 200 from ingestion server for POST", 200, response.getStatusLine().getStatusCode() ); EntityUtils.consume(response.getEntity()); HttpResponse query_response = queryMultiplot(tenant_id, start, end, "", "FULL", "enum_values", String.format("['%s']", metric_name)); assertEquals( "Should get status 200 from query server for multiplot POST", 200, query_response.getStatusLine().getStatusCode() ); String responseContent = EntityUtils.toString(query_response.getEntity(), "UTF-8"); JsonParser jsonParser = new JsonParser(); JsonObject responseObject = jsonParser.parse(responseContent).getAsJsonObject(); JsonArray metrics = responseObject.getAsJsonArray( "metrics" ); assertEquals( 1, metrics.size() ); JsonObject metric = metrics.get( 0 ).getAsJsonObject(); assertEquals( "unknown", metric.get( "unit" ).getAsString() ); assertEquals( metric_name, metric.get( "metric" ).getAsString() ); assertEquals( "enum", metric.get( "type" ).getAsString() ); JsonArray data = metric.getAsJsonArray( "data" ); assertEquals( 2, data.size() ); JsonObject data1 = data.get( 0 ).getAsJsonObject(); assertTrue( data1.has( "timestamp" ) ); assertEquals( 1, data1.getAsJsonObject( "enum_values" ).get( "OK" ).getAsInt() ); }