docs: improve api desc for statsd

This commit is contained in:
zhouzb 2022-09-30 17:55:12 +08:00
parent f08982be93
commit 0975bf21a9
3 changed files with 28 additions and 13 deletions

View File

@ -76,7 +76,7 @@ The default is false."""
deactivate_at { deactivate_at {
desc { desc {
en: """Alarm end time, in the rfc3339 standard time format.""" en: """Alarm end time, using rfc3339 standard time format."""
zh: """告警结束时间,使用 rfc3339 标准时间格式。""" zh: """告警结束时间,使用 rfc3339 标准时间格式。"""
} }
} }

View File

@ -1,9 +1,23 @@
emqx_statsd_schema { emqx_statsd_schema {
get_statsd_config_api {
desc {
en: """List the configuration of StatsD metrics collection and push service."""
zh: """列出 StatsD 指标采集和推送服务的的配置。"""
}
}
update_statsd_config_api {
desc {
en: """Update the configuration of StatsD metrics collection and push service."""
zh: """更新 StatsD 指标采集和推送服务的配置。"""
}
}
statsd { statsd {
desc { desc {
en: """Settings for reporting metrics to StatsD""" en: """StatsD metrics collection and push configuration."""
zh: """StatsD 监控数据推送""" zh: """StatsD 指标采集与推送配置。"""
} }
label { label {
en: """StatsD""" en: """StatsD"""
@ -13,29 +27,29 @@ emqx_statsd_schema {
server { server {
desc { desc {
en: """URL of StatsD server""" en: """StatsD server address."""
zh: """StatsD 服务器地址""" zh: """StatsD 服务器地址"""
} }
} }
sample_interval { sample_interval {
desc { desc {
en: """Data collection interval.""" en: """The sampling interval for metrics."""
zh: """数据收集间隔""" zh: """指标的采样间隔。"""
} }
} }
flush_interval { flush_interval {
desc { desc {
en: """Data reporting interval.""" en: """The push interval for metrics."""
zh: """数据推送间隔""" zh: """指标的推送间隔。"""
} }
} }
enable { enable {
desc { desc {
en: """Turn StatsD data pushing on or off""" en: """Enable or disable StatsD metrics collection and push service."""
zh: """开启或关闭 StatsD 数据推送""" zh: """启用或禁用 StatsD 指标采集和推送服务。"""
} }
} }
} }

View File

@ -20,6 +20,7 @@
-include("emqx_statsd.hrl"). -include("emqx_statsd.hrl").
-include_lib("hocon/include/hoconsc.hrl").
-include_lib("typerefl/include/types.hrl"). -include_lib("typerefl/include/types.hrl").
-import(hoconsc, [mk/2, ref/2]). -import(hoconsc, [mk/2, ref/2]).
@ -48,14 +49,14 @@ schema("/statsd") ->
'operationId' => statsd, 'operationId' => statsd,
get => get =>
#{ #{
description => <<"Get statsd config">>, description => ?DESC(get_statsd_config_api),
tags => ?API_TAG_STATSD, tags => ?API_TAG_STATSD,
responses => responses =>
#{200 => statsd_config_schema()} #{200 => statsd_config_schema()}
}, },
put => put =>
#{ #{
description => <<"Set statsd config">>, description => ?DESC(update_statsd_config_api),
tags => ?API_TAG_STATSD, tags => ?API_TAG_STATSD,
'requestBody' => statsd_config_schema(), 'requestBody' => statsd_config_schema(),
responses => responses =>