Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion elda-lda/src/main/java/com/epimorphics/lda/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
*
*/
public interface Version {
public final String string = "3.0.2-SNAPSHOT";
public final String string = "3.0.2";
Comment thread
der marked this conversation as resolved.
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,17 @@ public void init(FilterConfig filterConfig) throws ServletException {
String headerID = httpRequest.getHeader(X_REQUEST_ID);
String paramID = httpRequest.getParameter(QueryParameter._QUERY_ID);

long requestCount = queryCount.incrementAndGet();
String seqId = Long.toString(requestCount);

if (useID) {
if (ID == null) ID = paramID;
if (ID == null) ID = headerID;
}
if (ID == null) ID = generateID(httpRequest);

String fullID = ID.replace("*", seqId);
MDC.put("request_id", fullID);
if (ID != null) {
MDC.put("request_id", ID);
httpResponse.addHeader(X_RESPONSE_ID, ID);
}

log.info("Request {}", fullPath);

httpResponse.addHeader(X_RESPONSE_ID, fullID);

long startTime = System.currentTimeMillis();
chain.doFilter(request, response);
long endTime = System.currentTimeMillis();
Expand All @@ -103,16 +98,12 @@ public void init(FilterConfig filterConfig) throws ServletException {
, NameUtils.formatDuration(endTime - startTime)
);

MDC.remove("request_id");
if (ID != null) {
MDC.remove("request_id");
}
}
}

private String generateID(HttpServletRequest req) {
// return UUID_V1.generate().toString();
String envID = System.getenv("ELDA_INSTANCE_ID");
return envID == null ? "host " + req.getLocalAddr() + ":*" : envID;
}

// The check for NoSuchMethodError is because Tomcat6 doesn't have a
// getStatus() in its HttpServletResponse implementation, and we have
// users still on Tomcat 6. -1 is a "no not really" value.
Expand Down
Loading