How to collect Metrics in Spring-Cloud Zuul - metrics

We have created our application with Spring-Cloud Eureka and Spring-Cloud Zuul with multiple core / support micro services registering to Eureka and accessed via Zuul, everything works fine.
We wanted to collect metrics of the APIs that is accessed via ZUUL.
For example, API - ".../extract" need to know how many times its accessed in 5,15 and 60min time period.
We did some analysis and found various metrics library like Netflix Servo, Dropwiard Metrics, Spring Boot Actuator. Everything points to implementation at the service or API level. We wanted our metrics to be captured at ZUUL itself so that a simple counter is implemented in ZUUL and that would provide us the required metrics. Any suggestion in how to implement this would be helpful.

Related

load balancer and Circuit Breaker

I search to use spring boot, spring-cloud-gateway, netflix eureka.
Is there anything to do to have a load balancer and circuit breaker for micro-service instance?
I found few information ex ribbon when spring gateway is used instead of zuul.
Actually I have an application for the gateway, another for eureka, another for thymeleaf client
security is not yet choose, probabley jwt
With Spring Cloud Gateway, you can currently use the Hystrix Gateway Filter.
Consider using Hystrix. It is extremely good for microservices and aligns well with Spring cloud stack. Also, take a look at Feign, due to its simplistic approach to communication between microservices and integration with hystrix and ribbon.

Consul with Spring Cloud Gateway - Inter Service Communication

The setup:
I have a set of Spring Boot based microservices that are fronted by Spring Cloud Gateway, meaning every request that comes from UI or external API client first comes to Spring Cloud Gateway and is then forwarded to appropriate microservice.
The routes are configured in Consul, and Spring Cloud Gateway communicates with Consul to get the routes accordingly.
Requirement:
There is a need of some microservices communicating with each other with REST APIs. I would prefer this communication to happen via the Spring Cloud Gateway as well. This will help in reducing multiple services going to Consul for getting other service's details.
This means every service should know Gateway's detail at least. And there can be multiple instances of Gateways as well. How is this dealt with in bigger architectures?
Any example that I look up contains one service using Consul, or Gateway using the consul with one microservice. Couldn't understand how to extrapolate that design to a bigger system.

what is the difference between netflix zuul server and netflix eureka server?

i have created two java spring-boot micro services they are
1) producer
2) consumer
and i have used spring eureka server for service registration and discovery . it worked fine . then what is the use of Netflix Zuul.
Let's suppose you have 20 services to which user can interact to, and of course we are not going to expose each and every services publicly because that will be madness (because all services will have different ports and context), so the best approach will be to use an API gateway which will act as single entry point access to our application (developed in micro service pattern) and that is where Zuul comes into picture. Zuul act as a reverse proxy to all your micro-services running behind it and is capable of following
Authentication
Dynamic Routing
Service Migration
Load Shedding
Security
Static Response handling
Active/Active traffic management
You can go through documentation here
If you have enough experience in the domain, you could look at zuul as an API gateway like Apigee. It is very feature rich and touches up on a lot of different concerns like routing, monitoring and most importantly, security. And eureka as a service discovery platform that allows you to load balance (in Linux terms the nginx or haproxy) and fail over between your service instances.
Typically the backend services that perform the server side business operations (i.e. core) are not exposed publicly due to many reasons. They are shielded by some Gateway layer that also serves as reverse-proxy. Netflix Zuul serves as this gateway layer which easily gives you the capabilities as mentioned by #Apollo and here

how to use hystrix to monitoring all microservices

I'm new on microservices and I have seen a tutorial(from udemy) where shows technologies like eureka, feign,spring cloud config,hystrix and zuul, but after make some examples I don't understand very well how hystrix monitor and zuul works, In the examples I noticed that hystrix is used by a main application that it access to microservices and in that way I can monitoring my microservices, but with zuul I noticed that it works like a proxy but this is calling the same microservices like the other application, so my question is how can I monitoring the microservices with hystrix if are called by zuul and by the another application, am I need two hystrix monitor or can I have one general?
Thanks in advance.
After read some examples I noticed that zuul is always the start for applications so I can add hystrix monitor to zuul and call the microservices, but I still have doubt about the circuit breaker in use with zuul so I will keep searching.

Creating a Client/Service in Netflix Eureka

With regards to the Netflix Eureka Service Registry, I have setup the Eureka Netflix Server using Tomcat 8.0.35 successfully. I have also got the basic Example Service & Client to communicate with each other. I'm still new to Eureka and the management decision is to use Eureka with Spring as several new applications are written around the Spring framework.
I have been following the wiki in order to understand how the communication works (But with little to no success with registering services).. Eureka Github Wiki.
My question is: Do I need to create my own Eureka Service & Client in order to maintain a registry of about 50 cloud instances? (If so, can you please point me in the right direction).
I have hands on experience with Consul/RESTfull API, and have implemented Consul in production (using php, and qbit); however the Netflix Eureka Registry look's as though I need to learn eureka/spring + client/server java programming? I'm still getting used to the following terms.
Eureka Server (I successfully got this working using Tomcat8/JDK1.8 + the eureka.war)
Eureka Service (Some kind of stand-alone RESTfull service that queries the Eureka-Server and listens for client requests)
Eureka Client (Java snippet to be embedded into the Java servlets/jsp)?
Zuul (A type of routing/load-balancing app - similar to HaProxy ?)
Ribbon (A type of routing/load-balancing app - similar to HaProxy ?)
I would like to get the Service & Client configured for mostly non-AWS cloud instances. The Eureka Wiki is not very helpful when it comes to creating a working eureka service & client. Any help to point me in the right direction to implement a Eureka based RESTfull system would be helpful.
I suggest you to read this documentation about spring-cloud : http://cloud.spring.io/spring-cloud-static/spring-cloud.html
It should be a good start to setup a few simple spring-boot/spring-cloud services and start to use advanced tools like zuul/ribbon/hystrix ...
There is a simple example of distributed system using Spring Boot and Spring Cloud Netflix.
This project contains the following microservices:
requestor and responder which communicates via REST/HTTP
gateway microservice - Spring Boot app + Zuul
discovery microservice - Spring Boot app + Eureka
Moreover, requestor microservice uses Hystrix library.
As you can see, Spring Cloud provides a really good wrapper for Netflix solutions. As a result, you can start quickly with minimal configuration.

Resources