These are chat archives for spring-cloud/spring-cloud

17th
Apr 2018
CH4:D
@chad_d_stud_twitter
Apr 17 2018 03:24
is it possible to log the forwarded url in zuul?
Joshua Street
@jjstreet
Apr 17 2018 03:25
@chad_d_stud_twitter with a filter sure
what object do i use to know that?
@jjstreet the sample in the guide only uses request.getMethod()
Joshua Street
@jjstreet
Apr 17 2018 03:27
if you are using zuul with ribbon and eureka
CH4:D
@chad_d_stud_twitter
Apr 17 2018 03:27
@jjstreet yeah i do those
Joshua Street
@jjstreet
Apr 17 2018 03:27
it would be easy enough to log which service the request is forwarded to
CH4:D
@chad_d_stud_twitter
Apr 17 2018 03:27
my zuul gateway uses eureka to lookup the services
Joshua Street
@jjstreet
Apr 17 2018 03:28
the host ip would be more difficule
since thats all under ribbon's control
CH4:D
@chad_d_stud_twitter
Apr 17 2018 03:28
okay let me start with that. how to get what service?
Joshua Street
@jjstreet
Apr 17 2018 03:28
there is a RequestContext key
SERVICE_ID_KEY or something
CH4:D
@chad_d_stud_twitter
Apr 17 2018 03:28
okay let me look into that
Joshua Street
@jjstreet
Apr 17 2018 03:29
you can create a filter that logs that id out of the requestcontext
CH4:D
@chad_d_stud_twitter
Apr 17 2018 03:29
can zuul also do url transformations as well?
Joshua Street
@jjstreet
Apr 17 2018 03:29
you can specify a url directly if you want
thats what i am doing since our services dont use eureka
by specifying a url in the properties or through the requestcontext setRouteHost
setting that property makes your request be forwarded using the SimpleHostRouter or something like that
instead of the ribbon one
the routing to url stuff is decently documented in the references
CH4:D
@chad_d_stud_twitter
Apr 17 2018 03:37
i can't seem to find the service id
ctx.get("SERVICE_ID_KEY");
well ctx.keys() doesn't give me anything meaningful
Joshua Street
@jjstreet
Apr 17 2018 03:38
RequestContext.getCurrentContext().get(FilterConstants.SERVICE_ID_KEY);
should give you the service id of the service that will field the request
filter order matters
should probably review the reference docs
CH4:D
@chad_d_stud_twitter
Apr 17 2018 03:41
i got nothing on those either.
am i reading this right? serviceId is the constant
but the config uses service-id
Joshua Street
@jjstreet
Apr 17 2018 03:42
yea
that should be fine
what is order for the filter you making?
CH4:D
@chad_d_stud_twitter
Apr 17 2018 03:43
1
Joshua Street
@jjstreet
Apr 17 2018 03:43
set it to 10
CH4:D
@chad_d_stud_twitter
Apr 17 2018 03:44
what does that do? :O
Joshua Street
@jjstreet
Apr 17 2018 03:44
filters can be ordered
there are several that are added by spring
CH4:D
@chad_d_stud_twitter
Apr 17 2018 03:44
yeah i know but why 10?
making it last?
Joshua Street
@jjstreet
Apr 17 2018 03:44
no it puts it after the pre filters that set some of the ctx properties
but before the routing filters
10 is somewhat arbitrary
50 would probably work too
look in FilterConstants for the order values of the default filters
CH4:D
@chad_d_stud_twitter
Apr 17 2018 03:45
yeah i get what you man
so other filters get to populate the context
Joshua Street
@jjstreet
Apr 17 2018 03:45
yea
CH4:D
@chad_d_stud_twitter
Apr 17 2018 03:46
well that worked. i got my service id :D
Joshua Street
@jjstreet
Apr 17 2018 03:47
cool
CH4:D
@chad_d_stud_twitter
Apr 17 2018 05:36
I guess this will do for now. A little disappointed I can't see where the forwarding went
SubhamAshish
@SubhamAshish
Apr 17 2018 05:47
hello all,
spring cloud sleuth is being able to send only one traceid to zipkin why so ?
Tommy Ludwig
@shakuzen
Apr 17 2018 05:48
@SubhamAshish there’s a dedicated room for Spring Cloud Sleuth here: https://gitter.im/spring-cloud/spring-cloud-sleuth
SubhamAshish
@SubhamAshish
Apr 17 2018 05:48
ok thanks
zhangjun075
@zhangjun075
Apr 17 2018 10:00
I user turbine ,my cluster contains 4 machine in eureka console.But in turbine console ,I can see hosts is 2
why?
who can help me
it is so strange
anyone?
ManikandanPP
@ManikandanPP
Apr 17 2018 11:07
which is the best API gateway zuul 2 vs spring cloud gateway?
rishi26jain
@rishi26jain
Apr 17 2018 11:16
Could you tell me, how to reduced time taken to de-registered the instance from Eureka Server?
CH4:D
@chad_d_stud_twitter
Apr 17 2018 11:40
@rishi26jain I believe eureka.instance.lease-renewal-interval-in-seconds is what you're looking for
@ManikandanPP I haven't tried cloud gateway but I was able to get a zuul gateway up and running within an hour. i was also able to customize it via config file (although i'd imagine it's possible programmatically)
and i simply needed to route it like so
image.png
CH4:D
@chad_d_stud_twitter
Apr 17 2018 11:46
Sorry, zuul.route.myservice.path cayenne is what i named my app :)
@rishi26jain in STS4 you can mouse over that key in application.properties for the documentation