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

Please allow for a blacklist/whitelist when it comes to the chef tags that DataDog sends with it's data. #85

Closed
ABrehm264 opened this issue Aug 3, 2016 · 9 comments
Milestone

Comments

@ABrehm264
Copy link
Contributor

ABrehm264 commented Aug 3, 2016

I have several tags that are super useful for me to have in chef, but not so useful when it's sent to DataDog to be read by my developers, since they end up turning into noise. Would it be possible to blacklist/whitelist the tags the chef sends using a regex or something?

Example:
My server has these tags:

  • ENV_PRODUCTION
  • APP_APPLICATION1
  • APP_APPLICATION2
  • APP_APPLICATION3

When events or event log entries are sent, every one is tagged with every single chef tag associated with the box.

  • DD Event tags: [ENV_PRODUCTION, APP_APPLICATION1, APP_APPLICATION2, APP_APPLICATION3]
  • Data: There was a problem in Application1, please fix it.

I would like to make it so that it either sends no chef tags or it only sends the ENV_ tag.

@ABrehm264
Copy link
Contributor Author

ABrehm264 commented Aug 3, 2016

I think this could be a way to fix it, but I'm not sure. (note this is ruby and c# mixed together because I'm not all that fluent with ruby yet)

# Code File: chef-handler-datadog/lib/chef/handler/datadog_chef_tags.rb
# 
def initialize
  # ... other lines of init code
  Regex regexBlackList = new Regex(string_that_I_pass_in_from_somewhere, RegexOptions.CaseInsensitive)
end

def node_tags
  return [] unless @node.tags
  output = @node.tags.map { |tag| "#{@tag_prefix}#{tag}" }

  # No blacklist, return all results
  return output if regexBlackList == nil

  # The blacklist is set, so return the items which aren’t filtered by it.
  return output.Where(o => !regexBlackList.IsMatch(o))
end

@ABrehm264
Copy link
Contributor Author

ABrehm264 commented Aug 3, 2016

I'd need these questions answered though:

  1.   Would this fix the issue where I have EventViewer and Custom datadog events coming through with all my chef tags
    
  2.   Are you all cool with that approach?
    
  3.   If you’re cool with this approach, how would you like me to pass in the black list regex.
    

@TheJeremyGray
Copy link

👍

@TheJeremyGray
Copy link

This is the behavior that i see after an application sends a log to the datadog agent. Only 1 of the redacted app_ keys is relevant. The end result is, when I try to search for app_myapp, I see all the errors for all the applications on the server.

image

@catalintomescu
Copy link

This would definitely clean up the tags list.

@RAMunch
Copy link

RAMunch commented Aug 4, 2016

This would make the tags in DD so much more useful to me! Right now they are more hurtful than they are helpful.
👍

@olivielpeau
Copy link
Member

Thanks @ABrehm264 for your feedback!

  1. Would this fix the issue where I have EventViewer and Custom datadog events coming through with all my chef tags

Your approach would fix this indeed. The environment and role tags (env: and role:) wouldn't be affected by the filter/regex.

  1. Are you all cool with that approach?

Sounds reasonable yes!

  1. If you’re cool with this approach, how would you like me to pass in the black list regex.

You could pass the regex to the DatadogChefTags instance here, from the config object. The config is generally passed to the handler in the Chef recipe that sets up the handler, in our case that would be in chef-datadog: see https://github.com/DataDog/chef-datadog/blob/v2.4.0/recipes/dd-handler.rb#L41-L60.

And just to be extra clear: filtering the list of tags that's sent to Datadog would not only affect the event tags but also the host-level tags. This means that all the metrics and service checks coming from the host/Agent would also stop being tagged with these excluded tags.

Let me know if you have any questions or if you need help with the implementation, thanks!

ABrehm264 added a commit to ABrehm264/chef-handler-datadog that referenced this issue Aug 12, 2016
ABrehm264 added a commit to ABrehm264/chef-handler-datadog that referenced this issue Aug 15, 2016
ABrehm264 added a commit to ABrehm264/chef-handler-datadog that referenced this issue Aug 15, 2016
@ABrehm264
Copy link
Contributor Author

ABrehm264 commented Aug 15, 2016

@olivielpeau, I think I got it, can you check over it and let me know if it's good? If it's good, what are the next steps?
PRs:

and the travis-ci problems on the chef-handler-datadog are probably related to bundler pulling the bleeding edge versions of some gems.

I'm not really sure how to test the integration between chef-datadog and chef-handler-datadog though.

@ABrehm264
Copy link
Contributor Author

@olivielpeau, I changed the test name that you asked be changed per https://github.com/DataDog/chef-handler-datadog/pull/86/files#r75447388.

Thanks,
Alex

@olivielpeau olivielpeau added this to the 0.10.0 milestone Sep 8, 2016
ABrehm264 added a commit to ABrehm264/chef-datadog that referenced this issue Nov 2, 2016
ABrehm264 added a commit to ABrehm264/chef-datadog that referenced this issue Nov 2, 2016
ABrehm264 added a commit to ABrehm264/chef-datadog that referenced this issue Nov 23, 2016
degemer pushed a commit to DataDog/chef-datadog that referenced this issue Jan 23, 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

No branches or pull requests

5 participants