-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HTTP PATH metrics don't consistently report a path (#242)
See #225 Signed-off-by: Thomas Segismont <[email protected]>
- Loading branch information
1 parent
ff3a061
commit 02b926b
Showing
5 changed files
with
58 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package io.vertx.micrometer.impl; | ||
|
||
/** | ||
* Copied over from Vert.x core HttpUtils to avoid exposing internal utilities. | ||
*/ | ||
class HttpUtils { | ||
|
||
/** | ||
* Extract the path out of the uri. | ||
*/ | ||
static String parsePath(String uri) { | ||
if (uri.isEmpty()) { | ||
return ""; | ||
} | ||
int i; | ||
if (uri.charAt(0) == '/') { | ||
i = 0; | ||
} else { | ||
i = uri.indexOf("://"); | ||
if (i == -1) { | ||
i = 0; | ||
} else { | ||
i = uri.indexOf('/', i + 3); | ||
if (i == -1) { | ||
// contains no / | ||
return "/"; | ||
} | ||
} | ||
} | ||
|
||
int queryStart = uri.indexOf('?', i); | ||
if (queryStart == -1) { | ||
queryStart = uri.length(); | ||
if (i == 0) { | ||
return uri; | ||
} | ||
} | ||
return uri.substring(i, queryStart); | ||
} | ||
|
||
private HttpUtils() { | ||
// Utility | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters