You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/09/27 10:18:14 UTC

[GitHub] [apisix] starsz opened a new pull request, #7999: feat: support set broker array in kafka-logger plugin

starsz opened a new pull request, #7999:
URL: https://github.com/apache/apisix/pull/7999

   ### Description
   
   <!-- Please include a summary of the change and which issue is fixed. -->
   <!-- Please also include relevant motivation and context. -->
   
   Fixes # (issue)
   
   ### Checklist
   
   - [ ] I have explained the need for this PR and the problem it solves
   - [ ] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] spacewander merged pull request #7999: feat: add brokers field to support set broker with the same host in kafka-logger plugin

Posted by GitBox <gi...@apache.org>.
spacewander merged PR #7999:
URL: https://github.com/apache/apisix/pull/7999


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] starsz commented on a diff in pull request #7999: feat: add brokers field to support set broker with the same host in kafka-logger plugin

Posted by GitBox <gi...@apache.org>.
starsz commented on code in PR #7999:
URL: https://github.com/apache/apisix/pull/7999#discussion_r984150776


##########
apisix/plugins/kafka-logger.lua:
##########
@@ -251,3 +284,4 @@ end
 
 
 return _M
+

Review Comment:
   Fixed.



##########
apisix/plugins/kafka-logger.lua:
##########
@@ -51,6 +52,26 @@ local schema = {
                 },
             },
         },
+        brokers = {

Review Comment:
   Fixed.



##########
docs/en/latest/plugins/kafka-logger.md:
##########
@@ -37,7 +37,10 @@ It might take some time to receive the log data. It will be automatically sent a
 
 | Name                   | Type    | Required | Default        | Valid values          | Description                                                                                                                                                                                                                                                                                                                                      |
 | ---------------------- | ------- | -------- | -------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| broker_list            | object  | True     |                |                       | List of Kafka brokers (nodes).                                                                                                                                                                                                                                                                                                                   |
+| broker_list            | deprecated  | True |                |                       | Use `brokers` instead. List of Kafka brokers.  (nodes).                                                                                                                                                                                                                                                                                                                   |
+| brokers                | array   | True     |                |                       | List of Kafka brokers (nodes).                                                                                                                                                                                                                                                                                                                   |
+| brokers.host           | string  | True     |                |                       | The host of Kafka broker                                                                                                                                                                                                                                                                                                                   |

Review Comment:
   Fixed.



##########
t/plugin/kafka-logger2.t:
##########
@@ -340,6 +340,50 @@ qr/not found topic, retryable: true, topic: undefined_topic, partition_id: -1/
                         key= "key1",
                     },
                 },
+                {
+                    input = {
+                        brokers = {
+                        },
+                        kafka_topic = "test",

Review Comment:
   Fixed.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] starsz commented on a diff in pull request #7999: feat: add brokers field to support set broker with the same host in kafka-logger plugin

Posted by GitBox <gi...@apache.org>.
starsz commented on code in PR #7999:
URL: https://github.com/apache/apisix/pull/7999#discussion_r984263934


##########
docs/en/latest/plugins/kafka-logger.md:
##########
@@ -37,7 +37,10 @@ It might take some time to receive the log data. It will be automatically sent a
 
 | Name                   | Type    | Required | Default        | Valid values          | Description                                                                                                                                                                                                                                                                                                                                      |
 | ---------------------- | ------- | -------- | -------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| broker_list            | object  | True     |                |                       | List of Kafka brokers (nodes).                                                                                                                                                                                                                                                                                                                   |
+| broker_list            | deprecated  | True |                |                       | Use `brokers` instead. List of Kafka brokers.  (nodes).                                                                                                                                                                                                                                                                                                                   |
+| brokers                | array   | True     |                |                       | List of Kafka brokers (nodes).                                                                                                                                                                                                                                                                                                                   |
+| brokers.host           | string  | True     |                |                       | The host of Kafka broker, e.g, `192.168.1.1`.                                                                                                                                                                                                                                                                                                                   |

Review Comment:
   Let me update the Chinese version.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] starsz commented on a diff in pull request #7999: feat: add brokers field to support set broker with the same host in kafka-logger plugin

Posted by GitBox <gi...@apache.org>.
starsz commented on code in PR #7999:
URL: https://github.com/apache/apisix/pull/7999#discussion_r984263787


##########
docs/en/latest/plugins/kafka-logger.md:
##########
@@ -37,7 +37,10 @@ It might take some time to receive the log data. It will be automatically sent a
 
 | Name                   | Type    | Required | Default        | Valid values          | Description                                                                                                                                                                                                                                                                                                                                      |
 | ---------------------- | ------- | -------- | -------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| broker_list            | object  | True     |                |                       | List of Kafka brokers (nodes).                                                                                                                                                                                                                                                                                                                   |
+| broker_list            | deprecated  | True |                |                       | Use `brokers` instead. List of Kafka brokers.  (nodes).                                                                                                                                                                                                                                                                                                                   |

Review Comment:
   Oh. I refer to the docs of https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/clickhouse-logger.md#attributes.
   
   Let me fix it.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7999: feat: add brokers field to support set broker with the same host in kafka-logger plugin

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7999:
URL: https://github.com/apache/apisix/pull/7999#discussion_r984241996


