Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NR-360114: Report gRPC response errors #373

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,23 @@ public class HttpStatusCodes {
codes.put(508, "Loop Detected");
codes.put(510, "Not Extended");
codes.put(511, "Network Authentication Required");

codes.put(0, "OK");
codes.put(1, "Cancelled");
codes.put(2, "Unknown");
codes.put(3, "Invalid Argument");
codes.put(4, "Deadline Exceeded");
codes.put(5, "Not Found");
codes.put(6, "Already Exists");
codes.put(7, "Permission Denied");
codes.put(8, "Resource Exhausted");
codes.put(9, "Failed Precondition");
codes.put(10, "Aborted");
codes.put(11, "Out Of Range");
codes.put(12, "Unimplemented");
codes.put(13, "Internal");
codes.put(14, "Unavailable");
codes.put(15, "Data Loss");
codes.put(16, "Unauthenticated");
}

public static String getStatusCode(int code) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class ServletHelper {
public static final String NR_SEC_HTTP_SESSION_ATTRIB_NAME = "NR-CSEC-HTTP-SESSION-";
public static final String NR_SEC_HTTP_SERVLET_RESPONSE_ATTRIB_NAME = "NR-CSEC-HTTP-SERVLET-RESPONSE-";

private static Set<String> filesToRemove = ConcurrentHashMap.newKeySet();
private static final Set<String> filesToRemove = ConcurrentHashMap.newKeySet();
private static final Set<String> unsupportedContentType = new HashSet<String>() {{
add("application/zip");
add("application/epub+zip");
Expand Down Expand Up @@ -240,7 +240,7 @@ public static void executeBeforeExitingTransaction() {
}

int responseCode = NewRelicSecurity.getAgent().getSecurityMetaData().getResponse().getResponseCode();
if(responseCode >= 500){
if(responseCode >= 500 || responseCode == 2 || responseCode == 12 || responseCode == 13 || responseCode == 15){
Exception exception = NewRelicSecurity.getAgent().getSecurityMetaData().getCustomAttribute("ENDMOST_EXCEPTION", Exception.class);
NewRelicSecurity.getAgent().recordExceptions(NewRelicSecurity.getAgent().getSecurityMetaData(), exception);
}
Expand Down
Loading