projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Currently curl_json will barely ignore boolean values in a non erroneous
[collectd.git]
/
src
/
write_kafka.c
diff --git
a/src/write_kafka.c
b/src/write_kafka.c
index
1712a47
..
3c57380
100644
(file)
--- a/
src/write_kafka.c
+++ b/
src/write_kafka.c
@@
-89,7
+89,7
@@
static uint32_t kafka_hash(const char *keydata, size_t keylen) {
#define KAFKA_RANDOM_KEY_BUFFER \
(char[KAFKA_RANDOM_KEY_SIZE]) { "" }
static char *kafka_random_key(char buffer[static KAFKA_RANDOM_KEY_SIZE]) {
#define KAFKA_RANDOM_KEY_BUFFER \
(char[KAFKA_RANDOM_KEY_SIZE]) { "" }
static char *kafka_random_key(char buffer[static KAFKA_RANDOM_KEY_SIZE]) {
- s
s
nprintf(buffer, KAFKA_RANDOM_KEY_SIZE, "%08" PRIX32, cdrand_u());
+ snprintf(buffer, KAFKA_RANDOM_KEY_SIZE, "%08" PRIX32, cdrand_u());
return buffer;
}
return buffer;
}
@@
-113,12
+113,12
@@
static int kafka_handle(struct kafka_topic_context *ctx) /* {{{ */
rd_kafka_topic_conf_t *topic_conf;
if (ctx->kafka != NULL && ctx->topic != NULL)
rd_kafka_topic_conf_t *topic_conf;
if (ctx->kafka != NULL && ctx->topic != NULL)
- return
(0)
;
+ return
0
;
if (ctx->kafka == NULL) {
if ((conf = rd_kafka_conf_dup(ctx->kafka_conf)) == NULL) {
ERROR("write_kafka plugin: cannot duplicate kafka config");
if (ctx->kafka == NULL) {
if ((conf = rd_kafka_conf_dup(ctx->kafka_conf)) == NULL) {
ERROR("write_kafka plugin: cannot duplicate kafka config");
- return
(1)
;
+ return
1
;
}
if ((ctx->kafka = rd_kafka_new(RD_KAFKA_PRODUCER, conf, errbuf,
}
if ((ctx->kafka = rd_kafka_new(RD_KAFKA_PRODUCER, conf, errbuf,
@@
-158,7
+158,7
@@
static int kafka_handle(struct kafka_topic_context *ctx) /* {{{ */
rd_kafka_topic_name(ctx->topic));
}
rd_kafka_topic_name(ctx->topic));
}
- return
(0)
;
+ return
0
;
} /* }}} int kafka_handle */
} /* }}} int kafka_handle */
@@
-186,9
+186,10
@@
static int kafka_write(const data_set_t *ds, /* {{{ */
switch (ctx->format) {
case KAFKA_FORMAT_COMMAND:
switch (ctx->format) {
case KAFKA_FORMAT_COMMAND:
- status = create_putval(buffer, sizeof(buffer), ds, vl);
+ status = c
md_c
reate_putval(buffer, sizeof(buffer), ds, vl);
if (status != 0) {
if (status != 0) {
- ERROR("write_kafka plugin: create_putval failed with status %i.", status);
+ ERROR("write_kafka plugin: cmd_create_putval failed with status %i.",
+ status);
return status;
}
blen = strlen(buffer);
return status;
}
blen = strlen(buffer);
@@
-370,6
+371,10
@@
static void kafka_config_topic(rd_kafka_conf_t *conf,
status = cf_util_get_flag(child, &tctx->graphite_flags,
GRAPHITE_ALWAYS_APPEND_DS);
status = cf_util_get_flag(child, &tctx->graphite_flags,
GRAPHITE_ALWAYS_APPEND_DS);
+ } else if (strcasecmp("GraphitePreserveSeparator", child->key) == 0) {
+ status = cf_util_get_flag(child, &tctx->graphite_flags,
+ GRAPHITE_PRESERVE_SEPARATOR);
+
} else if (strcasecmp("GraphitePrefix", child->key) == 0) {
status = cf_util_get_string(child, &tctx->prefix);
} else if (strcasecmp("GraphitePostfix", child->key) == 0) {
} else if (strcasecmp("GraphitePrefix", child->key) == 0) {
status = cf_util_get_string(child, &tctx->prefix);
} else if (strcasecmp("GraphitePostfix", child->key) == 0) {
@@
-393,12
+398,14
@@
static void kafka_config_topic(rd_kafka_conf_t *conf,
rd_kafka_topic_conf_set_partitioner_cb(tctx->conf, kafka_partition);
rd_kafka_topic_conf_set_opaque(tctx->conf, tctx);
rd_kafka_topic_conf_set_partitioner_cb(tctx->conf, kafka_partition);
rd_kafka_topic_conf_set_opaque(tctx->conf, tctx);
- ssnprintf(callback_name, sizeof(callback_name), "write_kafka/%s",
- tctx->topic_name);
-
- user_data_t ud = {.data = tctx, .free_func = kafka_topic_context_free};
+ snprintf(callback_name, sizeof(callback_name), "write_kafka/%s",
+ tctx->topic_name);
- status = plugin_register_write(callback_name, kafka_write, &ud);
+ status = plugin_register_write(
+ callback_name, kafka_write,
+ &(user_data_t){
+ .data = tctx, .free_func = kafka_topic_context_free,
+ });
if (status != 0) {
WARNING("write_kafka plugin: plugin_register_write (\"%s\") "
"failed with status %i.",
if (status != 0) {
WARNING("write_kafka plugin: plugin_register_write (\"%s\") "
"failed with status %i.",
@@
-474,7
+481,7
@@
static int kafka_config(oconfig_item_t *ci) /* {{{ */
}
if (conf != NULL)
rd_kafka_conf_destroy(conf);
}
if (conf != NULL)
rd_kafka_conf_destroy(conf);
- return
(0)
;
+ return
0
;
errout:
if (conf != NULL)
rd_kafka_conf_destroy(conf);
errout:
if (conf != NULL)
rd_kafka_conf_destroy(conf);