[GitHub] kaxil commented on a change in pull request #4362: [AIRFLOW-3559] Add missing options to DatadogHook.

2019-01-06 Thread GitBox
kaxil commented on a change in pull request #4362: [AIRFLOW-3559] Add missing 
options to DatadogHook.
URL: https://github.com/apache/airflow/pull/4362#discussion_r245520403
 
 

 ##
 File path: airflow/contrib/hooks/datadog_hook.py
 ##
 @@ -47,26 +47,15 @@ def __init__(self, datadog_conn_id='datadog_default'):
 # for all metric submissions.
 self.host = conn.host
 
-if self.api_key is None:
-raise AirflowException("api_key must be specified in the "
-   "Datadog connection details")
-if self.app_key is None:
-raise AirflowException("app_key must be specified in the "
-   "Datadog connection details")
 
 Review comment:
   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?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] kaxil commented on a change in pull request #4362: [AIRFLOW-3559] Add missing options to DatadogHook.

2018-12-26 Thread GitBox
kaxil commented on a change in pull request #4362: [AIRFLOW-3559] Add missing 
options to DatadogHook.
URL: https://github.com/apache/incubator-airflow/pull/4362#discussion_r244066305
 
 

 ##
 File path: airflow/contrib/hooks/datadog_hook.py
 ##
 @@ -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
 
 Review comment:
   `string` -> `str`


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] kaxil commented on a change in pull request #4362: [AIRFLOW-3559] Add missing options to DatadogHook.

2018-12-26 Thread GitBox
kaxil commented on a change in pull request #4362: [AIRFLOW-3559] Add missing 
options to DatadogHook.
URL: https://github.com/apache/incubator-airflow/pull/4362#discussion_r244066287
 
 

 ##
 File path: airflow/contrib/hooks/datadog_hook.py
 ##
 @@ -47,26 +47,15 @@ def __init__(self, datadog_conn_id='datadog_default'):
 # for all metric submissions.
 self.host = conn.host
 
-if self.api_key is None:
-raise AirflowException("api_key must be specified in the "
-   "Datadog connection details")
-if self.app_key is None:
-raise AirflowException("app_key must be specified in the "
-   "Datadog connection details")
-
 self.log.info("Setting up api keys for Datadog")
-options = {
-'api_key': self.api_key,
-'app_key': self.app_key
-}
-initialize(**options)
+initialize(api_key=self.api_key, app_key=self.app_key)
 
 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):
 
 Review comment:
   typo .. `type_` -> `type`


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] kaxil commented on a change in pull request #4362: [AIRFLOW-3559] Add missing options to DatadogHook.

2018-12-26 Thread GitBox
kaxil commented on a change in pull request #4362: [AIRFLOW-3559] Add missing 
options to DatadogHook.
URL: https://github.com/apache/incubator-airflow/pull/4362#discussion_r244066383
 
 

 ##
 File path: airflow/contrib/hooks/datadog_hook.py
 ##
 @@ -121,21 +117,37 @@ def post_event(self, title, text, tags=None, 
alert_type=None, aggregation_key=No
 :type title: str
 :param text: The body of the event (more information)
 :type text: str
-:param tags: List of string tags to apply to the event
-:type tags: list
+:param aggregation_key: Key that can be used to aggregate this event 
in a stream
+:type aggregation_key: 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
 
 Review comment:
   `:type date_happened:`


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] kaxil commented on a change in pull request #4362: [AIRFLOW-3559] Add missing options to DatadogHook.

2018-12-26 Thread GitBox
kaxil commented on a change in pull request #4362: [AIRFLOW-3559] Add missing 
options to DatadogHook.
URL: https://github.com/apache/incubator-airflow/pull/4362#discussion_r244066443
 
 

 ##
 File path: airflow/contrib/hooks/datadog_hook.py
 ##
 @@ -47,26 +47,15 @@ def __init__(self, datadog_conn_id='datadog_default'):
 # for all metric submissions.
 self.host = conn.host
 
-if self.api_key is None:
-raise AirflowException("api_key must be specified in the "
-   "Datadog connection details")
-if self.app_key is None:
-raise AirflowException("app_key must be specified in the "
-   "Datadog connection details")
-
 self.log.info("Setting up api keys for Datadog")
-options = {
-'api_key': self.api_key,
-'app_key': self.app_key
-}
-initialize(**options)
+initialize(api_key=self.api_key, app_key=self.app_key)
 
 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):
 
 Review comment:
   or may be change the name to `metric_type`


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services