You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2022/07/15 12:44:25 UTC
[brooklyn-server] 01/02: fix latency computation
This is an automated email from the ASF dual-hosted git repository.
heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit 6668764a445131a826f82a70e12fce2900683631
Author: Alex Heneveld <al...@cloudsoft.io>
AuthorDate: Fri Jul 15 13:03:10 2022 +0100
fix latency computation
---
core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java b/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java
index bd62ef602f..c1897173a2 100644
--- a/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java
+++ b/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java
@@ -416,6 +416,7 @@ public class HttpFeed extends AbstractFeed {
pollInfo.credentials.get().getPassword());
}
+ final long startTime = System.currentTimeMillis();
HttpResponse response = pollInfo.httpExecutor.execute(new HttpRequest.Builder()
.headers(pollInfo.headers)
.uri(pollInfo.uriProvider.get())
@@ -428,7 +429,7 @@ public class HttpFeed extends AbstractFeed {
.laxRedirect(true)
.build())
.build());
- return createHttpToolRespose(response);
+ return createHttpToolRespose(response, startTime);
}};
getPoller().scheduleAtFixedRate(pollJob, new DelegatingPollHandler<HttpToolResponse>(handlers), minPeriod);
}
@@ -441,7 +442,7 @@ public class HttpFeed extends AbstractFeed {
}
@SuppressWarnings("unchecked")
- private HttpToolResponse createHttpToolRespose(HttpResponse response) throws IOException {
+ private HttpToolResponse createHttpToolRespose(HttpResponse response, long startTime) throws IOException {
int responseCode = response.code();
Map<String,? extends List<String>> headers = (Map<String, List<String>>) (Map<?, ?>) response.headers().asMap();
@@ -449,7 +450,6 @@ public class HttpFeed extends AbstractFeed {
byte[] content = null;
final long durationMillisOfFirstResponse;
final long durationMillisOfFullContent;
- final long startTime = System.currentTimeMillis();
ByteArrayOutputStream out = new ByteArrayOutputStream();
durationMillisOfFirstResponse = Duration.sinceUtc(startTime).toMilliseconds();