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

bugfix aligning service names #32

Merged
merged 1 commit into from
Sep 7, 2014
Merged
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 @@ -37,7 +37,7 @@
* <li>If no trace information is submitted we will start a new span. In that case it means client does not support tracing
* and should be adapted.</li>
* </ol>
*
*
* @author kristof
*/
@Component
Expand All @@ -55,7 +55,7 @@ public class BravePreProcessInterceptor implements PreProcessInterceptor {

/**
* Creates a new instance.
*
*
* @param endPointSubmitter {@link EndPointSubmitter}. Should not be <code>null</code>.
* @param serverTracer {@link ServerTracer}. Should not be <code>null</code>.
* @param randomGenerator Random generator.
Expand Down Expand Up @@ -111,12 +111,21 @@ private void submitEndpoint() {
if (!endPointSubmitter.endPointSubmitted()) {
final String localAddr = servletRequest.getLocalAddr();
final int localPort = servletRequest.getLocalPort();
final String contextPath = servletRequest.getContextPath();
final String contextPath = getContextPathWithoutFirstSlash();
LOGGER.debug("Setting endpoint: addr: {}, port: {}, contextpath: {}", localAddr, localPort, contextPath);
endPointSubmitter.submit(localAddr, localPort, contextPath);
}
}

private String getContextPathWithoutFirstSlash() {
final String contextPath = servletRequest.getContextPath();
if (contextPath.startsWith("/")) {
return contextPath.substring(1);
} else {
return contextPath;
}
}

private TraceData getTraceData(final HttpRequest request) {
final HttpHeaders httpHeaders = request.getHttpHeaders();
final MultivaluedMap<String, String> requestHeaders = httpHeaders.getRequestHeaders();
Expand Down