8000 Add support for 'Attribute' option on KAIROSDB output format by jaroug · Pull Request #2199 · collectd/collectd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 7 commits into from
Mar 26, 2017

Conversation

jaroug
Copy link
Contributor
@jaroug jaroug commented Mar 1, 2017

Support attributes on write_http module specificly on kairosdb format.

@rubenk
Copy link
Contributor
rubenk commented Mar 1, 2017

Could you keep the same commit messages as your previous PR? That explains better what this patch does.

int store_rates) {
int store_rates,
char const *const *http_attrs,
const int http_attrs_num) {
Copy link
Contributor

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.

Copy link
Contributor Author

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

@@ -35,11 +35,14 @@
#define JSON_GAUGE_FORMAT GAUGE_FORMAT
#endif


Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary cast

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor Author
@jaroug jaroug Mar 1, 2017

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

Copy link
Contributor

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;

Copy link
Contributor Author
@jaroug jaroug Mar 1, 2017

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

Copy link
Contributor

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 :)

Copy link
Contributor Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@jaroug jaroug changed the title Support attributes kairosdb Add support for 'Attribute' option on KAIROSDB output format Mar 1, 2017
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.");
Copy link
Contributor

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.");
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plugin, not plugins.

@dekonnection
Copy link

Need that feature 👍

@rubenk rubenk merged commit d3e97e2 into collectd:master Mar 26, 2017
@octo octo added this to the 5.8 milestone Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0