Skip to content

Commit 0f9ee53

Browse files
author
fishtailfu
committed
fix: fix log.
1 parent 087a041 commit 0f9ee53

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

polaris-plugins/polaris-plugins-observability/event-pushgateway/src/main/java/com/tencent/polaris/plugins/event/pushgateway/PushGatewayEventReporter.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,11 @@ public void postContextInit(Extensions ctx) throws PolarisException {
153153
eventQueue = new LinkedBlockingQueue<>(config.getEventQueueSize());
154154

155155
serviceAddressRepository = new ServiceAddressRepository(this.config.getAddress(),
156-
ctx.getValueContext().getClientId(), ctx, new ServiceKey(config.getNamespace(), config.getService()));
156+
ctx.getValueContext().getClientId(), ctx,
157+
new ServiceKey(config.getNamespace(), config.getService()));
157158

158-
eventExecutors.scheduleWithFixedDelay(new PushGatewayEventTask(), 1000, 1000, TimeUnit.MILLISECONDS);
159+
eventExecutors.scheduleWithFixedDelay(new PushGatewayEventTask(), 1000, 1000,
160+
TimeUnit.MILLISECONDS);
159161
LOG.info("PushGateway event reporter starts reporting task.");
160162
} catch (Throwable e) {
161163
LOG.error("Init PushGateway event reporter fail.", e);
@@ -224,9 +226,11 @@ public void run() {
224226

225227
private void postPushGatewayEvent(PushGatewayEventRequest request) {
226228
StringEntity postBody = null;
227-
RequestConfig config = RequestConfig.custom().setConnectTimeout(2000).setConnectionRequestTimeout(10000).setSocketTimeout(10000).build();
229+
RequestConfig config = RequestConfig.custom().setConnectTimeout(2000).setConnectionRequestTimeout(10000)
230+
.setSocketTimeout(10000).build();
228231
try (CloseableHttpClient httpClient = HttpClientBuilder.create().setDefaultRequestConfig(config).build()) {
229-
HttpPost httpPost = new HttpPost(getEventUri());
232+
URI uri = getEventUri();
233+
HttpPost httpPost = new HttpPost(uri);
230234
postBody = new StringEntity(mapper.writeValueAsString(request), StandardCharsets.UTF_8);
231235
if (LOG.isDebugEnabled()) {
232236
LOG.debug("postPushGatewayEvent body:{}", postBody);
@@ -239,11 +243,13 @@ private void postPushGatewayEvent(PushGatewayEventRequest request) {
239243

240244
if (200 != httpResponse.getStatusLine().getStatusCode()) {
241245
String resultString = EntityUtils.toString(httpResponse.getEntity(), "utf-8");
242-
throw new RuntimeException("Report push gateway event failed. Response = [" + resultString + "].");
246+
throw new RuntimeException("Report push gateway event to " + uri.getHost() + ":" + uri.getPort()
247+
+ "failed. Response = [" + resultString + "].");
243248
} else {
244249
if (LOG.isDebugEnabled()) {
245250
String resultString = EntityUtils.toString(httpResponse.getEntity(), "utf-8");
246-
LOG.info("Report push gateway event success. Response is : {}", resultString);
251+
LOG.info("Report push gateway event to {}:{} success. Response is : {}", uri.getHost(),
252+
uri.getPort(), resultString);
247253
} else {
248254
LOG.info("Report push gateway event success.");
249255
}

polaris-plugins/polaris-plugins-observability/stat-prometheus/src/main/java/com/tencent/polaris/plugins/stat/prometheus/plugin/PrometheusReporter.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,6 @@ private void startSchedulePushTask() {
312312

313313
private void doPush() {
314314
String address = serviceAddressRepository.getServiceAddress();
315-
if (LOGGER.isDebugEnabled()) {
316-
LOGGER.debug("[PrometheusReporter] send push request to :" + address);
317-
}
318315
try {
319316
CommonHandler.putDataFromContainerInOrder(sampleMapping, container.getInsCollector(),
320317
container.getInsCollector().getCurrentRevision(),

0 commit comments

Comments
 (0)