bugfix: 当hostname(也即endpoint)存在点号时解析错误 #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
正如 wolfhong#1 中反馈的问题。
当指标的endpoint存在点号
.
时,也即hostname存在点号.
时,会导致无法显示指标图表。比如,当 hostname = cnsz01vl00002.cmrh.com ,想要查询 mem.memfree.percent 时
发送请求到
/api/datasources/proxy/6/render
时,target =cnsz01vl00002.cmrh.com#mem#memfree#percent
被错误解析成cnsz01vl00002#cmrh#com#mem#memfree#percent
导致无法请求到数据。根据wiki,合法的hostname能包含alphabet (A-Za-z), digits (0-9), minus sign (-), and period (.)
因此,该项目在这方面考虑欠佳。(原项目有一个hack,当hostname是IP地址时,
.
号不会被转为#
,但只并没有根本上解决bug。)该问题已经解决。hostname合法时都没有问题。
根据wiki,合法的hostname只能包含alphabet (A-Za-z), digits (0-9), minus sign (
-
), and period (.
)解决的截图如下:
可以带入变量。如下图,endpoint 写成
$host
,就可以配合Granfana的变量进行操作。