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

allow uri to be specified as string #371

Merged
merged 1 commit into from Feb 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -137,9 +137,8 @@ private static void log(Logger logger, Marker marker, HttpLogEntry entry) {
dimensions = dimensions.withTag("client", entry.clientName);
}

if (marker == SERVER && entry.requestUri != null) {
String path = entry.requestUri.getPath();
dimensions = dimensions.withTag("endpoint", longestPrefixMatch(path, "other"));
if (marker == SERVER && entry.path != null) {
dimensions = dimensions.withTag("endpoint", longestPrefixMatch(entry.path, "other"));
}

// Update stats for the final attempt after retries are exhausted
Expand Down Expand Up @@ -183,8 +182,9 @@ private static String newId() {

private String requestId = newId();

private URI originalUri = null;
private URI requestUri = null;
private String originalUri = null;
private String requestUri = null;
private String path = null;
private String method = null;
private List<Header> requestHeaders = new ArrayList<>();
private long requestContentLength = -1;
Expand Down Expand Up @@ -238,17 +238,32 @@ public HttpLogEntry withClientName(String name) {
* be some alias indicating the group of hosts. The request uri would indicate a specific host
* used for an actual network request.
*/
public HttpLogEntry withOriginalUri(URI uri) {
public HttpLogEntry withOriginalUri(String uri) {
this.originalUri = uri;
return this;
}

/**
* Set the original uri. In the case of approaches with client-side load balancing this will
* be some alias indicating the group of hosts. The request uri would indicate a specific host
* used for an actual network request.
*/
public HttpLogEntry withOriginalUri(URI uri) {
return withOriginalUri(uri.toString());
}

/** Set the URI for the actual http request. */
public HttpLogEntry withRequestUri(URI uri) {
public HttpLogEntry withRequestUri(String uri, String path) {
this.requestUri = uri;
this.path = path;
return this;
}

/** Set the URI for the actual http request. */
public HttpLogEntry withRequestUri(URI uri) {
return withRequestUri(uri.toString(), uri.getPath());
}

/** Set the method for the request. */
public HttpLogEntry withMethod(String httpMethod) {
this.method = httpMethod;
Expand Down