-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
[AIRFLOW-3559] Add missing options to DatadogHook. #4362
Conversation
c4bc3eb
to
359f778
Compare
Codecov Report
@@ Coverage Diff @@
## master #4362 +/- ##
=======================================
Coverage 79.45% 79.45%
=======================================
Files 204 204
Lines 16499 16499
=======================================
Hits 13109 13109
Misses 3390 3390 Continue to review full report at Codecov.
|
|
||
def validate_response(self, response): | ||
if response['status'] != 'ok': | ||
self.log.error("Datadog returned: %s", response) | ||
raise AirflowException("Error status received from Datadog") | ||
|
||
def send_metric(self, metric_name, datapoint, tags=None): | ||
def send_metric(self, metric_name, datapoint, tags=None, type_=None, interval=None): |
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.
typo .. type_
-> type
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.
or may be change the name to metric_type
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.
The option is called type
in the datadog docs, and I appended an underscore to avoid shadowing the type
builtin in python.
@@ -76,12 +65,18 @@ def send_metric(self, metric_name, datapoint, tags=None): | |||
:type datapoint: int or float | |||
:param tags: A list of tags associated with the metric | |||
:type tags: list | |||
:param type: Type of your metric either: gauge, rate, or count | |||
:type type: string |
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.
string
-> str
:param alert_type: The alert type for the event, one of | ||
["error", "warning", "info", "success"] | ||
:type alert_type: str | ||
:param aggregation_key: Key that can be used to aggregate this event in a stream | ||
:type aggregation_key: str | ||
:date_happened: POSIX timestamp of the event; defaults to now |
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.
:type date_happened:
359f778
to
984957d
Compare
Updated |
984957d
to
7bea258
Compare
PTAL when you have time @kaxil |
"Datadog connection details") | ||
if self.app_key is None: | ||
raise AirflowException("app_key must be specified in the " | ||
"Datadog connection details") |
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.
In absence of this code block when a user forgets to have api_key
in Connection extras, it won't give a useful error. Any reasoning behind removing this?
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.
In some cases, the app key isn't required (from https://docs.datadoghq.com/api/?lang=python#authentication):
Requests that write data require reporting access and require an API key. Requests that read data require full access and also require an application key.
I'll update so that the api key is required and the app key isn't.
7bea258
to
2815e58
Compare
Updated. |
Ready for review when you have time @kaxil |
Thanks @jmcarp |
Make sure you have checked all steps below.
Jira
Description
Adds missing arguments to
DatadogHook
.Tests
Backfills missing tests for
DatadogHook
Commits
Documentation
Code Quality
flake8