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

feat: add threshold_windows support to DD module #60509

Draft
wants to merge 5 commits into
base: devel
from

Conversation

@Tyler-2
Copy link
Contributor

commented Aug 13, 2019

SUMMARY

Adds support for threshold window definitions in the Datadog monitor module. This is a crucial part of using their anomaly monitors.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

datadog_monitor

ADDITIONAL INFORMATION

@Tyler-2 Tyler-2 force-pushed the Tyler-2:patch-1 branch Aug 13, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Aug 13, 2019

@Tyler-2 Tyler-2 force-pushed the Tyler-2:patch-1 branch to 97b6f6e Aug 13, 2019

Tyler Schwend
@ansibot

This comment has been minimized.

Copy link
Contributor

commented Aug 13, 2019

The test ansible-test sanity --test ansible-doc [explain] failed with the error:

Command "ansible-doc -t module datadog_monitor" returned exit status 1.
>>> Standard Error
ERROR! module datadog_monitor missing documentation (or could not parse documentation): while scanning for the next token
found character that cannot start any token
  in "<unicode string>", line 100, column 15

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/usr/bin/python3.6 /root/ansible/test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make singlehtmldocs' failed with status code: 2
--> Standard Output
PYTHONPATH=../../lib ../../hacking/build-ansible.py collection-meta --template-file=../templates/collections_galaxy_meta.rst.j2 --output-dir=rst/dev_guide/ ../../lib/ansible/galaxy/data/collections_galaxy_meta.yml
PYTHONPATH=../../lib ../../hacking/build-ansible.py document-config --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/ ../../lib/ansible/config/base.yml
mkdir -p rst/cli
PYTHONPATH=../../lib ../../hacking/build-ansible.py generate-man --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst ../../lib/ansible/cli/*.py
PYTHONPATH=../../lib ../../hacking/build-ansible.py document-keywords --template-dir=../templates --output-dir=rst/reference_appendices/ ./keyword_desc.yml
PYTHONPATH=../../lib ../../hacking/build-ansible.py document-plugins -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/modules/ 
Evaluating module files...
Makefile:98: recipe for target 'modules' failed
--> Standard Error
Traceback (most recent call last):
  File "../../hacking/build-ansible.py", line 88, in <module>
    main()
  File "../../hacking/build-ansible.py", line 79, in main
    retval = command.main(args)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py", line 698, in main
    plugin_info, categories = get_plugin_info(args.module_dir, limit_to=args.limit_to, verbose=(args.verbosity > 0))
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py", line 225, in get_plugin_info
    doc, examples, returndocs, metadata = plugin_docs.get_docstring(module_path, fragment_loader, verbose=verbose)
  File "/root/ansible/lib/ansible/utils/plugin_docs.py", line 111, in get_docstring
    data = read_docstring(filename, verbose=verbose, ignore_errors=ignore_errors)
  File "/root/ansible/lib/ansible/parsing/plugin_docs.py", line 59, in read_docstring
    data[varkey] = AnsibleLoader(child.value.s, file_name=filename).get_single_data()
  File "/usr/local/lib/python3.6/dist-packages/yaml/constructor.py", line 41, in get_single_data
    node = self.get_single_node()
  File "ext/_yaml.pyx", line 707, in _yaml.CParser.get_single_node
  File "ext/_yaml.pyx", line 725, in _yaml.CParser._compose_document
  File "ext/_yaml.pyx", line 776, in _yaml.CParser._compose_node
  File "ext/_yaml.pyx", line 890, in _yaml.CParser._compose_mapping_node
  File "ext/_yaml.pyx", line 776, in _yaml.CParser._compose_node
  File "ext/_yaml.pyx", line 890, in _yaml.CParser._compose_mapping_node
  File "ext/_yaml.pyx", line 776, in _yaml.CParser._compose_node
  File "ext/_yaml.pyx", line 890, in _yaml.CParser._compose_mapping_node
  File "ext/_yaml.pyx", line 774, in _yaml.CParser._compose_node
  File "ext/_yaml.pyx", line 853, in _yaml.CParser._compose_sequence_node
  File "ext/_yaml.pyx", line 905, in _yaml.CParser._parse_next_event
yaml.scanner.ScannerError: while scanning for the next token
found character that cannot start any token
  in "<unicode string>", line 100, column 15
make: *** [modules] Error 1

The test ansible-test sanity --test validate-modules [explain] failed with 18 errors:

lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E326 Argument 'state' in argument_spec defines choices as (['present', 'absent', 'mute', 'unmute']) but documentation defines choices as ([])
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E326 Argument 'type' in argument_spec defines choices as (['metric alert', 'service check', 'event alert']) but documentation defines choices as ([])
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'api_key' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'app_key' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'escalation_message' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'evaluation_delay' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'id' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'message' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'name' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'new_host_delay' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'no_data_timeframe' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'query' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'renotify_interval' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'state' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'timeout_h' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'type' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:115:15: E302 DOCUMENTATION is not valid YAML
test/sanity/ignore.txt:2348:1: A100 Ignoring 'E324' on 'lib/ansible/modules/monitoring/datadog_monitor.py' is unnecessary

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

lib/ansible/modules/monitoring/datadog_monitor.py:115:15: error DOCUMENTATION: syntax error: found character '`' that cannot start any token

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Aug 13, 2019

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/usr/bin/python3.6 /root/ansible/test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make singlehtmldocs' failed with status code: 2
--> Standard Output
PYTHONPATH=../../lib ../../hacking/build-ansible.py collection-meta --template-file=../templates/collections_galaxy_meta.rst.j2 --output-dir=rst/dev_guide/ ../../lib/ansible/galaxy/data/collections_galaxy_meta.yml
PYTHONPATH=../../lib ../../hacking/build-ansible.py document-config --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/ ../../lib/ansible/config/base.yml
mkdir -p rst/cli
PYTHONPATH=../../lib ../../hacking/build-ansible.py generate-man --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst ../../lib/ansible/cli/*.py
PYTHONPATH=../../lib ../../hacking/build-ansible.py document-keywords --template-dir=../templates --output-dir=rst/reference_appendices/ ./keyword_desc.yml
PYTHONPATH=../../lib ../../hacking/build-ansible.py document-plugins -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/modules/ 
Evaluating module files...
Makefile:98: recipe for target 'modules' failed
--> Standard Error
Traceback (most recent call last):
  File "../../hacking/build-ansible.py", line 88, in <module>
    main()
  File "../../hacking/build-ansible.py", line 79, in main
    retval = command.main(args)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py", line 698, in main
    plugin_info, categories = get_plugin_info(args.module_dir, limit_to=args.limit_to, verbose=(args.verbosity > 0))
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py", line 225, in get_plugin_info
    doc, examples, returndocs, metadata = plugin_docs.get_docstring(module_path, fragment_loader, verbose=verbose)
  File "/root/ansible/lib/ansible/utils/plugin_docs.py", line 111, in get_docstring
    data = read_docstring(filename, verbose=verbose, ignore_errors=ignore_errors)
  File "/root/ansible/lib/ansible/parsing/plugin_docs.py", line 59, in read_docstring
    data[varkey] = AnsibleLoader(child.value.s, file_name=filename).get_single_data()
  File "/usr/local/lib/python3.6/dist-packages/yaml/constructor.py", line 41, in get_single_data
    node = self.get_single_node()
  File "ext/_yaml.pyx", line 707, in _yaml.CParser.get_single_node
  File "ext/_yaml.pyx", line 725, in _yaml.CParser._compose_document
  File "ext/_yaml.pyx", line 776, in _yaml.CParser._compose_node
  File "ext/_yaml.pyx", line 890, in _yaml.CParser._compose_mapping_node
  File "ext/_yaml.pyx", line 776, in _yaml.CParser._compose_node
  File "ext/_yaml.pyx", line 890, in _yaml.CParser._compose_mapping_node
  File "ext/_yaml.pyx", line 776, in _yaml.CParser._compose_node
  File "ext/_yaml.pyx", line 890, in _yaml.CParser._compose_mapping_node
  File "ext/_yaml.pyx", line 774, in _yaml.CParser._compose_node
  File "ext/_yaml.pyx", line 853, in _yaml.CParser._compose_sequence_node
  File "ext/_yaml.pyx", line 905, in _yaml.CParser._parse_next_event
yaml.parser.ParserError: while parsing a block collection
  in "<unicode string>", line 98, column 13
did not find expected '-' indicator
  in "<unicode string>", line 100, column 33
make: *** [modules] Error 1

The test ansible-test sanity --test ansible-doc [explain] failed with the error:

Command "ansible-doc -t module datadog_monitor" returned exit status 1.
>>> Standard Error
ERROR! module datadog_monitor missing documentation (or could not parse documentation): while parsing a block collection
  in "<unicode string>", line 98, column 13
did not find expected '-' indicator
  in "<unicode string>", line 100, column 33

The test ansible-test sanity --test validate-modules [explain] failed with 18 errors:

lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E326 Argument 'state' in argument_spec defines choices as (['present', 'absent', 'mute', 'unmute']) but documentation defines choices as ([])
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E326 Argument 'type' in argument_spec defines choices as (['metric alert', 'service check', 'event alert']) but documentation defines choices as ([])
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'api_key' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'app_key' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'escalation_message' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'evaluation_delay' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'id' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'message' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'name' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'new_host_delay' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'no_data_timeframe' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'query' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'renotify_interval' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'state' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'timeout_h' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'type' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:115:33: E302 DOCUMENTATION is not valid YAML
test/sanity/ignore.txt:2348:1: A100 Ignoring 'E324' on 'lib/ansible/modules/monitoring/datadog_monitor.py' is unnecessary

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

lib/ansible/modules/monitoring/datadog_monitor.py:115:33: error DOCUMENTATION: syntax error: expected <block end>, but found '<scalar>'

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Aug 13, 2019

The test ansible-test sanity --test ansible-doc [explain] failed with the error:

Command "ansible-doc -t module datadog_monitor" returned exit status 1.
>>> Standard Error
ERROR! module datadog_monitor missing documentation (or could not parse documentation): while parsing a block collection
  in "<unicode string>", line 98, column 11
did not find expected '-' indicator
  in "<unicode string>", line 100, column 31

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/usr/bin/python3.6 /root/ansible/test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make singlehtmldocs' failed with status code: 2
--> Standard Output
PYTHONPATH=../../lib ../../hacking/build-ansible.py collection-meta --template-file=../templates/collections_galaxy_meta.rst.j2 --output-dir=rst/dev_guide/ ../../lib/ansible/galaxy/data/collections_galaxy_meta.yml
PYTHONPATH=../../lib ../../hacking/build-ansible.py document-config --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/ ../../lib/ansible/config/base.yml
mkdir -p rst/cli
PYTHONPATH=../../lib ../../hacking/build-ansible.py generate-man --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst ../../lib/ansible/cli/*.py
PYTHONPATH=../../lib ../../hacking/build-ansible.py document-keywords --template-dir=../templates --output-dir=rst/reference_appendices/ ./keyword_desc.yml
PYTHONPATH=../../lib ../../hacking/build-ansible.py document-plugins -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/modules/ 
Evaluating module files...
Makefile:98: recipe for target 'modules' failed
--> Standard Error
Traceback (most recent call last):
  File "../../hacking/build-ansible.py", line 88, in <module>
    main()
  File "../../hacking/build-ansible.py", line 79, in main
    retval = command.main(args)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py", line 698, in main
    plugin_info, categories = get_plugin_info(args.module_dir, limit_to=args.limit_to, verbose=(args.verbosity > 0))
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py", line 225, in get_plugin_info
    doc, examples, returndocs, metadata = plugin_docs.get_docstring(module_path, fragment_loader, verbose=verbose)
  File "/root/ansible/lib/ansible/utils/plugin_docs.py", line 111, in get_docstring
    data = read_docstring(filename, verbose=verbose, ignore_errors=ignore_errors)
  File "/root/ansible/lib/ansible/parsing/plugin_docs.py", line 59, in read_docstring
    data[varkey] = AnsibleLoader(child.value.s, file_name=filename).get_single_data()
  File "/usr/local/lib/python3.6/dist-packages/yaml/constructor.py", line 41, in get_single_data
    node = self.get_single_node()
  File "ext/_yaml.pyx", line 707, in _yaml.CParser.get_single_node
  File "ext/_yaml.pyx", line 725, in _yaml.CParser._compose_document
  File "ext/_yaml.pyx", line 776, in _yaml.CParser._compose_node
  File "ext/_yaml.pyx", line 890, in _yaml.CParser._compose_mapping_node
  File "ext/_yaml.pyx", line 776, in _yaml.CParser._compose_node
  File "ext/_yaml.pyx", line 890, in _yaml.CParser._compose_mapping_node
  File "ext/_yaml.pyx", line 776, in _yaml.CParser._compose_node
  File "ext/_yaml.pyx", line 890, in _yaml.CParser._compose_mapping_node
  File "ext/_yaml.pyx", line 774, in _yaml.CParser._compose_node
  File "ext/_yaml.pyx", line 853, in _yaml.CParser._compose_sequence_node
  File "ext/_yaml.pyx", line 905, in _yaml.CParser._parse_next_event
yaml.parser.ParserError: while parsing a block collection
  in "<unicode string>", line 98, column 11
did not find expected '-' indicator
  in "<unicode string>", line 100, column 31
make: *** [modules] Error 1

The test ansible-test sanity --test validate-modules [explain] failed with 18 errors:

lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E326 Argument 'state' in argument_spec defines choices as (['present', 'absent', 'mute', 'unmute']) but documentation defines choices as ([])
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E326 Argument 'type' in argument_spec defines choices as (['metric alert', 'service check', 'event alert']) but documentation defines choices as ([])
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'api_key' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'app_key' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'escalation_message' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'evaluation_delay' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'id' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'message' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'name' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'new_host_delay' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'no_data_timeframe' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'query' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'renotify_interval' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'state' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'timeout_h' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E338 Argument 'type' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/monitoring/datadog_monitor.py:115:31: E302 DOCUMENTATION is not valid YAML
test/sanity/ignore.txt:2348:1: A100 Ignoring 'E324' on 'lib/ansible/modules/monitoring/datadog_monitor.py' is unnecessary

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

lib/ansible/modules/monitoring/datadog_monitor.py:115:31: error DOCUMENTATION: syntax error: expected <block end>, but found '<scalar>'

click here for bot help

Tyler Schwend

@Tyler-2 Tyler-2 force-pushed the Tyler-2:patch-1 branch to f57e236 Aug 13, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Aug 13, 2019

The test ansible-test sanity --test ansible-doc [explain] failed with the error:

Command "ansible-doc -t module datadog_monitor" returned exit status 250.
>>> Standard Error
ERROR! Unexpected Exception, this is probably a bug: expected string or bytes-like object

The test ansible-test sanity --test validate-modules [explain] failed with 3 errors:

lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E305 DOCUMENTATION.options.threshold_windows.description.2: expected str @ data['options']['threshold_windows']['description'][2]. Got {'recovery_window': 'Describes how long an anomalous metric must be normal before the alert recovers'}
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E305 DOCUMENTATION.options.threshold_windows.description.3: expected str @ data['options']['threshold_windows']['description'][3]. Got {'trigger_window': 'Describes how long a metric must be anomalous before an alert triggers'}
lib/ansible/modules/monitoring/datadog_monitor.py:0:0: E309 version_added for new option (threshold_windows) should be '2.9'. Currently StrictVersion ('0.0')

click here for bot help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.