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

[couchbase] Modified service_check_tags in couchbase.py to include user-specified tags. #3079

Merged
merged 1 commit into from
Feb 7, 2017

Conversation

arzarif
Copy link
Contributor

@arzarif arzarif commented Dec 13, 2016

What does this PR do?

The manner in which tags are applied to service checks and metric checks depends on 2 separate variables. This change modifies the variable that encapsulates tags relevant to service checks (service_check_tags). Currently for service checks, this variable applies only the host and port information provided in the instance configuration. This change will allow user-defined tags to similarly be applied to service checks (as is the case with metric checks).

Motivation

Several of the core integrations handle tags differently for the purposes of metric checks vs. service checks. It's unclear what motivated the inconsistent handling of tags in these contexts. When users are using tags to template alerts, this presents an unnecessary limitation that impacts the ability to template service check-based alerts.

While this PR addresses this inconsistency in one of these integrations (Couchbase), there should be an effort to normalize the handling of tags in different contexts across natively-supported integrations.

@hkaj hkaj added this to the 5.11.0 milestone Jan 2, 2017
@hkaj hkaj self-requested a review January 2, 2017 15:07
@hkaj hkaj changed the title [couchbase] Modified service_check_tags in zk.py to include user-spec… [couchbase] Modified service_check_tags in couchbase.py to include user-spec… Jan 2, 2017
Copy link
Member

@hkaj hkaj left a comment

Choose a reason for hiding this comment

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

Thanks @arzarif !
I left one minor comment to make it quicker to read, LGTM once it's addressed.

if service_check_tags is None:
service_check_tags = []
else:
service_check_tags = list(set(service_check_tags))
Copy link
Member

Choose a reason for hiding this comment

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

i think you can replace all that with service_check_tags = list(set(instance.get('tags') or []))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@hkaj I made the changes in this way to keep service tag collection consistent with how tags are collected elsewhere in this check. See:

https://github.com/arzarif/dd-agent/blob/b5932ebabf73765e25c2a330ae41a9bf932fc789/checks.d/couchbase.py#L152-L159

Copy link
Contributor

Choose a reason for hiding this comment

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

@hkaj, @arzarif is correct. I'm going to approve and merge this.

@masci masci modified the milestones: 5.11.0, 5.12.0 Jan 24, 2017
@gmmeyer gmmeyer merged commit efd90f0 into DataDog:master Feb 7, 2017
degemer added a commit that referenced this pull request Feb 7, 2017
* master: (67 commits)
  [network] dont combine connection states (#3158)
  renames function in line with other checks
  [couchbase] Modified service_check_tags in couchbase.py to include user-specified tags. (#3079)
  [docker] fix image tag extraction
  Fix tests, refactor how we collect container and volume states
  test_docker_daemon.py: fix syntax errors
  Beginning work on docker_daemon tests.
  Add 5 opt-in checks to docker_daemon
  add mention of office hours (#3171)
  updates psycopg2 to 2.6.2 (#3170)
  [trace-agent] adding output of 'trace-agent -info' (#3164)
  [riak] Change default value in configuration example to match default value from the code
  move setting parameter to instance level
  riak security support
  [dns_check][ci] Bring back assertions on metrics (#3162)
  [powerdns_recursor] adds support for v4. (#3166)
  [tcp_check] Add custom tags to response_time gauge
  catch can't connect instead of failing on nodata found (#3127)
  [php-fpm] add http_host tag
  [dns_check] Document NXDOMAIN usage in yaml example file
  ...
@gmmeyer gmmeyer changed the title [couchbase] Modified service_check_tags in couchbase.py to include user-spec… [couchbase] Modified service_check_tags in couchbase.py to include user-specified tags. Feb 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants