You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/04/01 11:50:03 UTC
[GitHub] [airflow] ashb opened a new pull request #15132: Fix bug in airflow.stats timing that broke dogstatsd mode
ashb opened a new pull request #15132:
URL: https://github.com/apache/airflow/pull/15132
The fix for this was very easy -- just a `timer` -> `timed` typo.
However it turns out that the tests for airflow.stats were insufficient
and didn't catch this, so I have extended the tests in two ways:
1. Test all the other stat methods than just incr (guage, timer, timing,
decr)
2. Use "auto-specing" feature of Mock to ensure that we can't make up
methods to call on a mock object.
> Autospeccing is based on the existing spec feature of mock.
> It limits the api of mocks to the api of an original object (the
> spec), but it is recursive (implemented lazily) so that attributes of
> mocks only have the same api as the attributes of the spec. In
> addition mocked functions / methods have the same call signature as
> the original so they raise a TypeError if they are called
> incorrectly.
Fixed #14839
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ashb commented on a change in pull request #15132: Fix bug in airflow.stats timing that broke dogstatsd mode
Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #15132:
URL: https://github.com/apache/airflow/pull/15132#discussion_r605592860
##########
File path: tests/core/test_stats.py
##########
@@ -31,17 +31,7 @@
class CustomStatsd(statsd.StatsClient):
- incr_calls = 0
-
- def __init__(self, host=None, port=None, prefix=None):
- super().__init__()
-
- def incr(self, stat, count=1, rate=1): # pylint: disable=unused-argument
- CustomStatsd.incr_calls += 1
-
- @classmethod
- def _reset(cls):
- cls.incr_calls = 0
Review comment:
These were never used, so I removed them. Drive by refactor.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ashb merged pull request #15132: Fix bug in airflow.stats timing that broke dogstatsd mode
Posted by GitBox <gi...@apache.org>.
ashb merged pull request #15132:
URL: https://github.com/apache/airflow/pull/15132
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org