tokers commented on a change in pull request #2926:
URL: https://github.com/apache/apisix/pull/2926#discussion_r537260167



##########
File path: doc/zh-cn/plugins/server-info.md
##########
@@ -0,0 +1,110 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+- [English](../../plugins/server-info.md)
+
+# Summary
+
+- [**插件简介**](#插件简介)
+- [插件属性](#插件属性)
+- [**插件接口**](#插件接口)
+- [启用插件](#启用插件)
+- [如何自定义服务信息上报间隔](#如何自定义服务信息上报间隔)
+- [测试插件](#测试插件)
+- [禁用插件](#禁用插件)
+
+## 插件简介
+
+`server-info` 是一款能够定期将服务基本信息上报至 etcd 的插件。
+
+服务信息中每一项的含义如下:
+
+| 名称    | 类型 | 描述 |
+|---------|------|-------------|
+| up_time | integer | APISIX 服务实例当前的运行时间, 如果对 APSIX
+进行热更新操作,该值将被重置;普通的 reload 操作不会影响该值。 |

Review comment:
       Added.

##########
File path: apisix/core/utils.lua
##########
@@ -203,6 +209,26 @@ function _M.validate_header_value(value)
 end
 
 
+function _M.gethostname()
+    if hostname then
+        return hostname
+    end
+
+    local buf = get_string_buf(max_hostname_len)
+
+    if C.gethostname(buf, max_hostname_len) == 0 then
+        buf[max_hostname_len - 1] = str_byte('\0')
+        hostname = ffi_string(buf, ffi.C.strlen(buf))
+
+    else
+        log.alert("ffi.C.gethostname() failed")

Review comment:
       Changed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to