Skip to content

Commit e8091f6

Browse files
author
Ayeshmantha Perera
authored
doc: alter logger plugins documentations. (#1541)
1 parent 0068f28 commit e8091f6

File tree

7 files changed

+99
-0
lines changed

7 files changed

+99
-0
lines changed

doc/batch-processor-cn.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<!--
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
-->
19+
20+
[English](batch-processor.md)
21+
22+
# 批处理机
23+
24+
批处理处理器可用于聚合条目(日志/任何数据)并进行批处理。
25+
当batch_max_size设置为零时,处理器将立即执行每个条目。将批处理的最大大小设置为大于1将开始聚合条目,直到达到最大大小或超时到期为止
26+
27+
## 构型
28+
29+
创建批处理程序的唯一必需参数是函数。当批处理达到最大大小或缓冲区持续时间超过时,将执行该功能。
30+
31+
|名称 |需求 |描述|
32+
|------- |----- |------|
33+
|id |可选的 |标识批处理者的唯一标识符|
34+
|batch_max_size |可选的 |每批的最大大小,默认为1000|
35+
|inactive_timeout|可选的 |如果不活动,将刷新缓冲区的最大时间(以秒为单位),默认值为5s|
36+
|buffer_duration|可选的 |必须先处理批次中最旧条目的最大期限(以秒为单位),默认是5|
37+
|max_retry_count|可选的 |从处理管道中移除之前的最大重试次数;默认为零|
38+
|retry_delay |可选的 |如果执行失败,应该延迟进程执行的秒数;默认为1|
39+
40+
以下代码显示了如何使用批处理程序的示例。批处理处理器将要执行的功能作为第一个参数,将批处理配置作为第二个参数。
41+
42+
```lua
43+
local bp = require("apisix.plugins.batch-processor")
44+
local func_to_execute = function(entries)
45+
-- serialize to json array core.json.encode(entries)
46+
-- process/send data
47+
return true
48+
end
49+
50+
local config = {
51+
max_retry_count = 2,
52+
buffer_duration = 60,
53+
inactive_timeout = 5,
54+
batch_max_size = 1,
55+
retry_delay = 0
56+
}
57+
58+
59+
local batch_processor, err = bp:new(func_to_execute, config)
60+
61+
if batch_processor then
62+
batch_processor:push({hello='world'})
63+
end
64+
```
65+
66+
67+
注意:请确保批处理的最大大小(条目数)在函数执行的范围内。
68+
刷新批处理的计时器基于“ inactive_timeout”配置运行。因此,为了获得最佳使用效果,
69+
保持“ inactive_timeout”小于“ buffer_duration”。

doc/plugins/kafka-logger-cn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131

3232
这将提供将Log数据请求作为JSON对象发送到外部Kafka集群的功能。
3333

34+
该插件提供了将Log Data作为批处理推送到外部Kafka主题的功能。如果您没有收到日志数据,请放心一些时间,它会在我们的批处理处理器中的计时器功能到期后自动发送日志。
35+
36+
有关Apache APISIX中Batch-Processor的更多信息,请参考。
37+
[Batch-Processor](../batch-processor-cn.md)
38+
3439
## 属性列表
3540

3641
|属性名称 |必选项 |描述|

doc/plugins/kafka-logger.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232

3333
This will provide the ability to send Log data requests as JSON objects to external Kafka clusters.
3434

35+
This plugin provides the ability to push Log data as a batch to you're external Kafka topics. In case if you did not recieve the log data don't worry give it some time it will automatically send the logs after the timer function expires in our Batch Processor.
36+
37+
For more info on Batch-Processor in Apache APISIX please refer.
38+
[Batch-Processor](../batch-processor.md)
39+
3540
## Attributes
3641

3742
|Name |Requirement |Description|

doc/plugins/tcp-logger-cn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131

3232
以实现将日志数据以JSON格式发送到监控工具或其它TCP服务的能力。
3333

34+
该插件提供了将Log Data作为批处理推送到外部TCP服务器的功能。如果您没有收到日志数据,请放心一些时间,它会在我们的批处理处理器中的计时器功能到期后自动发送日志。
35+
36+
有关Apache APISIX中Batch-Processor的更多信息,请参考。
37+
[Batch-Processor](../batch-processor-cn.md)
38+
3439
## 属性列表
3540

3641
|属性名称 |必选项 |描述|

doc/plugins/tcp-logger.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131

3232
This will provide the ability to send Log data requests as JSON objects to Monitoring tools and other TCP servers.
3333

34+
This plugin provides the ability to push Log data as a batch to you're external TCP servers. In case if you did not recieve the log data don't worry give it some time it will automatically send the logs after the timer function expires in our Batch Processor.
35+
36+
For more info on Batch-Processor in Apache APISIX please refer.
37+
[Batch-Processor](../batch-processor.md)
38+
3439
## Attributes
3540

3641
|Name |Requirement |Description|

doc/plugins/udp-logger-cn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131

3232
以实现将日志数据以JSON格式发送到监控工具或其它UDP服务的能力。
3333

34+
此插件提供了将批处理数据批量推送到外部UDP服务器的功能。如果您没有收到日志数据,请放心一些时间,它会在我们的批处理处理器中的计时器功能到期后自动发送日志
35+
36+
有关Apache APISIX中Batch-Processor的更多信息,请参考。
37+
[Batch-Processor](../batch-processor.md)
38+
3439
## 属性列表
3540

3641
|属性名称 |必选项 |描述|

doc/plugins/udp-logger.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131

3232
This will provide the ability to send Log data requests as JSON objects to Monitoring tools and other UDP servers.
3333

34+
This plugin provides the ability to push Log data as a batch to you're external UDP servers. In case if you did not recieve the log data don't worry give it some time it will automatically send the logs after the timer function expires in our Batch Processor.
35+
36+
For more info on Batch-Processor in Apache APISIX please refer.
37+
[Batch-Processor](../batch-processor.md)
38+
3439
## Attributes
3540

3641
|Name |Requirement |Description|

0 commit comments

Comments
 (0)