Skip to content

Commit

Permalink
Fix service stack trace in sun-net-http server
Browse files Browse the repository at this point in the history
  • Loading branch information
lovesh-ap committed Nov 23, 2023
1 parent 4c28de7 commit 6fe3afd
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.newrelic.api.agent.weaver.Weaver;

import java.io.IOException;
import java.util.Arrays;

@Weave(originalName = "com.sun.net.httpserver.Filter", type = MatchType.BaseClass)
public class Filter_Instrumentation {
Expand Down Expand Up @@ -67,8 +68,8 @@ private void preprocessSecurityHook(HttpExchange exchange) {
}

securityRequest.setContentType(HttpServerHelper.getContentType(exchange.getRequestHeaders()));

securityAgentMetaData.setServiceTrace(Thread.currentThread().getStackTrace());
StackTraceElement[] stack = Thread.currentThread().getStackTrace();
securityAgentMetaData.setServiceTrace(Arrays.copyOfRange(stack, 1, stack.length));
securityRequest.setRequestParsed(true);
} catch (Throwable ignored){}
}
Expand Down

0 comments on commit 6fe3afd

Please sign in to comment.