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

Normalize count metric type in assert_metrics_using_metadata() #7666

Merged
merged 1 commit into from
Sep 28, 2020

Conversation

florimondmanca
Copy link
Contributor

@florimondmanca florimondmanca commented Sep 25, 2020

What does this PR do?

Allow monotonic_count metrics to match expected type of count when comparing collected metrics with metadata.csv.

Motivation

metadata.csv cannot contain monotonic_count (only count is allowed AFAIK), so when a monotonic_count metric is submitted and is defined in metadata.csv, assert_metrics_using_metadata() fails.

Example for Azure IoT Edge (currently making #7465 fail):

tests/test_check.py:58: in test_check
    aggregator.assert_metrics_using_metadata(get_metadata_metrics())
../datadog_checks_base/datadog_checks/base/stubs/aggregator.py:358: in assert_metrics_using_metadata
    assert not errors, "Metadata assertion errors using metadata.csv:" + "\n\t- ".join([''] + sorted(errors))
E   AssertionError: Metadata assertion errors using metadata.csv:
E       - Expect `azure.iot_edge.edge_agent.iothub_syncs_total` to have type `count` but got `monotonic_count`.
E       - Expect `azure.iot_edge.edge_agent.module_start_total` to have type `count` but got `monotonic_count`.
E       - Expect `azure.iot_edge.edge_agent.module_stop_total` to have type `count` but got `monotonic_count`.
E       - Expect `azure.iot_edge.edge_agent.unsuccessful_iothub_syncs_total` to have type `count` but got `monotonic_count`.
E       - Expect `azure.iot_edge.edge_hub.client_connect_failed_total` to have type `count` but got `monotonic_count`.

Additional Notes

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have changelog/ and integration/ labels attached

@codecov
Copy link

codecov bot commented Sep 25, 2020

Codecov Report

Merging #7666 into master will decrease coverage by 0.36%.
The diff coverage is 0.00%.

Impacted Files Coverage Δ
...hecks_base/datadog_checks/base/stubs/aggregator.py 66.40% <0.00%> (-0.54%) ⬇️
datadog_checks_base/tests/test_pdhbasecheck.py 36.25% <0.00%> (-63.75%) ⬇️
datadog_checks_base/tests/test_winpdh.py 40.81% <0.00%> (-57.15%) ⬇️
datadog_checks_base/tests/test_wmisampler.py 43.93% <0.00%> (-56.07%) ⬇️
datadog_checks_base/tests/test_wmicheck.py 69.23% <0.00%> (-30.77%) ⬇️
mapreduce/tests/common.py 91.35% <0.00%> (-2.47%) ⬇️
datadog_checks_base/datadog_checks/base/ddyaml.py 59.70% <0.00%> (-1.50%) ⬇️
etcd/tests/test_integration.py 97.43% <0.00%> (-0.86%) ⬇️
prometheus/datadog_checks/prometheus/prometheus.py
hazelcast/datadog_checks/hazelcast/__init__.py
... and 208 more

@florimondmanca florimondmanca merged commit 81d200d into master Sep 28, 2020
@florimondmanca florimondmanca deleted the fm/assert-metadata-normalize-metric-type branch September 28, 2020 09:36
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.

2 participants