@Test public void testReportString() { ReportClient client = new ReportClient(nodeInfo, httpClient, new ReportClientConfig(), new ReportTagConfig(), objectMapper); collectedData = HashBasedTable.create(); collectedData.put("Foo.String", ImmutableMap.of(), "test value"); client.report(TEST_TIME, collectedData); assertEquals(sentJson, ImmutableList.of( ImmutableMap.of( "name", "Foo.String", "timestamp", TEST_TIME, "type", "string", "value", "test value", "tags", ImmutableMap.of( "application", "test-application", "host", "test.hostname", "environment", "test_environment", "pool", "test_pool" ) ) )); }
public void report(long systemTimeMillis, Table<String, Map<String, String>, Object> collectedData) { Request request = preparePost() .setUri(UPLOAD_URI) .setHeader("Content-Type", "application/gzip") .setBodySource(new CompressBodySource(systemTimeMillis, collectedData)) .build(); try { StringResponse response = httpClient.execute(request, createStringResponseHandler()); if (response.getStatusCode() != 204) { logger.warn("Failed to report stats: %s %s %s", response.getStatusCode(), response.getStatusMessage(), response.getBody()); } } catch (RuntimeException e) { logger.warn(e, "Exception when trying to report stats"); } }
ReportClient { public void report(long systemTimeMillis, Table<String, Map<String, String>, Object> collectedData) { Request request = preparePost() .setUri(UPLOAD_URI) .setHeader("Content-Type", "application/gzip") .setBodySource(new CompressBodySource(systemTimeMillis, collectedData)) .build(); try { StringResponse response = httpClient.execute(request, createStringResponseHandler()); if (response.getStatusCode() != 204) { logger.warn("Failed to report stats: %s %s %s", response.getStatusCode(), response.getStatusMessage(), response.getBody()); } } catch (RuntimeException e) { logger.warn(e, "Exception when trying to report stats"); } } }
ReportClient { public void report(long systemTimeMillis, Table<String, Map<String, String>, Object> collectedData) { Request request = preparePost() .setUri(UPLOAD_URI) .setHeader("Content-Type", "application/gzip") .setBodySource(new CompressBodySource(systemTimeMillis, collectedData)) .build(); try { StringResponse response = httpClient.execute(request, createStringResponseHandler()); if (response.getStatusCode() != 204) { logger.warn("Failed to report stats: %s %s %s", response.getStatusCode(), response.getStatusMessage(), response.getBody()); } } catch (RuntimeException e) { logger.warn(e, "Exception when trying to report stats"); } } @Inject  ReportClient(NodeInfo nodeInfo, @ForReportClient HttpClient httpClient, ReportClientConfig reportClientConfig, ReportTagConfig reportTagConfig, ObjectMapper objectMapper); }
ReportClient { public void report(long systemTimeMillis, Table<String, Map<String, String>, Object> collectedData) { Request request = preparePost() .setUri(UPLOAD_URI) .setHeader("Content-Type", "application/gzip") .setBodySource(new CompressBodySource(systemTimeMillis, collectedData)) .build(); try { StringResponse response = httpClient.execute(request, createStringResponseHandler()); if (response.getStatusCode() != 204) { logger.warn("Failed to report stats: %s %s %s", response.getStatusCode(), response.getStatusMessage(), response.getBody()); } } catch (RuntimeException e) { logger.warn(e, "Exception when trying to report stats"); } } @Inject  ReportClient(NodeInfo nodeInfo, @ForReportClient HttpClient httpClient, ReportClientConfig reportClientConfig, ReportTagConfig reportTagConfig, ObjectMapper objectMapper); void report(long systemTimeMillis, Table<String, Map<String, String>, Object> collectedData); }
ReportClient { public void report(long systemTimeMillis, Table<String, Map<String, String>, Object> collectedData) { Request request = preparePost() .setUri(UPLOAD_URI) .setHeader("Content-Type", "application/gzip") .setBodySource(new CompressBodySource(systemTimeMillis, collectedData)) .build(); try { StringResponse response = httpClient.execute(request, createStringResponseHandler()); if (response.getStatusCode() != 204) { logger.warn("Failed to report stats: %s %s %s", response.getStatusCode(), response.getStatusMessage(), response.getBody()); } } catch (RuntimeException e) { logger.warn(e, "Exception when trying to report stats"); } } @Inject  ReportClient(NodeInfo nodeInfo, @ForReportClient HttpClient httpClient, ReportClientConfig reportClientConfig, ReportTagConfig reportTagConfig, ObjectMapper objectMapper); void report(long systemTimeMillis, Table<String, Map<String, String>, Object> collectedData);  }