Skip to content
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

Add the ability to add tags to an elasticsearch instance #790

Merged
merged 2 commits into from
Feb 3, 2014

Conversation

clly
Copy link

@clly clly commented Jan 10, 2014

The tags key is taken from the instance and each entry appended to the
already existing tags variable. From my testing the single quotes are necessary

if config_url is None:
raise Exception("An url must be specified")

tags = ['url:%s' % config_url]
for tag in added_tags:
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't this give a null pointer exception if tags isn't specified?

@clly
Copy link
Author

clly commented Jan 10, 2014

You're correct, I had not thought of that when I originally made the change. I've made an update and retested and it won't fail with NoneType anymore

@remh
Copy link
Contributor

remh commented Jan 24, 2014

Thanks @clly !
Can you rebase your pull request ? I can't merge it for now as there are some conflicts.

@clly
Copy link
Author

clly commented Jan 27, 2014

@remh I did a rebase then a pull and merge. I looks like the conflicts fixed up correctly and it should cleanly merge with your upstream now. Just waiting on the Travis-ci build to finish.

@remh
Copy link
Contributor

remh commented Jan 28, 2014

Thanks @clly
It looks like the branch is in a bad state though (see the diff with all these commits, they shouldn't appear).

The thing you should do is:
checkout master, pull upstream master, checkout branch, rebase from master

Sorry about that.

Connor Kelly added 2 commits February 3, 2014 14:42
The tags key is taken from the instance and each entry appended to the
already existing tags variable
@clly
Copy link
Author

clly commented Feb 3, 2014

Took some finagling, but I fix the branch.

@remh
Copy link
Contributor

remh commented Feb 3, 2014

Thanks a lot!

remh added a commit that referenced this pull request Feb 3, 2014
Add the ability to add tags to an elasticsearch instance
@remh remh merged commit 64c0092 into DataDog:master Feb 3, 2014
@@ -148,6 +149,9 @@ def check(self, instance):

# Tag by URL so we can differentiate the metrics from multiple instances
tags = ['url:%s' % config_url]
if added_tags is not None:
for tag in added_tags:
tags.append(tag)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this will keep adding the tags over and over again for each loop and leak memory. Maybe we should pass a copy of instance into the check method to avoid this bug in all the checks

Copy link
Contributor

Choose a reason for hiding this comment

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

tags

is reset the line before, so it shouldn't happen.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the case you are thinking about would have been

added_tags.append('url:%s' % config_url')

at each iteration of the loop

Copy link
Contributor

Choose a reason for hiding this comment

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

oh yeah, true, didn't see that the tags variable was different, nm

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.

3 participants