Skip to content

Commit

Permalink
[improve] add shenyu\spring gateway i18n (#2511)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aias00 authored Aug 12, 2024
1 parent 0634e7b commit e34b640
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 0 deletions.
60 changes: 60 additions & 0 deletions manager/src/main/resources/define/app-shenyu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ params:
defaultValue: 6000
metrics:
- name: shenyu_request_total
i18n:
zh-CN: ShenYu请求总量
en-US: ShenYu Request Total
priority: 0
fields:
- field: value
Expand All @@ -70,6 +73,9 @@ metrics:
parseType: prometheus

- name: shenyu_request_throw_created
i18n:
zh-CN: ShenYu请求异常总量
en-US: ShenYu Request Exception Total
priority: 1
fields:
# field-metric name, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-whether it is a metrics label field
Expand All @@ -90,6 +96,9 @@ metrics:
parseType: prometheus

- name: process_cpu_seconds_total
i18n:
zh-CN: 进程 CPU 时间总量 (秒)
en-US: Process CPU Time Total
priority: 1
fields:
# field-metric name, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-whether it is a metrics label field
Expand All @@ -111,6 +120,9 @@ metrics:
parseType: prometheus

- name: process_open_fds
i18n:
zh-CN: 进程打开的文件描述符数量
en-US: Process Open Fds
priority: 1
fields:
# field-metric name, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-whether it is a metrics label field
Expand All @@ -131,6 +143,9 @@ metrics:
parseType: prometheus

- name: process_max_fds
i18n:
zh-CN: 进程最大文件描述符数量
en-US: Process Max Fds
priority: 1
fields:
# field-metric name, type-metric type(0-number,1-string), unit-metric unit('%','ms','MB'), label-whether it is a metrics label field
Expand All @@ -151,15 +166,27 @@ metrics:
parseType: prometheus

- name: jvm_info
i18n:
zh-CN: JVM 信息
en-US: JVM Info
priority: 1
fields:
# Metric information includes field name, type field type (0-number number, 1-string string), label-whether it is a metric label field, unit: metric unit
- field: runtime
type: 1
i18n:
zh-CN: 运行时
en-US: Runtime
- field: vendor
type: 1
i18n:
zh-CN: 供应商
en-US: Vendor
- field: version
type: 1
i18n:
zh-CN: 版本
en-US: Version
# Monitoring and collection usage protocol eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: http
# Specific collection configuration when protocol is http protocol
Expand All @@ -175,12 +202,18 @@ metrics:
parseType: prometheus

- name: jvm_memory_bytes_used
i18n:
zh-CN: JVM 内存使用字节数
en-US: JVM Memory Bytes Used
priority: 1
fields:
# Metric information includes field name, type field type (0-number number, 1-string string), label-whether it is a metric label field, unit: metric unit
- field: area
type: 1
label: true
i18n:
zh-CN: 区域
en-US: Area
- field: value
type: 0
unit: MB
Expand All @@ -201,12 +234,18 @@ metrics:
parseType: prometheus

- name: jvm_memory_pool_bytes_used
i18n:
zh-CN: JVM 内存池使用字节数
en-US: JVM Memory Pool Bytes Used
priority: 1
fields:
# Metric information includes field name, type field type (0-number number, 1-string string), label-whether it is a metric label field, unit: metric unit
- field: pool
type: 1
label: true
i18n:
zh-CN:
en-US: Pool
- field: value
type: 0
unit: MB
Expand All @@ -227,12 +266,18 @@ metrics:
parseType: prometheus

- name: jvm_memory_pool_bytes_committed
i18n:
zh-CN: JVM 内存池提交字节数
en-US: JVM Memory Pool Bytes Committed
priority: 1
fields:
# Metric information includes field name, type field type (0-number number, 1-string string), label-whether it is a metric label field, unit: metric unit
- field: pool
type: 1
label: true
i18n:
zh-CN:
en-US: Pool
- field: value
type: 0
unit: MB
Expand All @@ -253,12 +298,18 @@ metrics:
parseType: prometheus

- name: jvm_memory_pool_bytes_max
i18n:
zh-CN: JVM 内存池最大字节数
en-US: JVM Memory Pool Bytes Max
priority: 1
fields:
# Metric information includes field name, type field type (0-number number, 1-string string), label-whether it is a metric label field, unit: metric unit
- field: pool
type: 1
label: true
i18n:
zh-CN:
en-US: Pool
- field: value
type: 0
unit: MB
Expand All @@ -279,14 +330,23 @@ metrics:
parseType: prometheus

- name: jvm_threads_state
i18n:
zh-CN: JVM 线程状态
en-US: JVM Threads State
priority: 1
fields:
# Metric information includes field name, type field type (0-number number, 1-string string), label-whether it is a metric label field, unit: metric unit
- field: state
type: 1
label: true
i18n:
zh-CN: 状态
en-US: State
- field: count
type: 0
i18n:
zh-CN: 数量
en-US: Count
aliasFields:
- state
- value
Expand Down
84 changes: 84 additions & 0 deletions manager/src/main/resources/define/app-spring_gateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ params:
metrics:
# metrics - available
- name: available
i18n:
zh-CN: 可用性
en-US: Availability
# metrics scheduling priority(0->127)->(high->low), metrics with the same priority will be scheduled in parallel
# priority 0's metrics is availability metrics, it will be scheduled first, only availability metrics collect success will the scheduling continue
priority: 0
Expand All @@ -118,6 +121,9 @@ metrics:
- field: responseTime
type: 0
unit: ms
i18n:
zh-CN: 响应时间
en-US: Response Time
# the protocol used for monitoring, eg: sql, ssh, http, telnet, wmi, snmp, sdk
protocol: http
# Specific collection configuration when protocol is http protocol
Expand All @@ -142,21 +148,42 @@ metrics:
parseType: default

- name: environment
i18n:
zh-CN: 环境
en-US: Environment
priority: 1
fields:
# The metric information, including field name, type of the field (0-number, 1-string), whether it is an instance primary key, and the unit of the metric.
- field: profile
type: 1
i18n:
zh-CN: 配置文件
en-US: Profile
- field: port
type: 0
i18n:
zh-CN: 端口
en-US: Port
- field: os
type: 1
i18n:
zh-CN: 操作系统
en-US: Operating System
- field: os_arch
type: 1
i18n:
zh-CN: 操作系统架构
en-US: Operating System Architecture
- field: jdk_vendor
type: 1
i18n:
zh-CN: JDK 供应商
en-US: JDK Vendor
- field: jvm_version
type: 1
i18n:
zh-CN: JVM 版本
en-US: JVM Version
# metric alias list, used to identify metrics in query results
aliasFields:
- $.activeProfiles[0]
Expand Down Expand Up @@ -199,11 +226,17 @@ metrics:
parseScript: '$'

- name: thread_state
i18n:
zh-CN: 线程状态
en-US: Thread State
visible: false
priority: 2
fields:
- field: state
type: 1
i18n:
zh-CN: 状态
en-US: State
protocol: http
http:
host: ^_^host^_^
Expand All @@ -219,13 +252,22 @@ metrics:
parseScript: '$.availableTags[?(@.tag == "state")].values[*]'

- name: threads
i18n:
zh-CN: 线程
en-US: Threads
priority: 3
fields:
- field: state
type: 1
i18n:
zh-CN: 状态
en-US: State
instance: true
- field: size
type: 0
i18n:
zh-CN: 数量
en-US: Size
aliasFields:
- $.measurements[?(@.statistic == "VALUE")].value
calculates:
Expand All @@ -246,11 +288,17 @@ metrics:
parseScript: '$'

- name: space_name
i18n:
zh-CN: 空间名称
en-US: Space Name
visible: false
priority: 4
fields:
- field: id
type: 1
i18n:
zh-CN: 主键
en-US: ID
protocol: http
http:
host: ^_^host^_^
Expand All @@ -266,13 +314,22 @@ metrics:
parseScript: '$.availableTags[?(@.tag == "id")].values[*]'

- name: memory_used
i18n:
zh-CN: 内存使用
en-US: Memory Used
priority: 5
fields:
- field: space
type: 1
i18n:
zh-CN: 空间
en-US: Space
instance: true
- field: mem_used
type: 0
i18n:
zh-CN: 内存使用
en-US: Memory Used
unit: MB
aliasFields:
- $.measurements[?(@.statistic == "VALUE")].value
Expand All @@ -296,10 +353,16 @@ metrics:
parseScript: '$'

- name: health
i18n:
zh-CN: 健康
en-US: Health
priority: 6
fields:
- field: status
type: 1
i18n:
zh-CN: 状态
en-US: Status
protocol: http
http:
host: ^_^host^_^
Expand All @@ -314,11 +377,17 @@ metrics:
parseType: default

- name: route_id
i18n:
zh-CN: 路由 ID
en-US: Route ID
visible: false
priority: 7
fields:
- field: name
type: 1
i18n:
zh-CN: 名称
en-US: Name
protocol: http
http:
host: ^_^host^_^
Expand All @@ -334,17 +403,32 @@ metrics:
parseScript: '$[*].route_id'

- name: route_info
i18n:
zh-CN: 路由信息
en-US: Route Info
priority: 8
fields:
- field: route_id
type: 1
i18n:
zh-CN: 路由 ID
en-US: Route ID
instance: true
- field: predicate
type: 1
i18n:
zh-CN: 断言
en-US: Predicate
- field: uri
type: 1
i18n:
zh-CN: URI
en-US: URI
- field: order
type: 0
i18n:
zh-CN: 顺序
en-US: Order
aliasFields:
- $.predicate
- $.uri
Expand Down

0 comments on commit e34b640

Please sign in to comment.