From 9100b13db60099100f68f96c1b0bbc6e4aedb6c1 Mon Sep 17 00:00:00 2001 From: Stefan Strigler Date: Fri, 2 Dec 2022 13:23:40 +0100 Subject: [PATCH 1/5] docs: fix schema for /trace/:name/log --- apps/emqx_management/src/emqx_mgmt_api_trace.erl | 4 ++-- changes/v5.0.12-en.md | 2 ++ changes/v5.0.12-zh.md | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/emqx_management/src/emqx_mgmt_api_trace.erl b/apps/emqx_management/src/emqx_mgmt_api_trace.erl index 587257688..466b0e82e 100644 --- a/apps/emqx_management/src/emqx_mgmt_api_trace.erl +++ b/apps/emqx_management/src/emqx_mgmt_api_trace.erl @@ -172,8 +172,8 @@ schema("/trace/:name/log") -> responses => #{ 200 => [ - {items, hoconsc:mk(binary(), #{example => "TEXT-LOG-ITEMS"})} - | fields(bytes) ++ fields(position) + {items, hoconsc:mk(binary(), #{example => "TEXT-LOG-ITEMS"})}, + {meta, fields(bytes) ++ fields(position)} ] } } diff --git a/changes/v5.0.12-en.md b/changes/v5.0.12-en.md index 076ec6e69..0a52f6f08 100644 --- a/changes/v5.0.12-en.md +++ b/changes/v5.0.12-en.md @@ -19,3 +19,5 @@ ## Bug fixes - Fix that the obsolete SSL files aren't deleted after the ExHook config update [#9432](https://github.com/emqx/emqx/pull/9432). + +- Fix schema for `GET /trace/:name/log` [#9468](https://github.com/emqx/emqx/pull/9468). diff --git a/changes/v5.0.12-zh.md b/changes/v5.0.12-zh.md index 3f4c52b75..8c58cdec2 100644 --- a/changes/v5.0.12-zh.md +++ b/changes/v5.0.12-zh.md @@ -18,3 +18,5 @@ ## 修复 - 修复 ExHook 更新 SSL 相关配置后,过时的 SSL 文件没有被删除的问题 [#9432](https://github.com/emqx/emqx/pull/9432)。 + +- [FIXME] Fix schema for `GET /trace/:name/log` [#9468](https://github.com/emqx/emqx/pull/9468). From f8dd8d652dc584cc3fbd223557efbb82f9691efb Mon Sep 17 00:00:00 2001 From: Stefan Strigler Date: Fri, 2 Dec 2022 13:39:58 +0100 Subject: [PATCH 2/5] docs: add swagger error codes for /trace/:name/[log|download] --- apps/emqx_management/src/emqx_mgmt_api_trace.erl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/emqx_management/src/emqx_mgmt_api_trace.erl b/apps/emqx_management/src/emqx_mgmt_api_trace.erl index 466b0e82e..52a8c1040 100644 --- a/apps/emqx_management/src/emqx_mgmt_api_trace.erl +++ b/apps/emqx_management/src/emqx_mgmt_api_trace.erl @@ -140,7 +140,8 @@ schema("/trace/:name/download") -> 'application/octet-stream' => #{schema => #{type => "string", format => "binary"}} } - } + }, + 404 => emqx_dashboard_swagger:error_codes(['NOT_FOUND'], <<"Trace Name Not Found">>) } } }; @@ -174,7 +175,10 @@ schema("/trace/:name/log") -> [ {items, hoconsc:mk(binary(), #{example => "TEXT-LOG-ITEMS"})}, {meta, fields(bytes) ++ fields(position)} - ] + ], + 400 => emqx_dashboard_swagger:error_codes( + ['READ_FILE_ERROR', 'RPC_ERROR', 'NODE_ERROR'], <<"Trace Log Failed">> + ) } } }. From 1ba66fc722260314daeb99cad3fa3cb22127ecf5 Mon Sep 17 00:00:00 2001 From: Stefan Strigler Date: Fri, 2 Dec 2022 14:04:26 +0100 Subject: [PATCH 3/5] docs: /trace returns list not single trace --- apps/emqx_management/src/emqx_mgmt_api_trace.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/emqx_management/src/emqx_mgmt_api_trace.erl b/apps/emqx_management/src/emqx_mgmt_api_trace.erl index 52a8c1040..93d647753 100644 --- a/apps/emqx_management/src/emqx_mgmt_api_trace.erl +++ b/apps/emqx_management/src/emqx_mgmt_api_trace.erl @@ -72,7 +72,7 @@ schema("/trace") -> description => "List all trace", tags => ?TAGS, responses => #{ - 200 => hoconsc:ref(trace) + 200 => hoconsc:array(hoconsc:ref(trace)) } }, post => #{ From 3e842e4a6b0b2f60adb6569a9ee4f295ab03bb67 Mon Sep 17 00:00:00 2001 From: Stefan Strigler Date: Fri, 2 Dec 2022 13:42:57 +0100 Subject: [PATCH 4/5] style: fix changelog --- changes/v5.0.12-en.md | 2 +- changes/v5.0.12-zh.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/changes/v5.0.12-en.md b/changes/v5.0.12-en.md index 0a52f6f08..731719c7d 100644 --- a/changes/v5.0.12-en.md +++ b/changes/v5.0.12-en.md @@ -20,4 +20,4 @@ - Fix that the obsolete SSL files aren't deleted after the ExHook config update [#9432](https://github.com/emqx/emqx/pull/9432). -- Fix schema for `GET /trace/:name/log` [#9468](https://github.com/emqx/emqx/pull/9468). +- Fix doc and schema for `/trace` API [#9468](https://github.com/emqx/emqx/pull/9468). diff --git a/changes/v5.0.12-zh.md b/changes/v5.0.12-zh.md index 8c58cdec2..4a7ad20b5 100644 --- a/changes/v5.0.12-zh.md +++ b/changes/v5.0.12-zh.md @@ -19,4 +19,4 @@ - 修复 ExHook 更新 SSL 相关配置后,过时的 SSL 文件没有被删除的问题 [#9432](https://github.com/emqx/emqx/pull/9432)。 -- [FIXME] Fix schema for `GET /trace/:name/log` [#9468](https://github.com/emqx/emqx/pull/9468). +- [FIXME] Fix doc and schema for `/trace` API [#9468](https://github.com/emqx/emqx/pull/9468). From 5820bae7be2eed8c1cb94b58895989eaf02959d9 Mon Sep 17 00:00:00 2001 From: Stefan Strigler Date: Mon, 5 Dec 2022 10:37:15 +0100 Subject: [PATCH 5/5] chore: add zn translation --- changes/v5.0.12-zh.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes/v5.0.12-zh.md b/changes/v5.0.12-zh.md index 4a7ad20b5..e7cbd124c 100644 --- a/changes/v5.0.12-zh.md +++ b/changes/v5.0.12-zh.md @@ -19,4 +19,4 @@ - 修复 ExHook 更新 SSL 相关配置后,过时的 SSL 文件没有被删除的问题 [#9432](https://github.com/emqx/emqx/pull/9432)。 -- [FIXME] Fix doc and schema for `/trace` API [#9468](https://github.com/emqx/emqx/pull/9468). +- 修复 /trace API 的返回值格式和相关文档 [#9468](https://github.com/emqx/emqx/pull/9468)。