-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add support for 'Attribute' option on KAIROSDB output format #2199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Could you keep the same commit messages as your previous PR? That explains better what this patch does. |
src/utils_format_kairosdb.c
Outdated
int store_rates) { | ||
int store_rates, | ||
char const *const *http_attrs, | ||
const int http_attrs_num) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed this before, but that probably got lost. const int
makes no sense in function parameters, please make this just an int. Also mentioned before, you declare this in write_http.c as a size_t, so pick one or the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, im switching it back to size_t then, strarray_add() take this type as second parameter
src/utils_format_kairosdb.h
Outdated
@@ -35,11 +35,14 @@ | |||
#define JSON_GAUGE_FORMAT GAUGE_FORMAT | |||
#endif | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this unnecessary change please.
cb->store_rates); | ||
status = format_kairosdb_value_list( | ||
cb->send_buffer, &cb->send_buffer_fill, &cb->send_buffer_free, ds, vl, | ||
cb->store_rates, (char const *const *)http_attrs, http_attrs_num); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary cast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't compile without the casting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it should, what's the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/write_http.c: In function ‘wh_write_kairosdb’:
src/write_http.c:477:24: error: passing argument 7 of ‘format_kairosdb_value_list’ from incompatible pointer type [-Werror=incompatible-pointer-types]
cb->store_rates, http_attrs, http_attrs_num);
^~~~~~~~~~
In file included from src/write_http.c:31:0:
src/utils_format_kairosdb.h:40:5: note: expected ‘const char * const*’ but argument is of type ‘char **’
int format_kairosdb_value_list(char *buffer, size_t *ret_buffer_fill,
^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you declare static char **http_attrs in write_http.c, so there's the mismatch. that should probably be static const char **http_attrs;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I change to static const char **http_attrs
it triggers errors on strarray_add() which take a char *** as first parameter :
src/write_http.c: In function ‘wh_config_node’:
src/write_http.c:731:20: error: passing argument 1 of ‘strarray_add’ from incompatible pointer type [-Werror=incompatible-pointer-types]
strarray_add(&http_attrs, &http_attrs_num, key);
^
In file included from src/write_http.c:28:0:
./src/daemon/common.h:380:5: note: expected ‘char ***’ but argument is of type ‘const char ***’
int strarray_add(char ***ret_array, size_t *ret_array_len, char const *str);
^~~~~~~~~~~~
src/write_http.c:732:20: error: passing argument 1 of ‘strarray_add’ from incompatible pointer type [-Werror=incompatible-pointer-types]
strarray_add(&http_attrs, &http_attrs_num, val);
^
In file included from src/write_http.c:28:0:
./src/daemon/common.h:380:5: note: expected ‘char ***’ but argument is of type ‘const char ***’
int strarray_add(char ***ret_array, size_t *ret_array_len, char const *str);
^~~~~~~~~~~~
cc1: all warnings being treated as errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strarray_add should probably be changed then. I'll make a note do this, please ignore my comment for now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright, cool :) so what's next?
cb->store_rates); | ||
status = format_kairosdb_value_list( | ||
cb->send_buffer, &cb->send_buffer_fill, &cb->send_buffer_free, ds, vl, | ||
cb->store_rates, (char const *const *)http_attrs, http_attrs_num); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
src/write_http.c
Outdated
char *val = NULL; | ||
|
||
if (child->values_num != 2) { | ||
WARNING("write_http plugins: Attribute need both a key and a value."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plugin, not plugins
src/write_http.c
Outdated
} | ||
if (child->values[0].type != OCONFIG_TYPE_STRING || | ||
child->values[1].type != OCONFIG_TYPE_STRING) { | ||
WARNING("write_http plugins: Attribute needs string arguments."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
src/write_http.c
Outdated
} | ||
strarray_add(&http_attrs, &http_attrs_num, key); | ||
strarray_add(&http_attrs, &http_attrs_num, val); | ||
DEBUG("write_http plugins: got attribute: %s => %s", key, val); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plugin, not plugins.
Need that feature 👍 |
Support attributes on write_http module specificly on kairosdb format.