Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
6fba477d
Commit
6fba477d
authored
Sep 18, 2018
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove redundant handling of a null exchange from WebFluxTags.uri()
Closes gh-14504
parent
6020cb67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
27 deletions
+16
-27
WebFluxTags.java
...boot/actuate/metrics/web/reactive/server/WebFluxTags.java
+16
-21
WebFluxTagsTests.java
...actuate/metrics/web/reactive/server/WebFluxTagsTests.java
+0
-6
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTags.java
View file @
6fba477d
...
...
@@ -40,8 +40,6 @@ public final class WebFluxTags {
private
static
final
Tag
URI_ROOT
=
Tag
.
of
(
"uri"
,
"root"
);
private
static
final
Tag
URI_UNKNOWN
=
Tag
.
of
(
"uri"
,
"UNKNOWN"
);
private
static
final
Tag
EXCEPTION_NONE
=
Tag
.
of
(
"exception"
,
"None"
);
private
WebFluxTags
()
{
...
...
@@ -80,26 +78,23 @@ public final class WebFluxTags {
* @return the uri tag derived from the exchange
*/
public
static
Tag
uri
(
ServerWebExchange
exchange
)
{
if
(
exchange
!=
null
)
{
PathPattern
pathPattern
=
exchange
.
getAttribute
(
HandlerMapping
.
BEST_MATCHING_PATTERN_ATTRIBUTE
);
if
(
pathPattern
!=
null
)
{
return
Tag
.
of
(
"uri"
,
pathPattern
.
getPatternString
());
}
HttpStatus
status
=
exchange
.
getResponse
().
getStatusCode
();
if
(
status
!=
null
&&
status
.
is3xxRedirection
())
{
return
URI_REDIRECTION
;
}
if
(
status
!=
null
&&
status
.
equals
(
HttpStatus
.
NOT_FOUND
))
{
return
URI_NOT_FOUND
;
}
String
path
=
exchange
.
getRequest
().
getPath
().
value
();
if
(
path
.
isEmpty
())
{
return
URI_ROOT
;
}
return
Tag
.
of
(
"uri"
,
path
);
PathPattern
pathPattern
=
exchange
.
getAttribute
(
HandlerMapping
.
BEST_MATCHING_PATTERN_ATTRIBUTE
);
if
(
pathPattern
!=
null
)
{
return
Tag
.
of
(
"uri"
,
pathPattern
.
getPatternString
());
}
HttpStatus
status
=
exchange
.
getResponse
().
getStatusCode
();
if
(
status
!=
null
&&
status
.
is3xxRedirection
())
{
return
URI_REDIRECTION
;
}
if
(
status
!=
null
&&
status
.
equals
(
HttpStatus
.
NOT_FOUND
))
{
return
URI_NOT_FOUND
;
}
String
path
=
exchange
.
getRequest
().
getPath
().
value
();
if
(
path
.
isEmpty
())
{
return
URI_ROOT
;
}
return
URI_UNKNOWN
;
return
Tag
.
of
(
"uri"
,
path
)
;
}
/**
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTagsTests.java
View file @
6fba477d
...
...
@@ -78,12 +78,6 @@ public class WebFluxTagsTests {
assertThat
(
tag
.
getValue
()).
isEqualTo
(
"root"
);
}
@Test
public
void
uriTagIsUnknownWhenRequestIsNull
()
{
Tag
tag
=
WebFluxTags
.
uri
(
null
);
assertThat
(
tag
.
getValue
()).
isEqualTo
(
"UNKNOWN"
);
}
@Test
public
void
methodTagToleratesNonStandardHttpMethods
()
{
ServerWebExchange
exchange
=
mock
(
ServerWebExchange
.
class
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment