Skip to content

Commit

Permalink
Merge pull request #335 from newrelic/feature/runtime-error/add-uri
Browse files Browse the repository at this point in the history
Added request URI to application runtime error event, enhancing error logging and debugging capabilities.
  • Loading branch information
lovesh-ap authored Nov 6, 2024
2 parents 3d94339 + 8f228f5 commit 6cff942
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class HttpRequest {

@JsonIgnore
public static final int MAX_ALLOWED_REQUEST_BODY_LENGTH = 500000;
@JsonIgnore
public static final String QUESTION_MARK = "?";

private StringBuilder body;

Expand Down Expand Up @@ -40,6 +42,7 @@ public class HttpRequest {
private boolean isGrpc;

private String route;
private String requestURI;

private Map<String, String> customDataType;

Expand Down Expand Up @@ -73,6 +76,7 @@ public HttpRequest() {
this.isRequestParsed = false;
this.isGrpc = false;
this.route = StringUtils.EMPTY;
this.requestURI = StringUtils.EMPTY;
this.customDataType = new HashMap<>();
}

Expand All @@ -91,6 +95,7 @@ public HttpRequest(HttpRequest servletInfo) {
this.isRequestParsed = servletInfo.isRequestParsed;
this.isGrpc = servletInfo.isGrpc;
this.route = servletInfo.route;
this.requestURI = servletInfo.requestURI;
this.pathParameterMap = servletInfo.pathParameterMap;
this.queryParameters = servletInfo.queryParameters;
this.requestHeaderParameters = servletInfo.requestHeaderParameters;
Expand All @@ -113,6 +118,7 @@ public String getUrl() {

public void setUrl(String url) {
this.url = url;
this.requestURI = StringUtils.substringBefore(url, QUESTION_MARK);
}

public Map<String, String> getHeaders() {
Expand Down Expand Up @@ -249,6 +255,14 @@ public void setRoute(String route){
this.route = StringUtils.removeEnd(StringUtils.prependIfMissing(route, StringUtils.SEPARATOR), StringUtils.SEPARATOR);
}

public String getRequestURI() {
return requestURI;
}

public void setRequestURI(String requestURI) {
this.requestURI = requestURI;
}

public void setRoute(String segment, boolean isAlreadyServlet) {
// remove servlet detected route if another framework detected;
if (isAlreadyServlet) {
Expand Down

0 comments on commit 6cff942

Please sign in to comment.