【云原生&微服务>SCG网关篇十】Spring Cloud Gateway集成Actuator、Zipkin详细案例

网友投稿 1322 2022-09-02

【云原生&微服务>SCG网关篇十】Spring Cloud Gateway集成Actuator、Zipkin详细案例

【云原生&微服务>SCG网关篇十】Spring Cloud Gateway集成Actuator、Zipkin详细案例

文章目录

​​一、前言​​​​二、集成Actuator监控网关​​​​三、集成Zipkin​​​​四、总结​​

一、前言

至此微服务网关系列文章已出:

​​【云原生&微服务>SCG网关篇一】为什么要有网关、生产环境如何选择网关​​​​云原生&微服务>SCG网关篇二】生产上那些灰度发布方式​​​​【云原生&微服务>SCG网关篇三】Spring Cloud Gateway是什么、详细使用案例​​​​云原生&微服务>SCG网关篇四】Spring Cloud Gateway内置的11种PredicateFactory如何使用​​​​【云原生&微服务>SCG网关篇五】Spring Cloud Gateway自定义PredicateFactory​​​​【云原生&微服务>SCG网关篇六】Spring Cloud Gateway内置的18种Filter使用姿势​​​​【云原生&微服务>SCG网关篇七】Spring Cloud Gateway基于内置Filter实现限流、熔断、重试​​​​【云原生&微服务>SCG网关篇八】Spring Cloud Gateway三种自定义Filter、GlobalFilter的方式​​​​【云原生&微服务>SCG网关篇九】Spring Cloud Gateway集成Nacos详细案例​​

聊了以下问题:

为什么要有网关?网关的作用是什么?网关的分类?网关的技术选型?使用网关时常用的灰度发布方式有哪些?Spring Cloud Gateway是什么?详细使用案例?Spring Cloud Gateway内置的11种PredicateFactory如何自定义PredicateFactory?Spring Cloud Gateway内置的18种常用的FilterSpring Cloud Gateway基于内置Filter实现限流、熔断、重试Spring Cloud Gateway三种自定义Filter、GlobalFilter的方式Spring Cloud Gateway集成Nacos案例

本文接着聊Spring Cloud Gateway如何集成actuator实现服务状态追踪、集成zipkin实现服务调用链路信息追踪?

PS:SpringCloud版本信息:

2.4.2 2020.0.1 2021.1 org.springframework.boot spring-boot-dependencies ${spring-boot.version} pom import org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import com.alibaba.cloud spring-cloud-alibaba-dependencies ${spring-cloud-alibaba.version} pom import

二、集成Actuator监控网关

接着​​【云原生&微服务>SCG网关篇九】Spring Cloud Gateway集成Nacos详细案例​​继续操作;

gateway可以通过网关指标过滤器(​​GatewayMetricsFilter​​)给出Gateway的调用情况,

1> 在pom中引入spring-boot-starter-actuator依赖:

org.springframework.boot spring-boot-starter-actuator

2> 在application.yml文件中指定监控的路径:

# 集成actuator,使用 endpoints: web: exposure: include: '*' endpoint: health: show-details:

3> 使用使用在pom中引入zipkin和sleuth依赖:

org.springframework.cloud spring-cloud-sleuth-zipkin org.springframework.cloud spring-cloud-starter-sleuth

2> 在application.yml中配置zipkin、sleuth信息:

spring: # 集成zipkin zipkin: base-url: # zipkin不注册到nacos discovery-client-enabled: false sleuth: sampler: # 抽样率。默认是0.1(10%),即丢弃90%的数据 probability: 1.0

3> 调用请求之后,访问Cloud Gateway中如何集成actuator监控服务状态、集成zipkin / sleuth做服务调用链路追踪。

后面还有两篇实操文章:Gateway解决跨域问题、Gateway集成Sentinel实现限流;然后进入源码分析文章;分析Gateway的原理。

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:不会SQL注入,连漫画都看不懂了
下一篇:Deployment failed: repository element was not specified in the POM inside distributionManagement(已解决
相关文章

 发表评论

暂时没有评论,来抢沙发吧~