##########
docs/en/latest/plugins/kafka-logger.md:
##########
@@ -37,7 +37,10 @@ It might take some time to receive the log data. It will be automatically sent a
 
 | Name                   | Type    | Required | Default        | Valid values          | Description                                                                                                                                                                                                                                                                                                                                      |
 | ---------------------- | ------- | -------- | -------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| broker_list            | object  | True     |                |                       | List of Kafka brokers (nodes).                                                                                                                                                                                                                                                                                                                   |
+| broker_list            | deprecated  | True |                |                       | Use `brokers` instead. List of Kafka brokers.  (nodes).                                                                                                                                                                                                                                                                                                                   |
+| brokers                | array   | True     |                |                       | List of Kafka brokers (nodes).                                                                                                                                                                                                                                                                                                                   |
+| brokers.host           | string  | True     |                |                       | The host of Kafka broker, e.g, `192.168.1.1`.                                                                                                                                                                                                                                                                                                                   |

Review Comment:
   > Do we need to update the Chinese version? CC @SylviaBABY
   
   I think we need to update the CN version. But you can merge this first. I'll update the CN version depending on this part later
   



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7999: feat: add brokers field to support set broker with the same host in kafka-logger plugin

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7999:
URL: https://github.com/apache/apisix/pull/7999#discussion_r984289918


##########
docs/zh/latest/plugins/kafka-logger.md:
##########
@@ -35,7 +35,10 @@ description: API 网关 Apache APISIX 的 kafka-logger 插件用于将日志作
 
 | 名称                   | 类型    | 必选项 | 默认值          | 有效值                | 描述                                             |
 | ---------------------- | ------- | ------ | -------------- | --------------------- | ------------------------------------------------ |
-| broker_list            | object  | 是     |                |                       | 需要推送的 Kafka 的 broker 列表。                  |
+| broker_list            | object  | 是     |                |                       | 已废弃,使用 brokers 代替。需要推送的 Kafka 的 broker 列表。                  |

Review Comment:
   ```suggestion
   | broker_list            | object  | 是     |                |                       | 已废弃,现使用 `brokers` 属性代替。原指需要推送的 Kafka 的 broker 列表。                  |
   ```



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] tokers commented on a diff in pull request #7999: feat: add brokers field to support set broker with the same host in kafka-logger plugin

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7999:
URL: https://github.com/apache/apisix/pull/7999#discussion_r983313758


##########
apisix/plugins/kafka-logger.lua:
##########
@@ -51,6 +52,26 @@ local schema = {
                 },
             },
         },
+        brokers = {

Review Comment:
   Please mark the `broker_list` in the schema as deprecated.



##########
docs/en/latest/plugins/kafka-logger.md:
##########
@@ -37,7 +37,10 @@ It might take some time to receive the log data. It will be automatically sent a
 
 | Name                   | Type    | Required | Default        | Valid values          | Description                                                                                                                                                                                                                                                                                                                                      |
 | ---------------------- | ------- | -------- | -------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| broker_list            | object  | True     |                |                       | List of Kafka brokers (nodes).                                                                                                                                                                                                                                                                                                                   |
+| broker_list            | deprecated  | True |                |                       | Use `brokers` instead. List of Kafka brokers.  (nodes).                                                                                                                                                                                                                                                                                                                   |
+| brokers                | array   | True     |                |                       | List of Kafka brokers (nodes).                                                                                                                                                                                                                                                                                                                   |
+| brokers.host           | string  | True     |                |                       | The host of Kafka broker                                                                                                                                                                                                                                                                                                                   |

Review Comment:
   ```suggestion
   | brokers.host           | string  | True     |                |                       | The host of Kafka broker, e.g., `192.168.1.1`.                                                                                                                                                                                                                                                                                                                 |
   ```



##########
t/plugin/kafka-logger2.t:
##########
@@ -340,6 +340,50 @@ qr/not found topic, retryable: true, topic: undefined_topic, partition_id: -1/
                         key= "key1",
                     },
                 },
+                {
+                    input = {
+                        brokers = {
+                        },
+                        kafka_topic = "test",

Review Comment:
   Add another test case that the `host` or the `port` field is missing.



##########
apisix/plugins/kafka-logger.lua:
##########
@@ -251,3 +284,4 @@ end
 
 
 return _M
+

Review Comment:
   Remove the empty line.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] starsz commented on a diff in pull request #7999: feat: add brokers field to support set broker with the same host in kafka-logger plugin

Posted by GitBox <gi...@apache.org>.
starsz commented on code in PR #7999:
URL: https://github.com/apache/apisix/pull/7999#discussion_r984264271


##########
apisix/plugins/kafka-logger.lua:
##########
@@ -199,15 +225,24 @@ function _M.log(conf, ctx)
     end
 
     -- reuse producer via lrucache to avoid unbalanced partitions of messages in kafka
-    local broker_list = core.table.new(core.table.nkeys(conf.broker_list), 0)
+    local length = conf.broker_list and core.table.nkeys(conf.broker_list) or #conf.brokers

Review Comment:
   Let me update it.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] spacewander commented on a diff in pull request #7999: feat: add brokers field to support set broker with the same host in kafka-logger plugin

