-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Use seconds for schedule_delay metric #18622
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
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
|
|
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This belongs in the DataDogstatsd adapter inside airflow.stats -- as the normal statsd client accepts timedelta.
I.e. add an isinstance check in here
Lines 333 to 339 in abdede8
| @validate_stat | |
| def timing(self, stat, dt, tags=None): | |
| """Stats timing""" | |
| if self.allow_list_validator.test(stat): | |
| tags = tags or [] | |
| return self.dogstatsd.timing(metric=stat, value=dt, tags=tags) | |
| return None |
|
Agreed, the stat backend should be able to handle timedelta instead. |
|
Could you add a test for this in |
|
added test. what do you mean by |
|
Function parameter annotations. The functions are already partially annotated, but we should annotate |
|
@uranusjr anything else i need to do to merge the PR? |
|
You need to first fix the static checks and tests. Looks like your Union import is breaking things. |
|
Now tests are faling |
|
I'm still not 100% sure this is "right" as many of the timer metrics we track are <1s, so this would just submit 0 values for them making them useless. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just double checked and no, this is not right.
Using the code example from https://docs.datadoghq.com/metrics/dogstatsd_metrics_submission/#timer
from datadog import initialize, statsd
import time
import random
options = {
'statsd_host':'127.0.0.1',
'statsd_port':8125
}
initialize(**options)
@statsd.timed('example_metric.timer', tags=["environment:dev,function:my_function"])
def my_function():
time.sleep(random.randint(0, 10))
my_function()this is what I see submited to statsd:
example_metric.timer:1.836400042520836e-05|ms|#environment:dev_function:my_function
|
what's not right? total_seconds returns a float. |
🤦🏻 Of course it does. I thought it was integer seconds only. Sorry |
|
Tests are failing, can you take a look plz |
|
@coinzerge can you please fix the test failure? |
|
Fixed by #19973 |
closes: #18599
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.