开发者社区 > 云原生 > 正文

网关流未显示在dashboard中

网关流不会显示在dashboard中,但规则可以正常工作。

1、 使用nacos作为数据源在application.yml中配置网关流

2、 启动应用程序。

3、 网关流不会显示在dashboard中,但规则是有效的。

application.yml -> spring: application: name: gateway cloud: sentinel: transport: dashboard: localhost:8099 datasource: ds1: nacos: server-addr: localhost:8848 dataId: gateway-sentinel groupId: DEFAULT_GROUP data-type: json rule-type: gw-flow zuul: order: pre: 10000 post: 1000 error: -1 filter: enabled: false

rules in the nacos config -> [ { "resource": "user", "resourceMode": 0, "grade": 1, "count": 1, "intervalSec": 1, "controlBehavior": 0, "burst": 0, "paramItem": { "parseStrategy": 0 } }, { "resource": "httpbin_route", "count": 0, "paramItem": { "parseStrategy": 3, "fieldName": "name" } } ]

spring boot 2.0.2.RELEASE spring cloud Finchley.RC2 spring clound alibaba 2.0.1.RELEASE

dependency: spring-cloud-starter-alibaba-sentinel sentinel-datasource-nacos sentinel-zuul-adapter spring-cloud-alibaba-sentinel-gateway

当调用openapi时http://localhost:8719/gateway/getApiDefinitions和http://localhost:8719/getRules?type=flow都是空数组。

原提问者GitHub用户joeyjoker

展开
收起
云上静思 2023-05-19 16:34:40 131 0
1 条回答
写回答
取消 提交回答
  • 要获取网关规则,请尝试以下开放api: http://localhost:8719/gateway/getRules

    也许您需要显式地添加zuul依赖项。

    org.springframework.cloud spring-cloud-starter-netflix-zuul 2.0.0.RC2

    原回答者GitHub用户cdfive

    2023-05-19 22:43:57
    赞同 展开评论 打赏
问答标签:
问答地址:

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

相关电子书

更多
阿里云容器 AHAS Sentinel 网关流控揭秘 立即下载
阿里Tengine网关最佳实践 立即下载
《MSE 微服务网关》 立即下载