feat: add brokers field to support set broker with the same host in kafka-logger plugin#7999
Conversation
f3a2f76 to
48d9379
Compare
|
|
||
|
|
||
| return _M | ||
|
|
| | 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 | |
There was a problem hiding this comment.
| | brokers.host | string | True | | | The host of Kafka broker | | |
| | brokers.host | string | True | | | The host of Kafka broker, e.g., `192.168.1.1`. | |
| | 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). | |
There was a problem hiding this comment.
It would be better to put the "deprecated" in the Description instead of the Type?
There was a problem hiding this 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.
| | 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`. | |
There was a problem hiding this comment.
Do we need to update the Chinese version?
CC @SylviaBABY
There was a problem hiding this 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
There was a problem hiding this comment.
Let me update the Chinese version.
|
|
||
| -- 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 |
There was a problem hiding this 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.
There was a problem hiding this comment.
Thanks for the remind. Improved.
…afka-logger plugin (apache#7999) Co-authored-by: Sylvia <[email protected]>
Description
Fix #7998
Because the key in the JSON object should be different.
And the original design we use map to store the broker list, so we can't create a broker with the same host.
Now, I add a new filed
brokers(It's an array type), then we can create brokers with the same host.Checklist