Posted by GitBox <gi...@apache.org>.
spacewander commented on code in PR #7999:
URL: https://github.com/apache/apisix/pull/7999#discussion_r984229209


##########
docs/en/latest/plugins/kafka-logger.md:
##########
@@ -37,7 +37,10 @@ It might take some time to receive the log data. It will be automatically sent a
 
 | Name                   | Type    | Required | Default        | Valid values          | Description                                                                                                                                                                                                                                                                                                                                      |
 | ---------------------- | ------- | -------- | -------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| broker_list            | object  | True     |                |                       | List of Kafka brokers (nodes).                                                                                                                                                                                                                                                                                                                   |
+| broker_list            | deprecated  | True |                |                       | Use `brokers` instead. List of Kafka brokers.  (nodes).                                                                                                                                                                                                                                                                                                                   |
+| brokers                | array   | True     |                |                       | List of Kafka brokers (nodes).                                                                                                                                                                                                                                                                                                                   |
+| brokers.host           | string  | True     |                |                       | The host of Kafka broker, e.g, `192.168.1.1`.                                                                                                                                                                                                                                                                                                                   |

Review Comment:
   Do we need to update the Chinese version?
   CC @SylviaBABY 



##########
apisix/plugins/kafka-logger.lua:
##########
@@ -199,15 +225,24 @@ function _M.log(conf, ctx)
     end
 
     -- reuse producer via lrucache to avoid unbalanced partitions of messages in kafka
-    local broker_list = core.table.new(core.table.nkeys(conf.broker_list), 0)
+    local length = conf.broker_list and core.table.nkeys(conf.broker_list) or #conf.brokers

Review Comment:
   Just FYI: if we don't need to rewrite the content of table, we can use core.table.clone instead of `alloc + insert in loop`.



##########
docs/en/latest/plugins/kafka-logger.md:
##########
@@ -37,7 +37,10 @@ It might take some time to receive the log data. It will be automatically sent a
 
 | Name                   | Type    | Required | Default        | Valid values          | Description                                                                                                                                                                                                                                                                                                                                      |
 | ---------------------- | ------- | -------- | -------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| broker_list            | object  | True     |                |                       | List of Kafka brokers (nodes).                                                                                                                                                                                                                                                                                                                   |
+| broker_list            | deprecated  | True |                |                       | Use `brokers` instead. List of Kafka brokers.  (nodes).                                                                                                                                                                                                                                                                                                                   |

Review Comment:
   It would be better to put the "deprecated" in the Description instead of the Type?



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] starsz commented on a diff in pull request #7999: feat: add brokers field to support set broker with the same host in kafka-logger plugin

Posted by GitBox <gi...@apache.org>.
starsz commented on code in PR #7999:
URL: https://github.com/apache/apisix/pull/7999#discussion_r984287912


##########
apisix/plugins/kafka-logger.lua:
##########
@@ -199,15 +225,24 @@ function _M.log(conf, ctx)
     end
 
     -- reuse producer via lrucache to avoid unbalanced partitions of messages in kafka
-    local broker_list = core.table.new(core.table.nkeys(conf.broker_list), 0)
+    local length = conf.broker_list and core.table.nkeys(conf.broker_list) or #conf.brokers

Review Comment:
   Thanks for the remind. Improved.



##########
docs/en/latest/plugins/kafka-logger.md:
##########
@@ -37,7 +37,10 @@ It might take some time to receive the log data. It will be automatically sent a
 
 | Name                   | Type    | Required | Default        | Valid values          | Description                                                                                                                                                                                                                                                                                                                                      |
 | ---------------------- | ------- | -------- | -------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| broker_list            | object  | True     |                |                       | List of Kafka brokers (nodes).                                                                                                                                                                                                                                                                                                                   |
+| broker_list            | deprecated  | True |                |                       | Use `brokers` instead. List of Kafka brokers.  (nodes).                                                                                                                                                                                                                                                                                                                   |
+| brokers                | array   | True     |                |                       | List of Kafka brokers (nodes).                                                                                                                                                                                                                                                                                                                   |
+| brokers.host           | string  | True     |                |                       | The host of Kafka broker, e.g, `192.168.1.1`.                                                                                                                                                                                                                                                                                                                   |

Review Comment:
   Fixed.



##########
docs/en/latest/plugins/kafka-logger.md:
##########
@@ -37,7 +37,10 @@ It might take some time to receive the log data. It will be automatically sent a
 
 | Name                   | Type    | Required | Default        | Valid values          | Description                                                                                                                                                                                                                                                                                                                                      |
 | ---------------------- | ------- | -------- | -------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| broker_list            | object  | True     |                |                       | List of Kafka brokers (nodes).                                                                                                                                                                                                                                                                                                                   |
+| broker_list            | deprecated  | True |                |                       | Use `brokers` instead. List of Kafka brokers.  (nodes).                                                                                                                                                                                                                                                                                                                   |

Review Comment:
   Fixed.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

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