Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
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
openSource
spring-cloud-netflix
Commits
403bd8d7
Commit
403bd8d7
authored
Aug 22, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move debug logging to TRaceRepository
parent
ea80ac17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
16 additions
and
132 deletions
+16
-132
ZuulProxyConfiguration.java
...amework/platform/netflix/zuul/ZuulProxyConfiguration.java
+14
-17
SendResponseFilter.java
...latform/netflix/zuul/filters/post/SendResponseFilter.java
+0
-0
StatsFilter.java
...ework/platform/netflix/zuul/filters/post/StatsFilter.java
+0
-51
DebugFilter.java
...mework/platform/netflix/zuul/filters/pre/DebugFilter.java
+2
-2
DebugRequestFilter.java
...platform/netflix/zuul/filters/pre/DebugRequestFilter.java
+0
-62
RibbonRoutingFilter.java
...tform/netflix/zuul/filters/route/RibbonRoutingFilter.java
+0
-0
SimpleHostRoutingFilter.java
...m/netflix/zuul/filters/route/SimpleHostRoutingFilter.java
+0
-0
No files found.
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/zuul/ZuulProxyConfiguration.java
View file @
403bd8d7
package
org
.
springframework
.
platform
.
netflix
.
zuul
;
package
org
.
springframework
.
platform
.
netflix
.
zuul
;
import
com.netflix.zuul.context.ContextLifecycleFilter
;
import
java.util.ArrayList
;
import
com.netflix.zuul.http.ZuulServlet
;
import
java.util.Collection
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.trace.TraceRepository
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.boot.context.embedded.FilterRegistrationBean
;
import
org.springframework.boot.context.embedded.FilterRegistrationBean
;
...
@@ -11,14 +13,12 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
...
@@ -11,14 +13,12 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.platform.netflix.zuul.filters.post.SendResponseFilter
;
import
org.springframework.platform.netflix.zuul.filters.post.SendResponseFilter
;
import
org.springframework.platform.netflix.zuul.filters.post.StatsFilter
;
import
org.springframework.platform.netflix.zuul.filters.pre.DebugFilter
;
import
org.springframework.platform.netflix.zuul.filters.pre.DebugFilter
;
import
org.springframework.platform.netflix.zuul.filters.pre.DebugRequestFilter
;
import
org.springframework.platform.netflix.zuul.filters.pre.PreDecorationFilter
;
import
org.springframework.platform.netflix.zuul.filters.pre.PreDecorationFilter
;
import
org.springframework.platform.netflix.zuul.filters.route.RibbonRoutingFilter
;
import
org.springframework.platform.netflix.zuul.filters.route.RibbonRoutingFilter
;
import
java.util.ArrayList
;
import
com.netflix.zuul.context.ContextLifecycleFilter
;
import
java.util.Collection
;
import
com.netflix.zuul.http.ZuulServlet
;
/**
/**
* @author Spencer Gibb
* @author Spencer Gibb
...
@@ -31,6 +31,9 @@ public class ZuulProxyConfiguration {
...
@@ -31,6 +31,9 @@ public class ZuulProxyConfiguration {
@Autowired
@Autowired
private
ZuulProxyProperties
props
;
private
ZuulProxyProperties
props
;
@Autowired
(
required
=
false
)
private
TraceRepository
traces
;
@Bean
@Bean
public
FilterRegistrationBean
contextLifecycleFilter
()
{
public
FilterRegistrationBean
contextLifecycleFilter
()
{
...
@@ -65,11 +68,6 @@ public class ZuulProxyConfiguration {
...
@@ -65,11 +68,6 @@ public class ZuulProxyConfiguration {
}
}
@Bean
@Bean
public
DebugRequestFilter
debugRequestFilter
()
{
return
new
DebugRequestFilter
();
}
@Bean
public
PreDecorationFilter
preDecorationFilter
()
{
public
PreDecorationFilter
preDecorationFilter
()
{
return
new
PreDecorationFilter
();
return
new
PreDecorationFilter
();
}
}
...
@@ -77,7 +75,11 @@ public class ZuulProxyConfiguration {
...
@@ -77,7 +75,11 @@ public class ZuulProxyConfiguration {
// route filters
// route filters
@Bean
@Bean
public
RibbonRoutingFilter
ribbonRoutingFilter
()
{
public
RibbonRoutingFilter
ribbonRoutingFilter
()
{
return
new
RibbonRoutingFilter
();
RibbonRoutingFilter
filter
=
new
RibbonRoutingFilter
();
if
(
traces
!=
null
)
{
filter
.
setTraces
(
traces
);
}
return
filter
;
}
}
// post filters
// post filters
...
@@ -86,9 +88,4 @@ public class ZuulProxyConfiguration {
...
@@ -86,9 +88,4 @@ public class ZuulProxyConfiguration {
return
new
SendResponseFilter
();
return
new
SendResponseFilter
();
}
}
@Bean
public
StatsFilter
statsFilter
()
{
return
new
StatsFilter
();
}
}
}
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/zuul/filters/post/SendResponseFilter.java
View file @
403bd8d7
This diff is collapsed.
Click to expand it.
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/zuul/filters/post/StatsFilter.java
deleted
100644 → 0
View file @
ea80ac17
package
org
.
springframework
.
platform
.
netflix
.
zuul
.
filters
.
post
;
import
com.netflix.zuul.ZuulFilter
;
import
com.netflix.zuul.context.RequestContext
;
import
java.util.List
;
public
class
StatsFilter
extends
ZuulFilter
{
@Override
public
String
filterType
()
{
return
"post"
;
}
@Override
public
int
filterOrder
()
{
return
2000
;
}
@Override
public
boolean
shouldFilter
()
{
return
true
;
}
@Override
public
Object
run
()
{
dumpRoutingDebug
();
dumpRequestDebug
();
return
null
;
}
public
void
dumpRequestDebug
()
{
@SuppressWarnings
(
"unchecked"
)
List
<
String
>
rd
=
(
List
<
String
>)
RequestContext
.
getCurrentContext
().
get
(
"requestDebug"
);
if
(
rd
!=
null
)
{
for
(
String
it
:
rd
)
{
System
.
out
.
println
(
"REQUEST_DEBUG::"
+
it
);
}
}
}
public
void
dumpRoutingDebug
()
{
@SuppressWarnings
(
"unchecked"
)
List
<
String
>
rd
=
(
List
<
String
>)
RequestContext
.
getCurrentContext
().
get
(
"routingDebug"
);
if
(
rd
!=
null
)
{
for
(
String
it
:
rd
)
{
System
.
out
.
println
(
"ZUUL_DEBUG::"
+
it
);
}
}
}
}
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/zuul/filters/pre/DebugFilter.java
View file @
403bd8d7
...
@@ -12,9 +12,9 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -12,9 +12,9 @@ import javax.servlet.http.HttpServletRequest;
public
class
DebugFilter
extends
ZuulFilter
{
public
class
DebugFilter
extends
ZuulFilter
{
static
final
DynamicBooleanProperty
routingDebug
=
DynamicPropertyFactory
.
getInstance
()
static
final
DynamicBooleanProperty
routingDebug
=
DynamicPropertyFactory
.
getInstance
()
.
getBooleanProperty
(
ZuulConstants
.
ZUUL_DEBUG_REQUEST
,
tru
e
);
.
getBooleanProperty
(
ZuulConstants
.
ZUUL_DEBUG_REQUEST
,
fals
e
);
static
final
DynamicStringProperty
debugParameter
=
DynamicPropertyFactory
.
getInstance
()
static
final
DynamicStringProperty
debugParameter
=
DynamicPropertyFactory
.
getInstance
()
.
getStringProperty
(
ZuulConstants
.
ZUUL_DEBUG_PARAMETER
,
"d"
);
.
getStringProperty
(
ZuulConstants
.
ZUUL_DEBUG_PARAMETER
,
"d
ebug
"
);
@Override
@Override
public
String
filterType
()
{
public
String
filterType
()
{
...
...
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/zuul/filters/pre/DebugRequestFilter.java
deleted
100644 → 0
View file @
ea80ac17
package
org
.
springframework
.
platform
.
netflix
.
zuul
.
filters
.
pre
;
import
com.netflix.zuul.ZuulFilter
;
import
com.netflix.zuul.context.Debug
;
import
com.netflix.zuul.context.RequestContext
;
import
org.apache.commons.io.IOUtils
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.Enumeration
;
public
class
DebugRequestFilter
extends
ZuulFilter
{
@Override
public
String
filterType
()
{
return
"pre"
;
}
@Override
public
int
filterOrder
()
{
return
10000
;
}
@Override
public
boolean
shouldFilter
()
{
return
Debug
.
debugRequest
();
}
@Override
public
Object
run
()
{
HttpServletRequest
req
=
RequestContext
.
getCurrentContext
().
getRequest
();
Debug
.
addRequestDebug
(
"REQUEST:: "
+
req
.
getScheme
()
+
" "
+
req
.
getRemoteAddr
()
+
":"
+
req
.
getRemotePort
());
Debug
.
addRequestDebug
(
"REQUEST:: > "
+
req
.
getMethod
()
+
" "
+
req
.
getRequestURI
()
+
" "
+
req
.
getProtocol
());
Enumeration
<
String
>
headerIt
=
req
.
getHeaderNames
();
while
(
headerIt
.
hasMoreElements
())
{
String
name
=
headerIt
.
nextElement
();
String
value
=
req
.
getHeader
(
name
);
Debug
.
addRequestDebug
(
"REQUEST:: > "
+
name
+
":"
+
value
);
}
final
RequestContext
ctx
=
RequestContext
.
getCurrentContext
();
if
(!
ctx
.
isChunkedRequestBody
())
{
try
{
InputStream
inp
=
ctx
.
getRequest
().
getInputStream
();
if
(
inp
!=
null
)
{
String
body
=
IOUtils
.
toString
(
inp
);
Debug
.
addRequestDebug
(
"REQUEST:: > "
+
body
);
}
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
return
null
;
}
}
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/zuul/filters/route/RibbonRoutingFilter.java
View file @
403bd8d7
This diff is collapsed.
Click to expand it.
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/zuul/filters/route/SimpleHostRoutingFilter.java
View file @
403bd8d7
This diff is collapsed.
Click to expand it.
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