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

Make service check statuses available as constants #2960

Merged
merged 1 commit into from
Jan 16, 2019
Merged

Conversation

ofek
Copy link
Contributor

@ofek ofek commented Jan 16, 2019

Motivation

Easier access for utility functions that map product statuses to service check statuses

@codecov-io
Copy link

codecov-io commented Jan 16, 2019

Codecov Report

Merging #2960 into master will decrease coverage by 0.29%.
The diff coverage is 0%.

@@            Coverage Diff            @@
##           master    #2960     +/-   ##
=========================================
- Coverage   84.86%   84.56%   -0.3%     
=========================================
  Files         652      663     +11     
  Lines       36125    38139   +2014     
  Branches     4292     4559    +267     
=========================================
+ Hits        30656    32253   +1597     
- Misses       4203     4538    +335     
- Partials     1266     1348     +82

@@ -28,6 +28,7 @@
using_stub_aggregator = True

from ..config import is_affirmative
from ..constants import ServiceCheck
Copy link
Contributor

Choose a reason for hiding this comment

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

why move this to a new file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well it's a constant so it makes sense. Also there are others below like ONE_PER_CONTEXT_METRIC_TYPES that we should eventually move there as well

Copy link
Contributor

Choose a reason for hiding this comment

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

Being able to access them from base seems very handy.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, that makes sense. But since these all still need to be members of the class it would just cut down on duplication in the AgentCheck classes, I suppose

Copy link
Collaborator

@nmuesch nmuesch left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks

@gmmeyer
Copy link
Contributor

gmmeyer commented Jan 16, 2019

Can you elaborate on what change you're planning on making that will rely upon this? I don't dislike this, I just wanna know the context

Copy link
Contributor

@gzussa gzussa left a comment

Choose a reason for hiding this comment

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

Actually I think @gmmeyer comment is very relevant here.

@ofek
Copy link
Contributor Author

ofek commented Jan 16, 2019

@gmmeyer

<CHECK>/utils.py

from datadog_checks.base.constants import ServiceCheck


def product_state_to_service_check(state):
    if state == 'ACTIVE':
        return ServiceCheck.OK
    ....

@gmmeyer
Copy link
Contributor

gmmeyer commented Jan 16, 2019

Is there a check you want to use this in now?

@ofek
Copy link
Contributor Author

ofek commented Jan 16, 2019

Yes, ibm_db2

@ofek ofek merged commit e56a70c into master Jan 16, 2019
@ofek ofek deleted the ofek/constants branch January 16, 2019 18:52
@gzussa gzussa mentioned this pull request Jan 22, 2019
5 tasks
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.

6 participants