projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
src/Makefile: Don't unnecessarily set plugin specific CXXFLAGS.
[collectd.git]
/
src
/
write_kafka.c
diff --git
a/src/write_kafka.c
b/src/write_kafka.c
index
a5371d4
..
10ae5a5
100644
(file)
--- a/
src/write_kafka.c
+++ b/
src/write_kafka.c
@@
-114,7
+114,7
@@
static int kafka_handle(struct kafka_topic_context *ctx) /* {{{ */
INFO ("write_kafka plugin: created KAFKA handle : %s", rd_kafka_name(ctx->kafka));
INFO ("write_kafka plugin: created KAFKA handle : %s", rd_kafka_name(ctx->kafka));
-#if
def HAVE_LIBRDKAFKA_LOGGER
+#if
defined(HAVE_LIBRDKAFKA_LOGGER) && !defined(HAVE_LIBRDKAFKA_LOG_CB)
rd_kafka_set_logger(ctx->kafka, kafka_log);
#endif
}
rd_kafka_set_logger(ctx->kafka, kafka_log);
#endif
}
@@
-202,6
+202,8
@@
static int kafka_write(const data_set_t *ds, /* {{{ */
key = ctx->key;
if (key != NULL)
keylen = strlen (key);
key = ctx->key;
if (key != NULL)
keylen = strlen (key);
+ else
+ keylen = 0;
rd_kafka_produce(ctx->topic, RD_KAFKA_PARTITION_UA,
RD_KAFKA_MSG_F_COPY, buffer, blen,
rd_kafka_produce(ctx->topic, RD_KAFKA_PARTITION_UA,
RD_KAFKA_MSG_F_COPY, buffer, blen,
@@
-252,6
+254,7
@@
static void kafka_config_topic(rd_kafka_conf_t *conf, oconfig_item_t *ci) /* {{{
tctx->escape_char = '.';
tctx->store_rates = 1;
tctx->format = KAFKA_FORMAT_JSON;
tctx->escape_char = '.';
tctx->store_rates = 1;
tctx->format = KAFKA_FORMAT_JSON;
+ tctx->key = NULL;
if ((tctx->kafka_conf = rd_kafka_conf_dup(conf)) == NULL) {
sfree(tctx);
if ((tctx->kafka_conf = rd_kafka_conf_dup(conf)) == NULL) {
sfree(tctx);
@@
-315,6
+318,7
@@
static void kafka_config_topic(rd_kafka_conf_t *conf, oconfig_item_t *ci) /* {{{
} else if (strcasecmp ("Key", child->key) == 0) {
cf_util_get_string (child, &tctx->key);
} else if (strcasecmp ("Key", child->key) == 0) {
cf_util_get_string (child, &tctx->key);
+ assert (tctx->key != NULL);
} else if (strcasecmp ("Format", child->key) == 0) {
status = cf_util_get_string(child, &key);
if (status != 0)
} else if (strcasecmp ("Format", child->key) == 0) {
status = cf_util_get_string(child, &key);
if (status != 0)
@@
-469,4
+473,3
@@
void module_register(void)
{
plugin_register_complex_config ("write_kafka", kafka_config);
}
{
plugin_register_complex_config ("write_kafka", kafka_config);
}
-