diff --git a/plugins/kafka_plugin/kafka.cpp b/plugins/kafka_plugin/kafka.cpp index 7eee52b8386..86abbb6d62c 100644 --- a/plugins/kafka_plugin/kafka.cpp +++ b/plugins/kafka_plugin/kafka.cpp @@ -148,6 +148,7 @@ void kafka::push_action(const chain::action_trace& action_trace, uint64_t parent a->code_seq = action_trace.receipt.code_sequence; a->abi_seq = action_trace.receipt.abi_sequence; a->block_num = action_trace.block_num; + a->block_time = action_trace.block_time; a->tx_id = checksum_bytes(action_trace.trx_id); if (not action_trace.console.empty()) a->console = action_trace.console; diff --git a/plugins/kafka_plugin/readme.md b/plugins/kafka_plugin/readme.md new file mode 100644 index 00000000000..ecde9474053 --- /dev/null +++ b/plugins/kafka_plugin/readme.md @@ -0,0 +1,31 @@ +# Kafka Plugin 说明 + +### 一、Topic + +默认开启以下4个topic + + 1. blocks // 其中block字段是由完整区块数据持久化的json结构,是一份全量数据。 + 2. transaction + 3. transaction_trace + 4. action + + transaction、transaction_trace、action为nodeos中数据解析所得,提取了主要的可能使用的字段(相当于推荐配置),业务使用者可根据需要适当增减字段。 另,也可以删除这三个topic,仅依赖blocks中的全量数据。 + + 详见:`plugins/kafka_plugin/types.hpp ` + + +### 二、常见问题 + +#### bos在Mac上编译常见报错 +``` +Could not find a package configuration file provided by "RdKafka" with any of the following names: + RdKafkaConfig.cmake + rdkafka-config.cmake +``` + +原因:系统安装的kafka版本太低 + +解决方法: + + 删除`/usr/local/include/cppkafka` , `/usr/local/include/librdkafka`两个目录 + 重新开始bos编译(会自动下载安装适配的kafka版本) \ No newline at end of file diff --git a/plugins/kafka_plugin/types.hpp b/plugins/kafka_plugin/types.hpp index a419f4b8c2b..65f4091fb1f 100644 --- a/plugins/kafka_plugin/types.hpp +++ b/plugins/kafka_plugin/types.hpp @@ -73,6 +73,7 @@ struct Action { unsigned abi_seq; uint32_t block_num; + block_timestamp_type block_time; bytes tx_id; // the transaction that generated this action string console; @@ -90,4 +91,4 @@ FC_REFLECT_ENUM(kafka::TransactionStatus, (executed)(soft_fail)(hard_fail)(delay FC_REFLECT(kafka::Block, (id)(num)(timestamp)(lib)(block)(tx_count)(action_count)(context_free_action_count)) FC_REFLECT(kafka::Transaction, (id)(block_id)(block_num)(block_time)(block_seq)(action_count)(context_free_action_count)) FC_REFLECT(kafka::TransactionTrace, (id)(block_num)(scheduled)(status)(net_usage_words)(cpu_usage_us)(exception)) -FC_REFLECT(kafka::Action, (global_seq)(recv_seq)(parent_seq)(account)(name)(auth)(data)(receiver)(auth_seq)(code_seq)(abi_seq)(block_num)(tx_id)(console)) +FC_REFLECT(kafka::Action, (global_seq)(recv_seq)(parent_seq)(account)(name)(auth)(data)(receiver)(auth_seq)(code_seq)(abi_seq)(block_num)(block_time)(tx_id)(console))