Skip to content

Added MetaDataSet to target_set #1106

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 2 commits into from
Apr 6, 2016

Conversation

ymettier
Copy link
Contributor

@ymettier ymettier commented Jul 1, 2015

Hello,

This patch allows to set metadata with filters and target_set target.
It adds a new keyword MetaDataSet.
Example :

 <Target "set">
   MetaDataSet "key1" "value1"
   MetaDataSet "key2" "value2"
 </Target>

Note : this patch adds some functions to the daemon/meta_data.c in order to clone_and_merge meta data. I prefered to share my new functions instead of implementing them in target_set.c.

Regards,
Yves

This was referenced Jul 1, 2015
@nathanielc
Copy link

I have been looking for something like this in collectd for a while. Glad to see some work is being done. I would like to see this get merged. I'll patch this locally and see how it works for my needs and post back here.

@nathanielc
Copy link

See my comment here #1107 (comment) on my findings. Turns out I needed both PRs not just this one.

@ciomaire
Copy link
Contributor

@ymettier - this patch restores support for TypeInstance in ts_create()

diff --git a/src/target_set.c b/src/target_set.c
index 5e9d087..da2d307 100644
--- a/src/target_set.c
+++ b/src/target_set.c
@@ -177,6 +177,9 @@ static int ts_create (const oconfig_item_t *ci, void **user_data) /* {{{ */
       status = ts_config_add_string (&data->type, child,
           /* may be empty = */ 0);
 #endif
+    else if (strcasecmp ("TypeInstance", child->key) == 0)
+      status = ts_config_add_string (&data->type_instance, child,
+          /* may be empty = */ 1);
     else if (strcasecmp ("MetaDataSet", child->key) == 0)
       status = ts_config_add_meta (&data->meta, child,
           /* may be empty = */ 1);

@ymettier
Copy link
Contributor Author

ooops

Thanks @ciomaire . Fixed in commit a89fc92.
Also merged in PR #1107.

Regards,
Yves

@mfournier mfournier modified the milestone: Features Jan 21, 2016
@shanson7
Copy link

This is a very nice feature, fairly crucial for deployments to many machines with various identifying characteristics (ie.g. datacenter, rack, cluster, etc.). Without additional metadata, slicing and dicing metrics gets messy and difficult.

@yogeswaran
Copy link
Contributor

👍 this feature will be very useful for us. This PR is 6 months old, is there any reason for not being merged?

@ymettier
Copy link
Contributor Author

@yogeswaran : no reason as far as I know.
@octo or @mfournier : what do you think ?

if (orig == NULL)
return (0);

if(NULL == *dest) {
Copy link
Contributor

Choose a reason for hiding this comment

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

*dest = = NULL please, and space after if.

@rubenk rubenk merged commit a89fc92 into collectd:master Apr 6, 2016
@fenggolang
Copy link

@ymettier This URL:#1107
image
Where is not
<Rule "opentsdb_load">
<Match "regex">
Plugin "^load$"

<Target "set">
MetaDataSet "tsdb_tag_pluginInstance" "load"
MetaDataSet "tsdb_prefix" "sys."


<Rule "opentsdb_swap">
<Match "regex">
Plugin "^swap$"

<Target "set">
MetaDataSet "tsdb_tag_pluginInstance" "swap"
MetaDataSet "tsdb_prefix" "sys."

I have a doubt:The following few write where?

tsdb_prefix Will prefix the OpenTSDB (also prefix tsdb_id if defined)
tsdb_id Replace the metric with this tag
tsdb_tag_plugin
tsdb_tag_pluginInstance
tsdb_tag_type
tsdb_tag_typeInstance
tsdb_tag_dsname When defined, tsdb_tag_* removes the related item from metric id.
If it is not empty, it will be the key of an opentsdb tag (the value is the item itself)
If it is empty, no tag is defined.

@ymettier ymettier deleted the ym/target_set_add_meta branch February 8, 2017 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants