summaryrefslogtreecommitdiffstats
path: root/container-core
diff options
context:
space:
mode:
authorLester Solbakken <lesters@users.noreply.github.com>2018-01-31 13:46:14 +0100
committerGitHub <noreply@github.com>2018-01-31 13:46:14 +0100
commit2c25a02adbe644b3f50dc44252c6b61974d0c8d6 (patch)
treebed47a36884434059fb783eea41ad2563495835e /container-core
parent63120efdbf9a6a46f274f62033b00ea1a356cbe9 (diff)
parente94d28dd48c5ac5f40885d7d64cd8480bebba3c8 (diff)
Merge pull request #4839 from vespa-engine/bratseth/tensor-type-information-propagation
Bratseth/tensor type information propagation
Diffstat (limited to 'container-core')
-rw-r--r--container-core/src/main/java/com/yahoo/container/jdisc/ExtendedResponse.java9
-rw-r--r--container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java125
2 files changed, 65 insertions, 69 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/jdisc/ExtendedResponse.java b/container-core/src/main/java/com/yahoo/container/jdisc/ExtendedResponse.java
index 9b6837a9dcb..b2d32c8e745 100644
--- a/container-core/src/main/java/com/yahoo/container/jdisc/ExtendedResponse.java
+++ b/container-core/src/main/java/com/yahoo/container/jdisc/ExtendedResponse.java
@@ -1,18 +1,17 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.jdisc;
-import java.io.IOException;
-import java.io.OutputStream;
-
import com.yahoo.container.handler.Coverage;
import com.yahoo.container.handler.Timing;
import com.yahoo.container.logging.HitCounts;
import com.yahoo.jdisc.handler.CompletionHandler;
import com.yahoo.jdisc.handler.ContentChannel;
+import java.io.IOException;
+import java.io.OutputStream;
+
/**
- * An HTTP response supporting async rendering and extended information for
- * logging.
+ * An HTTP response supporting async rendering and extended information for logging.
*
* @author Steinar Knutsen
*/
diff --git a/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java b/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java
index 933751fd9ad..1c2d28c754f 100644
--- a/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java
+++ b/container-core/src/main/java/com/yahoo/container/jdisc/LoggingRequestHandler.java
@@ -84,16 +84,18 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler {
}
@Override
- protected LoggingCompletionHandler createLoggingCompletionHandler(
- long startTime, long renderStartTime, HttpResponse response,
- HttpRequest httpRequest, ContentChannelOutputStream rendererWiring) {
+ protected LoggingCompletionHandler createLoggingCompletionHandler(long startTime,
+ long renderStartTime,
+ HttpResponse response,
+ HttpRequest httpRequest,
+ ContentChannelOutputStream rendererWiring) {
return new LoggingHandler(startTime, renderStartTime, httpRequest, response, rendererWiring);
}
private static String getClientIP(com.yahoo.jdisc.http.HttpRequest httpRequest) {
SocketAddress clientAddress = httpRequest.getRemoteAddress();
- if (clientAddress == null)
- return "0.0.0.0";
+ if (clientAddress == null) return "0.0.0.0";
+
return clientAddress.toString();
}
@@ -105,24 +107,21 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler {
}
}
- private static String remoteHostAddress(
- com.yahoo.jdisc.http.HttpRequest httpRequest) {
+ private static String remoteHostAddress(com.yahoo.jdisc.http.HttpRequest httpRequest) {
SocketAddress remoteAddress = httpRequest.getRemoteAddress();
- if (remoteAddress == null)
- return "0.0.0.0";
+ if (remoteAddress == null) return "0.0.0.0";
+
if (remoteAddress instanceof InetSocketAddress) {
- return ((InetSocketAddress) remoteAddress).getAddress()
- .getHostAddress();
+ return ((InetSocketAddress) remoteAddress).getAddress().getHostAddress();
} else {
- throw new RuntimeException(
- "Expected remote address of type InetSocketAddress, got "
- + remoteAddress.getClass().getName());
+ throw new RuntimeException("Expected remote address of type InetSocketAddress, got " +
+ remoteAddress.getClass().getName());
}
}
private void logTimes(long startTime, String sourceIP,
- long renderStartTime, long commitStartTime, long endTime,
- String req, String normalizedQuery, Timing t) {
+ long renderStartTime, long commitStartTime, long endTime,
+ String req, String normalizedQuery, Timing t) {
// note: intentionally only taking time since request was received
long totalTime = endTime - startTime;
@@ -140,33 +139,33 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler {
return;
}
- StringBuilder msgbuf = new StringBuilder();
- msgbuf.append(normalizedQuery);
- msgbuf.append(" from ").append(sourceIP).append(". ");
+ StringBuilder b = new StringBuilder();
+ b.append(normalizedQuery);
+ b.append(" from ").append(sourceIP).append(". ");
if (requestOverhead > 0) {
- msgbuf.append("Time from HTTP connection open to request reception ");
- msgbuf.append(requestOverhead).append(" ms. ");
+ b.append("Time from HTTP connection open to request reception ");
+ b.append(requestOverhead).append(" ms. ");
}
if (summaryStartTime != 0) {
- msgbuf.append("Request time: ");
- msgbuf.append(summaryStartTime - startTime).append(" ms. ");
- msgbuf.append("Summary fetch time: ");
- msgbuf.append(renderStartTime - summaryStartTime).append(" ms. ");
+ b.append("Request time: ");
+ b.append(summaryStartTime - startTime).append(" ms. ");
+ b.append("Summary fetch time: ");
+ b.append(renderStartTime - summaryStartTime).append(" ms. ");
} else {
long spentSearching = renderStartTime - startTime;
- msgbuf.append("Processing time: ").append(spentSearching).append(" ms. ");
+ b.append("Processing time: ").append(spentSearching).append(" ms. ");
}
- msgbuf.append("Result rendering/transfer: ");
- msgbuf.append(commitStartTime - renderStartTime).append(" ms. ");
- msgbuf.append("End transaction: ");
- msgbuf.append(endTime - commitStartTime).append(" ms. ");
- msgbuf.append("Total: ").append(totalTime).append(" ms. ");
- msgbuf.append("Timeout: ").append(timeoutInterval).append(" ms. ");
- msgbuf.append("Request string: ").append(req);
+ b.append("Result rendering/transfer: ");
+ b.append(commitStartTime - renderStartTime).append(" ms. ");
+ b.append("End transaction: ");
+ b.append(endTime - commitStartTime).append(" ms. ");
+ b.append("Total: ").append(totalTime).append(" ms. ");
+ b.append("Timeout: ").append(timeoutInterval).append(" ms. ");
+ b.append("Request string: ").append(req);
- log.log(LogLevel.WARNING, "Slow execution. " + msgbuf);
+ log.log(LogLevel.WARNING, "Slow execution. " + b);
}
private static class NullResponse extends ExtendedResponse {
@@ -175,10 +174,11 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler {
}
@Override
- public void render(OutputStream output, ContentChannel networkChannel,
- CompletionHandler handler) throws IOException {
+ public void render(OutputStream output, ContentChannel networkChannel, CompletionHandler handler)
+ throws IOException {
// NOP
}
+
}
private class LoggingHandler implements LoggingCompletionHandler {
@@ -191,9 +191,8 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler {
private final ContentChannelOutputStream rendererWiring;
private final ExtendedResponse extendedResponse;
- LoggingHandler(long startTime, long renderStartTime,
- HttpRequest httpRequest, HttpResponse httpResponse,
- ContentChannelOutputStream rendererWiring) {
+ LoggingHandler(long startTime, long renderStartTime, HttpRequest httpRequest, HttpResponse httpResponse,
+ ContentChannelOutputStream rendererWiring) {
this.startTime = startTime;
this.renderStartTime = renderStartTime;
this.commitStartTime = renderStartTime;
@@ -233,20 +232,19 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler {
}
private void writeToLogs(long endTime) {
- final com.yahoo.jdisc.http.HttpRequest jdiscRequest = httpRequest.getJDiscRequest();
+ com.yahoo.jdisc.http.HttpRequest jdiscRequest = httpRequest.getJDiscRequest();
- logTimes(
- startTime,
- getClientIP(jdiscRequest),
- renderStartTime,
- commitStartTime,
- endTime,
- jdiscRequest.getUri().toString(),
- extendedResponse.getParsedQuery(),
- extendedResponse.getTiming());
+ logTimes(startTime,
+ getClientIP(jdiscRequest),
+ renderStartTime,
+ commitStartTime,
+ endTime,
+ jdiscRequest.getUri().toString(),
+ extendedResponse.getParsedQuery(),
+ extendedResponse.getTiming());
- final Optional<AccessLogEntry> jdiscRequestAccessLogEntry
- = AccessLoggingRequestHandler.getAccessLogEntry(jdiscRequest);
+ Optional<AccessLogEntry> jdiscRequestAccessLogEntry =
+ AccessLoggingRequestHandler.getAccessLogEntry(jdiscRequest);
if (jdiscRequestAccessLogEntry.isPresent()) {
// This means we are running with Jetty, not Netty.
@@ -275,18 +273,17 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler {
}
}
- private void populateAccessLogEntryNotCreatedByHttpServer(
- final AccessLogEntry logEntry,
- final com.yahoo.jdisc.http.HttpRequest httpRequest,
- final Timing timing,
- final String fullRequest,
- final long commitStartTime,
- final long startTime,
- final long written,
- final int status) {
+ private void populateAccessLogEntryNotCreatedByHttpServer(AccessLogEntry logEntry,
+ com.yahoo.jdisc.http.HttpRequest httpRequest,
+ Timing timing,
+ String fullRequest,
+ long commitStartTime,
+ long startTime,
+ long written,
+ int status) {
try {
- final InetSocketAddress remoteAddress = AccessLogUtil.getRemoteAddress(httpRequest);
- final long evalStartTime = getEvalStart(timing, startTime);
+ InetSocketAddress remoteAddress = AccessLogUtil.getRemoteAddress(httpRequest);
+ long evalStartTime = getEvalStart(timing, startTime);
logEntry.setIpV4Address(remoteHostAddress(httpRequest));
logEntry.setTimeStamp(evalStartTime);
logEntry.setDurationBetweenRequestResponse(commitStartTime - evalStartTime);
@@ -302,8 +299,8 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler {
logEntry.setHttpMethod(AccessLogUtil.getHttpMethod(httpRequest));
logEntry.setHttpVersion(AccessLogUtil.getHttpVersion(httpRequest));
} catch (Exception e) {
- log.log(LogLevel.WARNING, "Could not populate the access log ["
- + fullRequest + "]", e);
+ log.log(LogLevel.WARNING, "Could not populate the access log [" + fullRequest + "]", e);
}
}
+
}